Skip to content

Commit 06ef6ac

Browse files
CI: Measure code coverage and deploy results to GitHub Pages
1 parent 0a8161e commit 06ef6ac

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

.github/workflows/main.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ jobs:
2727
development-toolchain-tag: swift-DEVELOPMENT-SNAPSHOT-2024-07-08-a
2828
wasi-swift-sdk-download: "https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-07-09-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-07-09-a-wasm32-unknown-wasi.artifactbundle.zip"
2929
wasi-swift-sdk-id: DEVELOPMENT-SNAPSHOT-2024-07-09-a-wasm32-unknown-wasi
30-
test-args: "--sanitize address"
30+
test-args: "--sanitize address --enable-code-coverage"
31+
build-dev-dashboard: true
3132

3233
runs-on: ${{ matrix.os }}
3334
name: "build-macos (${{ matrix.xcode }})"
@@ -60,6 +61,25 @@ jobs:
6061
- run: ./Vendor/checkout-dependency
6162
- run: swift test ${{ matrix.test-args }}
6263

64+
- if: matrix.build-dev-dashboard
65+
run: ./CI/build-dev-dashboard.sh
66+
- if: matrix.build-dev-dashboard
67+
id: deployment
68+
uses: actions/upload-pages-artifact@v3
69+
with:
70+
path: .build/html
71+
72+
deploy-dev-dashboard:
73+
environment:
74+
name: github-pages
75+
url: ${{ steps.deployment.outputs.page_url }}
76+
runs-on: ubuntu-latest
77+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
78+
needs: build-macos
79+
steps:
80+
- id: deployment
81+
uses: actions/deploy-pages@v4
82+
6383
build-xcode:
6484
runs-on: macos-15
6585
steps:

CI/build-dev-dashboard.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
build_coverage_html() {
4+
llvm-cov show --format=html .build/debug/WasmKitPackageTests.xctest/Contents/MacOS/WasmKitPackageTests --instr-profile .build/debug/codecov/default.profdata -o "$1" --sources $(find Sources/ -type f)
5+
}
6+
7+
mkdir -p ./.build/html
8+
build_coverage_html ./.build/html/coverage

0 commit comments

Comments
 (0)