@@ -18,50 +18,74 @@ concurrency:
1818 cancel-in-progress : ${{ github.ref != 'refs/heads/master' }}
1919
2020env :
21- NODE_VERSION : 18
2221 CACHE_KEY : " ${{ github.ref }}-${{ github.run_id }}-${{ github.run_attempt }}"
2322
2423jobs :
24+ configure :
25+ name : Configure Build Matrix
26+ runs-on : ubuntu-latest
27+
28+ outputs :
29+ matrix : ${{ steps.set-matrix.outputs.matrix }}
30+
31+ steps :
32+ - uses : actions/checkout@v4
33+ with :
34+ ref : ${{ github.event.pull_request.head.sha || github.ref }}
35+
36+ - id : set-matrix
37+ run : echo "matrix=$(jq -c . < ./.github/workflows/matrix.json)" >> $GITHUB_OUTPUT
38+
2539 build :
40+ needs : configure
41+
2642 name : Build Package
2743 runs-on : ubuntu-latest
2844
45+ strategy :
46+ matrix : ${{ fromJson(needs.configure.outputs.matrix) }}
47+
2948 steps :
3049 - name : Checkout code
3150 uses : actions/checkout@v4
3251
3352 - uses : ./.github/actions/build
3453 with :
35- node : ${{ env.NODE_VERSION }}
54+ node : ${{ matrix.node }}
3655
3756 - name : Save build artifacts
3857 uses : actions/cache/save@v3
3958 with :
4059 path : .
41- key : ${{ env.CACHE_KEY }}
60+ key : ${{ matrix.node }}-${{ env.CACHE_KEY }}
4261
4362 unit :
44- needs : build # Require build to complete before running tests
63+ needs : [configure, build] # Require build to complete before running tests
4564
4665 name : Run Unit Tests
4766 runs-on : ubuntu-latest
4867
68+ strategy :
69+ matrix : ${{ fromJson(needs.configure.outputs.matrix) }}
70+
4971 steps :
5072 - uses : actions/checkout@v4
5173
5274 - uses : actions/setup-node@v3
5375 with :
54- node-version : ${{ env.NODE_VERSION }}
76+ node-version : ${{ matrix.node }}
5577 cache : npm
5678
5779 - uses : actions/cache/restore@v3
5880 with :
5981 path : .
60- key : ${{ env.CACHE_KEY }}
82+ key : ${{ matrix.node }}-${{ env.CACHE_KEY }}
6183
6284 - run : npm run test:ci
6385
64- -
uses :
codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # [email protected] 86+ # only upload coverage on one node version
87+ - if : matrix.node == 18
88+ uses :
codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # [email protected] 6589
6690 lint :
6791 needs : build # Require build to complete before running tests
@@ -74,12 +98,12 @@ jobs:
7498
7599 - uses : actions/setup-node@v3
76100 with :
77- node-version : ${{ env.NODE_VERSION }}
101+ node-version : ${{ matrix.node }}
78102 cache : npm
79103
80104 - uses : actions/cache/restore@v3
81105 with :
82106 path : .
83- key : ${{ env.CACHE_KEY }}
107+ key : ${{ matrix.node }}-${{ env.CACHE_KEY }}
84108
85109 - run : npm run lint
0 commit comments