From 6256f253f0037f25daec848605b3366ad707b8b2 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 13 May 2022 09:42:25 +0200 Subject: [PATCH 1/7] chore(ci): attempt to streamline CI runs --- .github/workflows/nodejs.yml | 63 +++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 15 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index c05ad30dcda5..dd9ff99f7155 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -13,14 +13,47 @@ concurrency: cancel-in-progress: true jobs: - prepare-yarn-cache: + prepare-yarn-cache-ubuntu-latest: name: Prepare yarn cache - strategy: - fail-fast: false - matrix: - # for some reason the Windows cache doesn't work - os: [ubuntu-latest, macOS-latest] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: lts/* + cache: yarn + + - name: Validate cache + env: + # Use PnP and disable postinstall scripts as this just needs to + # populate the cache for the other jobs + YARN_NODE_LINKER: pnp + YARN_ENABLE_SCRIPTS: false + run: yarn --immutable + prepare-yarn-cache-macos-latest: + name: Prepare yarn cache + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: lts/* + cache: yarn + + - name: Validate cache + env: + # Use PnP and disable postinstall scripts as this just needs to + # populate the cache for the other jobs + YARN_NODE_LINKER: pnp + YARN_ENABLE_SCRIPTS: false + run: yarn --immutable + prepare-yarn-cache-windows-latest: + name: Prepare yarn cache + runs-on: windows-latest steps: - uses: actions/checkout@v3 @@ -41,7 +74,7 @@ jobs: ts-compatibility: name: TypeScript Compatibility runs-on: ubuntu-latest - needs: prepare-yarn-cache + needs: prepare-yarn-cache-ubuntu steps: - uses: actions/checkout@v3 @@ -63,7 +96,7 @@ jobs: lint: name: Lint runs-on: ubuntu-latest - needs: prepare-yarn-cache + needs: prepare-yarn-cache-ubuntu steps: - uses: actions/checkout@v3 @@ -87,7 +120,7 @@ jobs: yarn-validate: name: Validate Yarn dependencies and constraints runs-on: ubuntu-latest - needs: prepare-yarn-cache + needs: prepare-yarn-cache-ubuntu steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -105,10 +138,10 @@ jobs: fail-fast: false matrix: node-version: [12.x, 14.x, 16.x, 17.x, 18.x] - os: [ubuntu-latest, macOS-latest, windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] shard: ['1/4', '2/4', '3/4', '4/4'] runs-on: ${{ matrix.os }} - needs: prepare-yarn-cache + needs: prepare-yarn-cache-${{ matrix.os }} steps: - name: Set git config @@ -136,10 +169,10 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] shard: ['1/4', '2/4', '3/4', '4/4'] runs-on: ${{ matrix.os }} - needs: prepare-yarn-cache + needs: prepare-yarn-cache-${{ matrix.os }} steps: - name: Set git config @@ -169,7 +202,7 @@ jobs: matrix: shard: ['1/4', '2/4', '3/4', '4/4'] runs-on: ubuntu-latest - needs: prepare-yarn-cache + needs: prepare-yarn-cache-ubuntu-latest steps: - uses: actions/checkout@v3 From 73a03b97a888d6a0c95f535cdd0afc755461e85e Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 13 May 2022 10:02:29 +0200 Subject: [PATCH 2/7] maybe this? --- .github/workflows/nodejs.yml | 164 ++++++++-------------------- .github/workflows/prepare-cache.yml | 33 ++++++ .github/workflows/test-jasmine.yml | 39 +++++++ .github/workflows/test.yml | 39 +++++++ 4 files changed, 155 insertions(+), 120 deletions(-) create mode 100644 .github/workflows/prepare-cache.yml create mode 100644 .github/workflows/test-jasmine.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index dd9ff99f7155..b38aa0d01836 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -13,63 +13,18 @@ concurrency: cancel-in-progress: true jobs: - prepare-yarn-cache-ubuntu-latest: - name: Prepare yarn cache - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: lts/* - cache: yarn - - - name: Validate cache - env: - # Use PnP and disable postinstall scripts as this just needs to - # populate the cache for the other jobs - YARN_NODE_LINKER: pnp - YARN_ENABLE_SCRIPTS: false - run: yarn --immutable - prepare-yarn-cache-macos-latest: - name: Prepare yarn cache - runs-on: macos-latest - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: lts/* - cache: yarn - - - name: Validate cache - env: - # Use PnP and disable postinstall scripts as this just needs to - # populate the cache for the other jobs - YARN_NODE_LINKER: pnp - YARN_ENABLE_SCRIPTS: false - run: yarn --immutable - prepare-yarn-cache-windows-latest: - name: Prepare yarn cache - runs-on: windows-latest - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: lts/* - cache: yarn - - - name: Validate cache - env: - # Use PnP and disable postinstall scripts as this just needs to - # populate the cache for the other jobs - YARN_NODE_LINKER: pnp - YARN_ENABLE_SCRIPTS: false - run: yarn --immutable + prepare-yarn-cache-ubuntu: + uses: ./.github/workflows/prepare-cache.yml + with: + os: ubuntu-latest + prepare-yarn-cache-macos: + uses: ./.github/workflows/prepare-cache.yml + with: + os: macos-latest + prepare-yarn-cache-windows: + uses: ./.github/workflows/prepare-cache.yml + with: + os: windows-latest ts-compatibility: name: TypeScript Compatibility @@ -132,68 +87,37 @@ jobs: - name: 'Check for duplicate dependencies (fix w/ "yarn dedupe")' run: yarn dedupe --check - test: - name: Node v${{ matrix.node-version }} on ${{ matrix.os }} (${{ matrix.shard }}) - strategy: - fail-fast: false - matrix: - node-version: [12.x, 14.x, 16.x, 17.x, 18.x] - os: [ubuntu-latest, macos-latest, windows-latest] - shard: ['1/4', '2/4', '3/4', '4/4'] - runs-on: ${{ matrix.os }} - needs: prepare-yarn-cache-${{ matrix.os }} - - steps: - - name: Set git config - shell: bash - run: 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=${{ matrix.shard }} - - test-jasmine: - name: Node LTS on ${{ matrix.os }} using jest-jasmine2 (${{ matrix.shard }}) - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - shard: ['1/4', '2/4', '3/4', '4/4'] - runs-on: ${{ matrix.os }} - needs: prepare-yarn-cache-${{ matrix.os }} - - steps: - - name: Set git config - shell: bash - run: 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=${{ matrix.shard }} + test-ubuntu: + uses: ./.github/workflows/test.yml + needs: prepare-yarn-cache-ubuntu + with: + os: ubuntu-latest + test-macos: + uses: ./.github/workflows/test.yml + needs: prepare-yarn-cache-macos + with: + os: macos-latest + test-windows: + uses: ./.github/workflows/test.yml + needs: prepare-yarn-cache-windows + with: + os: windows-latest + + test-jasmine-ubuntu: + uses: ./.github/workflows/test-jasmine.yml + needs: prepare-yarn-cache-ubuntu + with: + os: ubuntu-latest + test-jasmine-macos: + uses: ./.github/workflows/test-jasmine.yml + needs: prepare-yarn-cache-macos + with: + os: macos-latest + test-jasmine-windows: + uses: ./.github/workflows/test-jasmine.yml + needs: prepare-yarn-cache-windows + with: + os: windows-latest test-coverage: name: Node LTS on Ubuntu with coverage (${{ matrix.shard }}) @@ -202,7 +126,7 @@ jobs: matrix: shard: ['1/4', '2/4', '3/4', '4/4'] runs-on: ubuntu-latest - needs: prepare-yarn-cache-ubuntu-latest + needs: prepare-yarn-cache-ubuntu steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/prepare-cache.yml b/.github/workflows/prepare-cache.yml new file mode 100644 index 000000000000..d2c762be02d4 --- /dev/null +++ b/.github/workflows/prepare-cache.yml @@ -0,0 +1,33 @@ +name: Prepare CI cache + +on: + workflow_call: + inputs: + os: + required: true + type: string + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + prepare-yarn-cache: + name: Prepare yarn cache + runs-on: ${{ inputs.os }} + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: lts/* + cache: yarn + + - name: Validate cache + env: + # Use PnP and disable postinstall scripts as this just needs to + # populate the cache for the other jobs + YARN_NODE_LINKER: pnp + YARN_ENABLE_SCRIPTS: false + run: yarn --immutable diff --git a/.github/workflows/test-jasmine.yml b/.github/workflows/test-jasmine.yml new file mode 100644 index 000000000000..1afa0a383ed7 --- /dev/null +++ b/.github/workflows/test-jasmine.yml @@ -0,0 +1,39 @@ +name: Test + +on: + workflow_call: + inputs: + os: + required: true + type: string + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + test: + strategy: + fail-fast: false + matrix: + node-version: [12.x, 14.x, 16.x, 17.x, 18.x] + shard: ['1/4', '2/4', '3/4', '4/4'] + name: Node v${{ matrix.node-version }} on ${{ inputs.os }} (${{ matrix.shard }}) + runs-on: ${{ inputs.os }} + + steps: + - 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=${{ matrix.shard }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000000..d7d1c70ccd2d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,39 @@ +name: Test + +on: + workflow_call: + inputs: + os: + required: true + type: string + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + test: + strategy: + fail-fast: false + matrix: + node-version: [12.x, 14.x, 16.x, 17.x, 18.x] + shard: ['1/4', '2/4', '3/4', '4/4'] + name: Node v${{ matrix.node-version }} on ${{ input.os }} (${{ matrix.shard }}) + runs-on: ${{ inputs.os }} + + steps: + - 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=${{ matrix.shard }} From d1044b8f6c149601b61c30f864bbd5b0f72abec8 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 13 May 2022 10:03:38 +0200 Subject: [PATCH 3/7] typo --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d7d1c70ccd2d..7dfc7e019dd7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: matrix: node-version: [12.x, 14.x, 16.x, 17.x, 18.x] shard: ['1/4', '2/4', '3/4', '4/4'] - name: Node v${{ matrix.node-version }} on ${{ input.os }} (${{ matrix.shard }}) + name: Node v${{ matrix.node-version }} on ${{ inputs.os }} (${{ matrix.shard }}) runs-on: ${{ inputs.os }} steps: From 9dd77bad59ffac490e96b240682333ae4ea43f46 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 13 May 2022 10:05:42 +0200 Subject: [PATCH 4/7] remove concurrency --- .github/workflows/prepare-cache.yml | 4 ---- .github/workflows/test-jasmine.yml | 4 ---- .github/workflows/test.yml | 4 ---- 3 files changed, 12 deletions(-) diff --git a/.github/workflows/prepare-cache.yml b/.github/workflows/prepare-cache.yml index d2c762be02d4..8c2c1f38552f 100644 --- a/.github/workflows/prepare-cache.yml +++ b/.github/workflows/prepare-cache.yml @@ -7,10 +7,6 @@ on: required: true type: string -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - jobs: prepare-yarn-cache: name: Prepare yarn cache diff --git a/.github/workflows/test-jasmine.yml b/.github/workflows/test-jasmine.yml index 1afa0a383ed7..2098b7994ff4 100644 --- a/.github/workflows/test-jasmine.yml +++ b/.github/workflows/test-jasmine.yml @@ -7,10 +7,6 @@ on: required: true type: string -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - jobs: test: strategy: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7dfc7e019dd7..227bba22bc8d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,10 +7,6 @@ on: required: true type: string -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - jobs: test: strategy: From 4dd79ba9ce93709296c35081d6cd04510018a106 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 13 May 2022 10:05:58 +0200 Subject: [PATCH 5/7] title --- .github/workflows/prepare-cache.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prepare-cache.yml b/.github/workflows/prepare-cache.yml index 8c2c1f38552f..0ba407b5e519 100644 --- a/.github/workflows/prepare-cache.yml +++ b/.github/workflows/prepare-cache.yml @@ -9,7 +9,7 @@ on: jobs: prepare-yarn-cache: - name: Prepare yarn cache + name: Prepare yarn cache for ${{ inputs.os }} runs-on: ${{ inputs.os }} steps: From e8cb56db274cdc8857a1ff9365b674b1392bc5ed Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 13 May 2022 10:10:53 +0200 Subject: [PATCH 6/7] colocate test runs --- .github/workflows/nodejs.yml | 16 -------------- .github/workflows/test-jasmine.yml | 35 ------------------------------ .github/workflows/test.yml | 25 +++++++++++++++++++++ 3 files changed, 25 insertions(+), 51 deletions(-) delete mode 100644 .github/workflows/test-jasmine.yml diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index b38aa0d01836..e72e92e76d6f 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -103,22 +103,6 @@ jobs: with: os: windows-latest - test-jasmine-ubuntu: - uses: ./.github/workflows/test-jasmine.yml - needs: prepare-yarn-cache-ubuntu - with: - os: ubuntu-latest - test-jasmine-macos: - uses: ./.github/workflows/test-jasmine.yml - needs: prepare-yarn-cache-macos - with: - os: macos-latest - test-jasmine-windows: - uses: ./.github/workflows/test-jasmine.yml - needs: prepare-yarn-cache-windows - with: - os: windows-latest - test-coverage: name: Node LTS on Ubuntu with coverage (${{ matrix.shard }}) strategy: diff --git a/.github/workflows/test-jasmine.yml b/.github/workflows/test-jasmine.yml deleted file mode 100644 index 2098b7994ff4..000000000000 --- a/.github/workflows/test-jasmine.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Test - -on: - workflow_call: - inputs: - os: - required: true - type: string - -jobs: - test: - strategy: - fail-fast: false - matrix: - node-version: [12.x, 14.x, 16.x, 17.x, 18.x] - shard: ['1/4', '2/4', '3/4', '4/4'] - name: Node v${{ matrix.node-version }} on ${{ inputs.os }} (${{ matrix.shard }}) - runs-on: ${{ inputs.os }} - - steps: - - 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=${{ matrix.shard }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 227bba22bc8d..93bf1e30ffa6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,3 +33,28 @@ jobs: uses: SimenB/github-actions-cpu-cores@v1 - name: run tests run: yarn test-ci-partial:parallel --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=${{ matrix.shard }} + + test-jasmine: + strategy: + fail-fast: false + matrix: + shard: ['1/4', '2/4', '3/4', '4/4'] + name: Node LTS on ${{ matrix.os }} using jest-jasmine2 (${{ matrix.shard }}) + runs-on: ${{ inputs.os }} + + steps: + - 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=${{ matrix.shard }} From 491513b132be6671faf8c1a46fbbdda6fe0e6a41 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 13 May 2022 10:13:09 +0200 Subject: [PATCH 7/7] oops --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 93bf1e30ffa6..0133043a6624 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,7 +39,7 @@ jobs: fail-fast: false matrix: shard: ['1/4', '2/4', '3/4', '4/4'] - name: Node LTS on ${{ matrix.os }} using jest-jasmine2 (${{ matrix.shard }}) + name: Node LTS on ${{ inputs.os }} using jest-jasmine2 (${{ matrix.shard }}) runs-on: ${{ inputs.os }} steps: