Skip to content

Commit 96c405b

Browse files
leogdionclaude
andcommitted
Use conditional code coverage uploads in CI workflow
- Add contains-code-coverage output check to all build jobs - Only upload coverage when swift-build indicates it's available - Remove invalid swift_project parameter from Windows Codecov upload - Update build success report with latest CI run results (all Android/Windows builds passing) This prevents CI failures on platforms where code coverage isn't supported (WASM) or available, and fixes the Codecov upload errors. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 8a50a33 commit 96c405b

File tree

2 files changed

+289
-45
lines changed

2 files changed

+289
-45
lines changed

.github/workflows/BushelKit.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,26 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v4
2323
- uses: brightdigit/swift-build@v1.5.0-beta.2
24+
id: swift-build
2425
- uses: sersoft-gmbh/swift-coverage-action@v4
26+
if: steps.swift-build.outputs.contains-code-coverage == 'true'
2527
id: coverage-files
26-
with:
28+
with:
2729
fail-on-empty-output: true
2830
- name: Set coverage flag
31+
if: steps.swift-build.outputs.contains-code-coverage == 'true'
2932
id: set-flag
3033
run: echo "CODECOV_FLAGS=${MATRIX_IMAGE//\//-}" | sed 's/:/-/g' >> $GITHUB_ENV
3134
env:
3235
MATRIX_IMAGE: ${{ matrix.image }}
3336
- name: Upload coverage to Codecov
34-
uses: codecov/codecov-action@v4
37+
if: steps.swift-build.outputs.contains-code-coverage == 'true'
38+
uses: codecov/codecov-action@v4
3539
with:
3640
fail_ci_if_error: true
3741
flags: ${{ env.CODECOV_FLAGS }}
38-
verbose: true
39-
token: ${{ secrets.CODECOV_TOKEN }}
42+
verbose: true
43+
token: ${{ secrets.CODECOV_TOKEN }}
4044
files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }}
4145
build-windows:
4246
name: Build on Windows
@@ -54,18 +58,19 @@ jobs:
5458
steps:
5559
- uses: actions/checkout@v4
5660
- uses: brightdigit/swift-build@v1.5.0-beta.2
61+
id: swift-build
5762
with:
5863
windows-swift-version: ${{ matrix.swift-version }}
5964
windows-swift-build: ${{ matrix.swift-build }}
6065
- name: Upload coverage to Codecov
61-
uses: codecov/codecov-action@v4
66+
if: steps.swift-build.outputs.contains-code-coverage == 'true'
67+
uses: codecov/codecov-action@v4
6268
with:
6369
fail_ci_if_error: true
6470
flags: swift-${{ matrix.swift-version }},windows
6571
verbose: true
6672
token: ${{ secrets.CODECOV_TOKEN }}
67-
os: windows
68-
swift_project: BushelKit
73+
os: windows
6974

7075
build-android:
7176
name: Build on Android
@@ -79,11 +84,13 @@ jobs:
7984
steps:
8085
- uses: actions/checkout@v4
8186
- uses: brightdigit/swift-build@v1.5.0-beta.2
87+
id: swift-build
8288
with:
8389
type: android
8490
android-swift-version: ${{ matrix.swift-version }}
8591
android-api-level: ${{ matrix.api-level }}
8692
- name: Upload coverage to Codecov
93+
if: steps.swift-build.outputs.contains-code-coverage == 'true'
8794
uses: codecov/codecov-action@v4
8895
with:
8996
fail_ci_if_error: true
@@ -103,9 +110,11 @@ jobs:
103110
steps:
104111
- uses: actions/checkout@v4
105112
- uses: brightdigit/swift-build@v1.5.0-beta.2
113+
id: swift-build
106114
with:
107115
type: ${{ matrix.wasm-type }}
108116
- name: Upload coverage to Codecov
117+
if: steps.swift-build.outputs.contains-code-coverage == 'true'
109118
uses: codecov/codecov-action@v4
110119
with:
111120
fail_ci_if_error: true
@@ -184,6 +193,7 @@ jobs:
184193
steps:
185194
- uses: actions/checkout@v4
186195
- name: Build and Test
196+
id: swift-build
187197
uses: brightdigit/swift-build@v1.5.0-beta.2
188198
with:
189199
scheme: ${{ env.PACKAGE_NAME }}-Package
@@ -192,12 +202,14 @@ jobs:
192202
deviceName: ${{ matrix.deviceName }}
193203
osVersion: ${{ matrix.osVersion }}
194204
download-platform: ${{ matrix.download-platform || false }}
195-
205+
196206
# Common Coverage Steps
197207
- name: Process Coverage
208+
if: steps.swift-build.outputs.contains-code-coverage == 'true'
198209
uses: sersoft-gmbh/swift-coverage-action@v4
199-
210+
200211
- name: Upload Coverage
212+
if: steps.swift-build.outputs.contains-code-coverage == 'true'
201213
uses: codecov/codecov-action@v4
202214
with:
203215
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)