Skip to content

Add code coverage#8

Merged
colemancda merged 6 commits into
masterfrom
feature/code-coverage
Jul 18, 2026
Merged

Add code coverage#8
colemancda merged 6 commits into
masterfrom
feature/code-coverage

Conversation

@colemancda

Copy link
Copy Markdown
Member

Adds code coverage measurement, reporting, and CI enforcement for the package.

Changes

  • Scripts/coverage.sh — runs swift test --enable-code-coverage, exports an LCOV report (coverage.lcov) and a Cobertura XML report (coverage.xml) scoped to the package's own Sources/, and fails if line coverage drops below a threshold (default passed via CI).
  • .github/workflows/swift.yml — new Code Coverage job on macOS that runs the gate at 70%, publishes the Cobertura report to GitHub Code Quality for per-PR coverage display, and uploads both reports as build artifacts.

Baseline

Current line coverage is 73.19% (980/1339 lines). The CI threshold is set at 70% so it starts green, with room to ratchet up over time.

Coverage File
0.00% Sources/Data.swift
50.00% Sources/Integer.swift
73.63% Sources/Decoder.swift
76.40% Sources/Encoder.swift
82.61% Sources/CodingKey.swift
86.96% Sources/Item.swift
91.89% Sources/DataConvertible.swift
100.00% Sources/Format.swift, Sources/TypeCode.swift

Raise the bar later by bumping the threshold argument (e.g. Scripts/coverage.sh 80).

Replace the unmaintained slashmo/install-swift action, which pulled in the
deprecated actions/cache@v2 and caused the macOS jobs to hard-fail at "Set up
job". macOS now uses the runner's preinstalled Swift 6.3.3 toolchain and Linux
runs in the official swift:6.3.3 container. Bump actions/checkout to v4.
Follow the junkbot-swift CI layout: macOS on macos-26 and Linux across a
swift:latest + nightly container matrix, each building and testing debug and
release with actions/checkout@v4. Remove the Buildroot and Linux armv7
cross-compile workflows, which were failing.
Windows builds and runs the unit tests via compnerd/gha-setup-swift on
windows-latest. Android cross-compiles and runs the unit tests on an x86_64
emulator via skiptools/swift-android-action, plus a separate armv7
cross-compile check using the swift.org Android SDK.
The Swift Android SDK installs as a single multi-arch bundle, so the armv7
slice is selected by target triple, not a distinct `swift sdk list` id. Resolve
the exact armv7 triple from the installed SDK metadata and pass it to
--swift-sdk.
@colemancda
colemancda merged commit c63dc31 into master Jul 18, 2026
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant