Skip to content

[codecov test]

[codecov test] #181

name: Build and Test
on:
push:
paths-ignore:
- "**.md"
- "LICENSE"
- ".gitignore"
- ".editorconfig"
jobs:
test:
strategy:
fail-fast: false
matrix:
# Note: all combinations of the following will be run independently
os: [macos-15, ubuntu-24.04, windows-2025]
swift: ["6.2"]
config: [release, debug]
include:
# Disable exporting code coverage by default.
- export-coverage: false
# Enable exporting code coverage in a single configuration.
- os: "ubuntu-24.04"
swift: "6.2"
config: debug
export-coverage: true
steps:
- uses: actions/checkout@v4
- name: Set up Swift ${{ matrix.swift }} on ${{ matrix.os }}
uses: SwiftyLab/setup-swift@latest
with:
swift-version: ${{ matrix.swift }}
- uses: compnerd/gha-setup-vsdevenv@main
with:
winsdk: "10.0.22621.0" # Workaround for this: https://forums.swift.org/t/swiftpm-plugin-doesnt-work-with-the-latest-visual-studio-version/78183/14
# TL;DR: The Windows SDK had a change in 10.0.26100.0 that the Swift compiler didn't account for.
# The Swift compiler team is aware of the issue and they are going to release a fix some time.
- name: Verify swift version
run: swift --version && swift --version | grep -q ${{ matrix.swift }}
shell: bash
# We disabled the separate build step, as it consumes extra CI time - building for testing apparently doesn't
# reuse the build cache from here, doubling the CI time.
- name: Build and test for ${{ matrix.swift }} on ${{ matrix.os }} in ${{ matrix.config }} mode
run: swift test -c ${{ matrix.config }} --verbose ${{ matrix.export-coverage && '--enable-code-coverage' || '' }}
- name: Export code coverage
if: ${{ matrix.export-coverage }}
run: llvm-cov export $(swift build --show-bin-path)/HyloPackageTests.xctest --format="lcov" --instr-profile $(swift build --show-bin-path)/codecov/default.profdata > info.lcov
- name: Upload coverage report to Codecov
if: ${{ matrix.export-coverage }}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
runs-on: ${{ matrix.os }}