Skip to content

Commit

Permalink
Move if-s to job-level in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor authored Jan 14, 2024
1 parent 974bd94 commit 9832486
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,31 @@ jobs:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
node-version: [16.x, 18.x]
if: ${{ needs.changes.outputs.cms == 'true' }}
steps:
- uses: actions/checkout@v3
if: ${{ needs.changes.outputs.cms == 'true' }}
- name: Use Node.js {{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
check-latest: true
if: ${{ needs.changes.outputs.cms == 'true' }}
- name: log versions
run: node --version && npm --version && yarn --version
if: ${{ needs.changes.outputs.cms == 'true' }}
- name: install dependecies
run: yarn --frozen-lockfile --network-timeout 1000000 && yarn bootstrap
if: ${{ needs.changes.outputs.cms == 'true' }}
- name: run unit tests
run: yarn test:ci
env:
CI: true
NODE_OPTIONS: --max-old-space-size=4096
if: ${{ needs.changes.outputs.cms == 'true' }}
- name: build demo site
run: yarn build:demo
env:
NODE_OPTIONS: --max-old-space-size=4096
if: ${{ needs.changes.outputs.cms == 'true' }}
- uses: actions/upload-artifact@master
with:
name: dev-test-website-${{ runner.os }}-${{ matrix.node-version }}
path: dev-test
if: ${{ needs.changes.outputs.cms == 'true' }}

e2e-with-cypress:
needs: [changes, build]
Expand All @@ -69,28 +63,25 @@ jobs:
node-version: [16.x, 18.x]
fail-fast: false

if: ${{ needs.changes.outputs.cms == 'true' }}
steps:
- uses: actions/checkout@v3
if: ${{ needs.changes.outputs.cms == 'true' }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
check-latest: true
cache: yarn
if: ${{ needs.changes.outputs.cms == 'true' }}
- uses: actions/download-artifact@master
with:
name: dev-test-website-${{ runner.os }}-18.x
path: dev-test
if: ${{ needs.changes.outputs.cms == 'true' }}
- name: npm install
run: |
node --version
npm --version
yarn --version
yarn --frozen-lockfile
if: ${{ needs.changes.outputs.cms == 'true' }}
- name: e2e test
run: |
yarn test:e2e:run-ci
Expand All @@ -100,9 +91,8 @@ jobs:
NODE_OPTIONS: --max-old-space-size=4096
MACHINE_COUNT: 2
MACHINE_INDEX: ${{ matrix.node-version }}
if: ${{ needs.changes.outputs.cms == 'true' }}
- uses: actions/upload-artifact@v3
if: ${{ always() && needs.changes.outputs.cms == 'true' }}
if: ${{ always() }}
with:
name: cypress-results-${{ matrix.node-version }}
path: |
Expand Down

0 comments on commit 9832486

Please sign in to comment.