From 7934540260dbc38490a462cdbcfb8cf483718b18 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 4 Mar 2022 16:19:26 +1100 Subject: [PATCH] ci: deduplicate using matrix --- .github/workflows/nodejs.yml | 83 ++++++------------------------------ 1 file changed, 12 insertions(+), 71 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 5e9a35df6ec5..5c0e2aeafd80 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -66,13 +66,16 @@ jobs: - name: check copyright headers run: yarn check-copyright-headers - test-1: - name: Node v${{ matrix.node-version }} on ${{ matrix.os }} (1/2) + test: + name: Node v${{ matrix.node-version }} on ${{ matrix.os }} (${{ matrix.shard }}/2) strategy: fail-fast: false matrix: node-version: [12.x, 14.x, 16.x, 17.x] os: [ubuntu-latest, macOS-latest, windows-latest] + include: + - shard: 1 + - shard: 2 runs-on: ${{ matrix.os }} needs: prepare-yarn-cache @@ -97,79 +100,17 @@ jobs: id: cpu-cores uses: SimenB/github-actions-cpu-cores@v1 - name: run tests - run: yarn test-ci-partial:parallel --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=1/2 + run: yarn test-ci-partial:parallel --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=${{ matrix.shard }}/2 - test-2: - name: Node v${{ matrix.node-version }} on ${{ matrix.os }} (2/2) - strategy: - fail-fast: false - matrix: - node-version: [12.x, 14.x, 16.x, 17.x] - os: [ubuntu-latest, macOS-latest, windows-latest] - runs-on: ${{ matrix.os }} - needs: prepare-yarn-cache - - steps: - - name: Set git config - shell: bash - run: | - git config --global core.autocrlf false - git config --global core.symlinks true - if: runner.os == 'Windows' - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: yarn - - name: install - run: yarn --immutable - - name: build - run: yarn build:js - - name: Get number of CPU cores - id: cpu-cores - uses: SimenB/github-actions-cpu-cores@v1 - - name: run tests - run: yarn test-ci-partial:parallel --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=2/2 - - test-jasmine-1: - name: Node LTS on ${{ matrix.os }} using jest-jasmine2 (1/2) - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] - runs-on: ${{ matrix.os }} - needs: prepare-yarn-cache - - steps: - - name: Set git config - shell: bash - run: | - git config --global core.autocrlf false - git config --global core.symlinks true - if: runner.os == 'Windows' - - uses: actions/checkout@v3 - - name: Use Node.js LTS - uses: actions/setup-node@v3 - with: - node-version: lts/* - cache: yarn - - name: install - run: yarn --immutable - - name: build - run: yarn build:js - - name: Get number of CPU cores - id: cpu-cores - uses: SimenB/github-actions-cpu-cores@v1 - - name: run tests using jest-jasmine - run: yarn jest-jasmine-ci --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=1/2 - - test-jasmine-2: - name: Node LTS on ${{ matrix.os }} using jest-jasmine2 (2/2) + test-jasmine: + name: Node LTS on ${{ matrix.os }} using jest-jasmine2 (${{ matrix.shard }}/2) strategy: fail-fast: false matrix: os: [ubuntu-latest, macOS-latest, windows-latest] + include: + - shard: 1 + - shard: 2 runs-on: ${{ matrix.os }} needs: prepare-yarn-cache @@ -194,7 +135,7 @@ jobs: id: cpu-cores uses: SimenB/github-actions-cpu-cores@v1 - name: run tests using jest-jasmine - run: yarn jest-jasmine-ci --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=2/2 + run: yarn jest-jasmine-ci --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=${{ matrix.shard }}/2 test-coverage: name: Node LTS on Ubuntu with coverage