Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit aaa48ca

Browse files
authored
Report test coverage to codecov.io (#90)
* Report test coverage to codecov.io * add artifact upload + sdk-report-runner trigger
1 parent 741a2c6 commit aaa48ca

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,43 @@ jobs:
2323
run: swift build
2424

2525
- name: Run tests
26-
run: swift test
26+
run: swift test --enable-code-coverage
27+
28+
- name: Convert the coverage data
29+
run: llvm-cov export -format="lcov" .build/x86_64-apple-macosx/debug/TbdexPackageTests.xctest/Contents/MacOS/TbdexPackageTests -instr-profile .build/x86_64-apple-macosx/debug/codecov/default.profdata > info.lcov
30+
31+
- name: Upload coverage reports to Codecov
32+
uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 # 4.1.1
33+
with:
34+
token: ${{ secrets.CODECOV_TOKEN }}
35+
slug: TBD54566975/web5-swift
36+
files: info.lcov
37+
38+
- uses: actions/upload-artifact@v3
39+
with:
40+
name: test-results
41+
path: |
42+
tests.xml
43+
44+
- name: Generate an access token to trigger downstream repo
45+
uses: actions/create-github-app-token@2986852ad836768dfea7781f31828eb3e17990fa # v1.6.2
46+
id: generate_token
47+
if: github.ref == 'refs/heads/main'
48+
with:
49+
app-id: ${{ secrets.CICD_ROBOT_GITHUB_APP_ID }}
50+
private-key: ${{ secrets.CICD_ROBOT_GITHUB_APP_PRIVATE_KEY }}
51+
owner: TBD54566975
52+
repositories: sdk-report-runner
53+
54+
- name: Trigger sdk-report-runner report build
55+
if: github.ref == 'refs/heads/main'
56+
run: |
57+
curl -L \
58+
-H "Authorization: Bearer ${APP_TOKEN}" \
59+
-H "X-GitHub-Api-Version: 2022-11-28" \
60+
-H "Content-Type: application/json" \
61+
--fail \
62+
--data '{"ref": "main"}' \
63+
https://api.github.com/repos/TBD54566975/sdk-report-runner/actions/workflows/build-report.yaml/dispatches
64+
env:
65+
APP_TOKEN: ${{ steps.generate_token.outputs.token }}

0 commit comments

Comments
 (0)