Skip to content

Commit 7ad9a48

Browse files
committed
build: publish merged coverage report
1 parent 84a206d commit 7ad9a48

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ jobs:
161161
run: |
162162
if npm -ps ls nyc | grep -q nyc; then
163163
npm run test-ci
164+
cp coverage/lcov.info "coverage/${{ matrix.name }}.lcov"
164165
else
165166
npm test
166167
fi
@@ -170,19 +171,43 @@ jobs:
170171
run: npm run lint
171172

172173
- name: Collect code coverage
173-
uses: coverallsapp/github-action@master
174+
if: steps.list_env.outputs.nyc != ''
175+
run: |
176+
if [[ -d ./coverage ]]; then
177+
mv ./coverage "./${{ matrix.name }}"
178+
mkdir ./coverage
179+
mv "./${{ matrix.name }}" "./coverage/${{ matrix.name }}"
180+
fi
181+
182+
- name: Upload code coverage
183+
uses: actions/upload-artifact@v2
174184
if: steps.list_env.outputs.nyc != ''
175185
with:
176-
github-token: ${{ secrets.GITHUB_TOKEN }}
177-
flag-name: run-${{ matrix.test_number }}
178-
parallel: true
186+
name: coverage
187+
path: ./coverage
188+
retention-days: 1
179189

180190
coverage:
181191
needs: test
182192
runs-on: ubuntu-latest
183193
steps:
184-
- name: Uploade code coverage
194+
- uses: actions/checkout@v2
195+
196+
- name: Install lcov
197+
shell: bash
198+
run: sudo apt-get -y install lcov
199+
200+
- name: Collect coverage reports
201+
uses: actions/download-artifact@v2
202+
with:
203+
name: coverage
204+
path: ./coverage
205+
206+
- name: Merge coverage reports
207+
shell: bash
208+
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./coverage/lcov.info
209+
210+
- name: Upload coverage report
185211
uses: coverallsapp/github-action@master
186212
with:
187213
github-token: ${{ secrets.github_token }}
188-
parallel-finished: true

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"bench": "node benchmark/index.js",
3939
"lint": "eslint --plugin markdown --ext js,md .",
4040
"test": "mocha --reporter spec --bail test/",
41-
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
41+
"test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
4242
"test-cov": "nyc --reporter=html --reporter=text npm test"
4343
}
4444
}

0 commit comments

Comments
 (0)