-
-
Notifications
You must be signed in to change notification settings - Fork 248
56 lines (53 loc) · 1.78 KB
/
coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
name: "Report Coverage"
on:
- push
- pull_request
jobs:
build:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-14]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 64
- name: Cleanup /usr/local
run: |
sudo mkdir /opt/local.old
sudo mv /usr/local/* /opt/local.old
- name: Select Xcode version
run: |
sudo xcode-select --switch /Applications/Xcode_15.3.app/Contents/Developer
- name: Configure MacPorts Base
run: |
set -eu
./configure CFLAGS="-fprofile-instr-generate -fcoverage-mapping" LDFLAGS="-fprofile-instr-generate"
- name: Build MacPorts Base
run: |
set -eu
make -j$(sysctl -n hw.activecpu)
- name: Install MacPorts Base
run: |
set -eu
sudo make install
- name: Test MacPorts Base
run: |
set -eu
LLVM_PROFILE_FILE="$PWD/cov-%p.profraw" make test
- name: Report Coverage
run: |
set -eu
xcrun llvm-profdata merge --sparse --output=cov.profdata cov-*.profraw
# tracelib cannot be profiled
OBJ_FILES="$(find src -type f "(" -name "*.dylib" -o -name "*.a" ")" | grep -Fv darwintracelib1.0 | sed 's/^/--arch=arm64 --object=/')"
xcrun llvm-cov show --format=html --output-dir=covreport --ignore-filename-regex=vendor/ --instr-profile=cov.profdata $OBJ_FILES
xcrun llvm-cov report --ignore-filename-regex=vendor/ --instr-profile=cov.profdata $OBJ_FILES
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: covreport/