Skip to content

Commit b448d85

Browse files
authored
Overhaul code coverage pipeline and Codecov configuration (#207)
1 parent 1a57428 commit b448d85

4 files changed

Lines changed: 44 additions & 9 deletions

File tree

‎.codecov.yml‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
codecov:
22
require_ci_to_pass: yes
3+
34
coverage:
45
status:
56
project:
67
default:
7-
target: auto
8-
threshold: 5
9-
patch: off
10-
# default:
11-
# target: auto
12-
# threshold: 5
8+
target: auto
9+
threshold: 1%
10+
patch:
11+
default:
12+
target: 70%
13+
threshold: 0%
14+
15+
flag_management:
16+
default_rules:
17+
carryforward: true
18+
19+
comment:
20+
layout: "header, diff, flags, files"
21+
behavior: default
22+
require_changes: false
23+
1324
ignore:
14-
- Tests
25+
- Tests

‎.github/workflows/ios.yml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,21 @@ jobs:
7171
-skipPackagePluginValidation \
7272
-skipMacroValidation
7373
# OTHER_SWIFT_FLAGS="-warnings-as-errors" Conflicting options '-warnings-as-errors' and '-suppress-warnings'
74+
- name: Generate iOS coverage report
75+
run: |
76+
# Extract profdata and binary from xcodebuild's derived data to generate
77+
# llvm-cov text output (same format as macOS/Ubuntu workflows).
78+
# Note: swift_project param in codecov-action doesn't auto-discover xcodebuild coverage,
79+
# and xcrun xccov JSON format isn't recognized by Codecov's parser.
80+
PROFDATA=$(find .build-test-debug -name "Coverage.profdata" -type f | head -1)
81+
XCTEST=$(find .build-test-debug -name "*.xctest" -type d | head -1)
82+
if [ -n "$PROFDATA" ] && [ -n "$XCTEST" ]; then
83+
BINARY="$XCTEST/$(basename "$XCTEST" .xctest)"
84+
xcrun llvm-cov show -instr-profile="$PROFDATA" "$BINARY" > coverage.txt
85+
fi
86+
- name: Upload coverage to Codecov
87+
uses: codecov/codecov-action@v5
88+
with:
89+
token: ${{ secrets.CODECOV_TOKEN }}
90+
flags: ios
91+
verbose: true

‎.github/workflows/macos.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ jobs:
6262
-c release \
6363
--enable-code-coverage \
6464
--build-path .build-test-release
65-
- uses: codecov/codecov-action@v5
65+
- name: Upload coverage to Codecov
66+
uses: codecov/codecov-action@v5
6667
with:
6768
token: ${{ secrets.CODECOV_TOKEN }}
69+
flags: macos
6870
verbose: true

‎.github/workflows/ubuntu.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ jobs:
4949
swift test \
5050
-c release \
5151
--build-path .build-test-release
52-
- uses: codecov/codecov-action@v3
52+
- name: Install Codecov dependencies
53+
run: apt-get update && apt-get install -y curl gpg
54+
- name: Upload coverage to Codecov
55+
uses: codecov/codecov-action@v5
5356
with:
5457
token: ${{ secrets.CODECOV_TOKEN }}
58+
flags: ubuntu
5559
verbose: true

0 commit comments

Comments
 (0)