Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 01a6812

Browse files
committedMar 22, 2023
ci: coverage
1 parent cce6c58 commit 01a6812

File tree

3 files changed

+90
-12
lines changed

3 files changed

+90
-12
lines changed
 

‎.github/workflows/test-all-packages.yml

+53-12
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
DATADOG_SITE: us3.datadoghq.com
1717
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
1818
TEST_COLLECT: 'tee -a _testoutput.txt'
19-
19+
NODE_V8_COVERAGE: coverage
2020
# this is required, since explicitly setting bash as shell enables pipefail, which is not
2121
# on by default. This is required to fail correctly when teeing output to a file to collect
2222
# test instrumentation
@@ -146,9 +146,13 @@ jobs:
146146
- name: Report tests
147147
if: success() || failure()
148148
run: |
149+
./scripts/ci-collect-testruns.sh
149150
if [ "$DATADOG_API_KEY" != "" ]; then
150-
./scripts/ci-collect-testruns.sh && npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
151+
npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
151152
fi
153+
- name: Upload coverage reports to Codecov
154+
if: success() || failure()
155+
uses: codecov/codecov-action@v3
152156

153157
test-quick2:
154158
# BEGIN-TEST-BOILERPLATE
@@ -213,9 +217,13 @@ jobs:
213217
- name: Report tests
214218
if: success() || failure()
215219
run: |
220+
./scripts/ci-collect-testruns.sh
216221
if [ "$DATADOG_API_KEY" != "" ]; then
217-
./scripts/ci-collect-testruns.sh && npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
222+
npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
218223
fi
224+
- name: Upload coverage reports to Codecov
225+
if: success() || failure()
226+
uses: codecov/codecov-action@v3
219227

220228
##############
221229
# Long-running tests are executed individually.
@@ -245,9 +253,13 @@ jobs:
245253
- name: Report tests
246254
if: success() || failure()
247255
run: |
256+
./scripts/ci-collect-testruns.sh
248257
if [ "$DATADOG_API_KEY" != "" ]; then
249-
./scripts/ci-collect-testruns.sh && npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
258+
npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
250259
fi
260+
- name: Upload coverage reports to Codecov
261+
if: success() || failure()
262+
uses: codecov/codecov-action@v3
251263

252264
test-cosmic-swingset:
253265
# BEGIN-TEST-BOILERPLATE
@@ -277,9 +289,13 @@ jobs:
277289
- name: Report tests
278290
if: success() || failure()
279291
run: |
292+
./scripts/ci-collect-testruns.sh
280293
if [ "$DATADOG_API_KEY" != "" ]; then
281-
./scripts/ci-collect-testruns.sh && npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
294+
npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
282295
fi
296+
- name: Upload coverage reports to Codecov
297+
if: success() || failure()
298+
uses: codecov/codecov-action@v3
283299

284300
# The test-swingset* tests are split by alphabetical test name.
285301
test-swingset:
@@ -307,9 +323,13 @@ jobs:
307323
- name: Report tests
308324
if: success() || failure()
309325
run: |
326+
./scripts/ci-collect-testruns.sh
310327
if [ "$DATADOG_API_KEY" != "" ]; then
311-
./scripts/ci-collect-testruns.sh && npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
328+
npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
312329
fi
330+
- name: Upload coverage reports to Codecov
331+
if: success() || failure()
332+
uses: codecov/codecov-action@v3
313333

314334
test-swingset2:
315335
# BEGIN-TEST-BOILERPLATE
@@ -344,9 +364,13 @@ jobs:
344364
- name: Report tests
345365
if: success() || failure()
346366
run: |
367+
./scripts/ci-collect-testruns.sh
347368
if [ "$DATADOG_API_KEY" != "" ]; then
348-
./scripts/ci-collect-testruns.sh && npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
369+
npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
349370
fi
371+
- name: Upload coverage reports to Codecov
372+
if: success() || failure()
373+
uses: codecov/codecov-action@v3
350374

351375
test-swingset3:
352376
# BEGIN-TEST-BOILERPLATE
@@ -372,9 +396,13 @@ jobs:
372396
- name: Report tests
373397
if: success() || failure()
374398
run: |
399+
./scripts/ci-collect-testruns.sh
375400
if [ "$DATADOG_API_KEY" != "" ]; then
376-
./scripts/ci-collect-testruns.sh && npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
401+
npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
377402
fi
403+
- name: Upload coverage reports to Codecov
404+
if: success() || failure()
405+
uses: codecov/codecov-action@v3
378406

379407
test-swingset4:
380408
# BEGIN-TEST-BOILERPLATE
@@ -401,9 +429,13 @@ jobs:
401429
- name: Report tests
402430
if: success() || failure()
403431
run: |
432+
./scripts/ci-collect-testruns.sh
404433
if [ "$DATADOG_API_KEY" != "" ]; then
405-
./scripts/ci-collect-testruns.sh && npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
434+
npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
406435
fi
436+
- name: Upload coverage reports to Codecov
437+
if: success() || failure()
438+
uses: codecov/codecov-action@v3
407439

408440
test-zoe-unit:
409441
# BEGIN-TEST-BOILERPLATE
@@ -432,9 +464,13 @@ jobs:
432464
- name: Report tests
433465
if: success() || failure()
434466
run: |
467+
./scripts/ci-collect-testruns.sh
435468
if [ "$DATADOG_API_KEY" != "" ]; then
436-
./scripts/ci-collect-testruns.sh && npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
469+
npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
437470
fi
471+
- name: Upload coverage reports to Codecov
472+
if: success() || failure()
473+
uses: codecov/codecov-action@v3
438474

439475
test-zoe-swingset:
440476
# BEGIN-TEST-BOILERPLATE
@@ -463,9 +499,13 @@ jobs:
463499
- name: Report tests
464500
if: success() || failure()
465501
run: |
502+
./scripts/ci-collect-testruns.sh
466503
if [ "$DATADOG_API_KEY" != "" ]; then
467-
./scripts/ci-collect-testruns.sh && npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
504+
npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
468505
fi
506+
- name: Upload coverage reports to Codecov
507+
if: success() || failure()
508+
uses: codecov/codecov-action@v3
469509

470510
test-docker-build:
471511
runs-on: ubuntu-latest
@@ -476,6 +516,7 @@ jobs:
476516
- name: Report tests
477517
if: success() || failure()
478518
run: |
519+
./scripts/ci-collect-testruns.sh
479520
if [ "$DATADOG_API_KEY" != "" ]; then
480-
./scripts/ci-collect-testruns.sh && npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
521+
npx @datadog/datadog-ci junit upload --service agoric-sdk ./packages/*/junit.xml
481522
fi

‎codecov.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
codecov:
2+
require_ci_to_pass: false
3+
comment:
4+
behavior: default
5+
layout: reach,diff,flags,tree,reach
6+
show_carryforward_flags: false
7+
coverage:
8+
precision: 2
9+
range:
10+
- 60.0
11+
- 80.0
12+
round: down
13+
status:
14+
changes: false
15+
default_rules:
16+
flag_coverage_not_uploaded_behavior: include
17+
patch: true
18+
project: true
19+
github_checks:
20+
annotations: true
21+
parsers:
22+
javascript:
23+
enable_partials: yes

‎scripts/ci-collect-testruns.sh

+14
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,17 @@ do
1212
$SCRIPT_DIR/ava-etap-to-junit.mjs $pkg > $junit
1313
fi
1414
done
15+
16+
for cov in ./packages/**/coverage
17+
do
18+
# skip if unable to expand if there are no test files
19+
if [[ $pkg != "./packages/**/coverage" ]]; then
20+
echo "processing $pkg"
21+
(cd "$cov/../" && yarn run c8 report --reporter=lcov && find coverage -name "*.json" -delete)
22+
fi
23+
done
24+
25+
# Handle and clean root directory as well
26+
if [[ -d "coverage" ]]; then
27+
yarn run c8 report --reporter=lcov --temp-directory=/tmp/ && find coverage -name "*.json" -delete
28+
fi

0 commit comments

Comments
 (0)
Please sign in to comment.