-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): streamline CI runs (#12840)
- Loading branch information
Showing
3 changed files
with
120 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Prepare CI cache | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
os: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
prepare-yarn-cache: | ||
name: Prepare yarn cache for ${{ inputs.os }} | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
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 ${{ 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: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
shard: ['1/4', '2/4', '3/4', '4/4'] | ||
name: Node LTS on ${{ inputs.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 }} |