我有这个git动作设置,我想在folder1
上运行regression
,而不是folder2
。
name: Node.js CI
on:
push:
branches: [ develop ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
dir: ['./folder1', 'folder2']
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm ci
- name: Run regression tests
run: npm run regression
我们如何做到这一点?
您可以使用if
条件来完成此操作。
name: Node.js CI
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
dir: ['./folder1', 'folder2']
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm ci
run: npm run lint
- name: Run unit
run: npm run test:unit
working-directory: ${{ matrix.dir }}
- name: Run integration
if: ${{ matrix.dir == './folder1' }}
run: npm run test:integration
working-directory: ${{ matrix.dir }}