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

Commit

Permalink
Report test coverage to codecov.io (#90)
Browse files Browse the repository at this point in the history
* Report test coverage to codecov.io

* add artifact upload + sdk-report-runner trigger
  • Loading branch information
finn-block authored Apr 4, 2024
1 parent 741a2c6 commit aaa48ca
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,43 @@ jobs:
run: swift build

- name: Run tests
run: swift test
run: swift test --enable-code-coverage

- name: Convert the coverage data
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

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 # 4.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: TBD54566975/web5-swift
files: info.lcov

- uses: actions/upload-artifact@v3
with:
name: test-results
path: |
tests.xml
- name: Generate an access token to trigger downstream repo
uses: actions/create-github-app-token@2986852ad836768dfea7781f31828eb3e17990fa # v1.6.2
id: generate_token
if: github.ref == 'refs/heads/main'
with:
app-id: ${{ secrets.CICD_ROBOT_GITHUB_APP_ID }}
private-key: ${{ secrets.CICD_ROBOT_GITHUB_APP_PRIVATE_KEY }}
owner: TBD54566975
repositories: sdk-report-runner

- name: Trigger sdk-report-runner report build
if: github.ref == 'refs/heads/main'
run: |
curl -L \
-H "Authorization: Bearer ${APP_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/json" \
--fail \
--data '{"ref": "main"}' \
https://api.github.com/repos/TBD54566975/sdk-report-runner/actions/workflows/build-report.yaml/dispatches
env:
APP_TOKEN: ${{ steps.generate_token.outputs.token }}

0 comments on commit aaa48ca

Please sign in to comment.