我正在尝试使用 Github 的 node.js 工作流程在我的存储库上进行自动化测试。但是,我遇到了困难,因为节点是在子目录中设置的,而不是在存储库的根目录中。我一直在寻找一种方法来指定运行 npm 命令的目录,但没有找到任何答案。
这是工作流程代码:
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
with:
path: backend_app
- name: Use Node.js …Run Code Online (Sandbox Code Playgroud) 我有golang一个react客户的回购。我想为我的客户端使用 github 操作设置 CI。React 客户端client位于工作区中的文件夹内。我编写了以下工作流程
name : Node.js CI
on: [push, pull_request]
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
path: client
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: yarn install
- run: yarn build
Run Code Online (Sandbox Code Playgroud)
但是在提交时显示以下错误
Run yarn build1s
##[error]Process completed with exit code 1.
Run yarn build
yarn run v1.21.1
error Couldn't find a package.json file in "/home/runner/work/evential/evential"
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this …Run Code Online (Sandbox Code Playgroud)