5454 node_version : " ${{ inputs.nodejs_version }}"
5555 skip_restore : true
5656
57+ discover-workspaces :
58+ runs-on : ubuntu-latest
59+ outputs :
60+ matrix : ${{ steps.get-workspaces.outputs.matrix }}
61+ steps :
62+ - name : " Checkout code"
63+ 64+ - name : " Get workspaces"
65+ id : " get-workspaces"
66+ run : |
67+ echo "matrix=$(jq '.workspaces' package.json)" >> "$GITHUB_OUTPUT"
68+
5769 check-generated-dependencies :
5870 name : " Check generated dependencies"
5971 runs-on : ubuntu-latest
7587 name : " Unit tests"
7688 runs-on : ubuntu-latest
7789 timeout-minutes : 5
78- needs : [install-dependencies]
90+ needs : [install-dependencies, discover-workspaces]
91+ strategy :
92+ matrix : ${{ fromJSON(needs.discover-workspaces.outputs.matrix) }}
7993 steps :
8094 - name : " Checkout code"
8195@@ -88,21 +102,51 @@ jobs:
88102 npm run generate-dependencies --workspaces --if-present
89103 - name : " Run unit test suite"
90104 run : |
91- make test-unit
92- - name : " Save the result of fast test suite"
105+ WORKSPACE=${{ matrix.workspace }} make test-unit
106+ - name : " Save the result of test suite"
93107 uses : actions/upload-artifact@v4
94108 with :
95- name : unit-tests
96- path : " ** /.reports/unit"
109+ name : unit-tests-${{ matrix.workspace }}
110+ path : " ${{ matrix.workspace }} /.reports/unit"
97111 include-hidden-files : true
98112 if : always()
99113 - name : " Save the result of code coverage"
100114 uses : actions/upload-artifact@v4
101115 with :
102- name : code-coverage-report
103- path : " . reports/lcov.info"
116+ name : code-coverage-${{ matrix.workspace }}
117+ path : " ${{ matrix.workspace }}/. reports/unit/coverage /lcov.info"
104118 if : always()
105119
120+ merge-coverage :
121+ name : " Merge coverage"
122+ runs-on : ubuntu-latest
123+ needs : [test-unit]
124+ steps :
125+ - uses : actions/checkout@v5
126+
127+ - name : Download coverage artifacts
128+ uses : actions/download-artifact@v4
129+ with :
130+ pattern : code-coverage-*
131+ merge-multiple : false
132+ path : ./_cov_parts
133+
134+ - name : Merge LCOV files
135+ run : |
136+ set -euo pipefail
137+ mkdir -p .reports
138+ npx --yes lcov-result-merger \
139+ "./_cov_parts/**/lcov.info" \
140+ ".reports/lcov.info" \
141+ --ignore "node_modules" \
142+ --prepend-source-files
143+
144+ - name : Upload merged LCOV
145+ uses : actions/upload-artifact@v4
146+ with :
147+ name : code-coverage-merged
148+ path : .reports/lcov.info
149+
106150 test-lint :
107151 name : " Linting"
108152 runs-on : ubuntu-latest
@@ -141,21 +185,6 @@ jobs:
141185 run : |
142186 make test-typecheck
143187
144- test-coverage :
145- name : " Test coverage"
146- needs : [test-unit]
147- runs-on : ubuntu-latest
148- timeout-minutes : 5
149- steps :
150- - name : " Checkout code"
151- 152- - name : " Run test coverage check"
153- run : |
154- make test-coverage
155- - name : " Save the coverage check result"
156- run : |
157- echo "Nothing to save"
158-
159188 perform-static-analysis :
160189 name : " Perform static analysis"
161190 needs : [test-unit]
0 commit comments