7
paths-ignore:
8
- 'compiler/**'
9
10
+env:
11
+ # Number of workers (one per shard) to spawn
12
+ SHARD_COUNT: 5
13
+
14
jobs:
15
+ # Define the various test parameters and parallelism for this workflow
16
+ build_test_params:
17
+ name: Build test params
18
+ runs-on: ubuntu-latest
19
+ outputs:
20
+ params: ${{ steps.define-params.outputs.result }}
21
+ shard_id: ${{ steps.define-shards.outputs.result }}
22
+ steps:
23
+ - uses: actions/github-script@v7
24
+ id: define-shards
25
+ with:
26
+ script: |
27
+ function range(from, to) {
28
+ const arr = [];
29
+ for (let n = from; n <= to; n++) {
30
+ arr.push(n);
31
+ }
32
+ return arr;
33
+ }
34
+ return range(1, process.env.SHARD_COUNT);
35
+ - uses: actions/github-script@v7
36
+ id: define-params
37
+ with:
38
+ script: |
39
+ return [
40
+ "-r=stable --env=development",
41
+ "-r=stable --env=production",
42
+ "-r=experimental --env=development",
43
+ "-r=experimental --env=production",
44
+ "-r=www-classic --env=development --variant=false",
45
+ "-r=www-classic --env=production --variant=false",
46
+ "-r=www-classic --env=development --variant=true",
47
+ "-r=www-classic --env=production --variant=true",
48
+ "-r=www-modern --env=development --variant=false",
49
+ "-r=www-modern --env=production --variant=false",
50
+ "-r=www-modern --env=development --variant=true",
51
+ "-r=www-modern --env=production --variant=true",
52
+ "-r=xplat --env=development --variant=false",
53
+ "-r=xplat --env=development --variant=true",
54
+ "-r=xplat --env=production --variant=false",
55
+ "-r=xplat --env=production --variant=true",
56
+ // TODO: Test more persistent configurations?
57
+ "-r=stable --env=development --persistent",
58
+ "-r=experimental --env=development --persistent"
59
+ ];
60
+
61
+ # Spawn a job for each shard for a given set of test params
62
test:
12
- name: yarn test
63
+ name: yarn test ${{ matrix.params }} (Shard ${{ matrix.shard_id }})
64
runs-on: ubuntu-latest
14
- continue-on-error: true
65
+ needs: build_test_params
66
strategy:
67
matrix:
17
- # Intentionally passing these as strings instead of creating a
18
- # separate parameter per CLI argument, since it's easier to
19
- # control/see which combinations we want to run.
20
- params: [
21
- "-r=stable --env=development",
22
- "-r=stable --env=production",
23
- "-r=experimental --env=development",
24
- "-r=experimental --env=production",
25
- "-r=www-classic --env=development --variant=false",
26
- "-r=www-classic --env=production --variant=false",
27
- "-r=www-classic --env=development --variant=true",
28
- "-r=www-classic --env=production --variant=true",
29
- "-r=www-modern --env=development --variant=false",
30
- "-r=www-modern --env=production --variant=false",
31
- "-r=www-modern --env=development --variant=true",
32
- "-r=www-modern --env=production --variant=true",
33
- "-r=xplat --env=development --variant=false",
34
- "-r=xplat --env=development --variant=true",
35
- "-r=xplat --env=production --variant=false",
36
- "-r=xplat --env=production --variant=true",
37
- # TODO: Test more persistent configurations?
38
- "-r=stable --env=development --persistent",
39
- "-r=experimental --env=development --persistent"
40
- ]
68
+ params: ${{ fromJSON(needs.build_test_params.outputs.params) }}
69
+ shard_id: ${{ fromJSON(needs.build_test_params.outputs.shard_id) }}
70
+ continue-on-error: true
71
steps:
72
- uses: actions/checkout@v4
73
- uses: actions/setup-node@v4
82
path: "**/node_modules"
83
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
84
- run: yarn install --frozen-lockfile
55
- - run: yarn test ${{ matrix.params }} --ci
85
+ - run: yarn test ${{ matrix.params }} --ci=github --shard=${{ matrix.shard_id }}/${{ env.SHARD_COUNT }}