Skip to content

Commit

Permalink
ci: deduplicate using matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed Mar 4, 2022
1 parent 3052d3b commit 7934540
Showing 1 changed file with 12 additions and 71 deletions.
83 changes: 12 additions & 71 deletions .github/workflows/nodejs.yml
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 7934540

Please sign in to comment.