Only Linux, differently. #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
pull_request: | |
branches: ["*"] | |
tags-ignore: ["**"] | |
jobs: | |
macos-arm: | |
name: macOS (arm64) | |
runs-on: macos-15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build and Test | |
run: swift test --enable-code-coverage | |
- name: Prepare coverage report | |
if: github.ref == 'refs/heads/master' | |
run: xcrun llvm-cov export -format="lcov" .build/debug/TimePackageTests.xctest/Contents/MacOS/TimePackageTests -instr-profile .build/debug/codecov/default.profdata > macos-arm64.lcov | |
- name: Cache coverage report | |
if: github.ref == 'refs/heads/master' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report-macos-arm64 | |
path: macos-arm64.lcov | |
macos-intel: | |
name: macOS (x64) | |
runs-on: macos-15-large | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build and Test | |
run: swift test --enable-code-coverage | |
- name: Prepare coverage report | |
if: github.ref == 'refs/heads/master' | |
run: xcrun llvm-cov export -format="lcov" .build/debug/TimePackageTests.xctest/Contents/MacOS/TimePackageTests -instr-profile .build/debug/codecov/default.profdata > macos-x64.lcov | |
- name: Cache coverage report | |
if: github.ref == 'refs/heads/master' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report-macos-x64 | |
path: macos-x64.lcov | |
linux: | |
name: Linux | |
runs-on: ubuntu-latest | |
container: | |
image: swift:6.0 | |
options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --security-opt apparmor=unconfined | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build and Test | |
run: swift test --enable-test-discovery --enable-code-coverage | |
- name: Prepare coverage report | |
if: github.ref == 'refs/heads/master' | |
run: $(dirname $(realpath $(which swift)))/llvm-cov export -format="lcov" .build/debug/TimePackageTests.xctest -instr-profile .build/debug/codecov/default.profdata > linux.lcov | |
- name: Cache coverage report | |
if: github.ref == 'refs/heads/master' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report-linux | |
path: linux.lcov | |
test-coverage: | |
name: Test Coverage | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
needs: [macos-arm, macos-intel, linux] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Restore coverage reports | |
uses: actions/download-artifact@v4 | |
with: | |
path: coverage-reports | |
pattern: coverage-report-linux | |
merge-multiple: true | |
- name: Upload test coverage | |
uses: codecov/codecov-action@v5 | |
with: | |
fail_ci_if_error: true | |
directory: coverage-reports | |
token: ${{ secrets.CODECOV_TOKEN }} |