Add code coverage #41
Workflow file for this run
This file contains hidden or 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: [ main, master ] | |
| workflow_dispatch: | |
| jobs: | |
| macos: | |
| runs-on: macos-26 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Swift version | |
| run: swift --version | |
| - name: Build | |
| run: swift build -v | |
| - name: Test | |
| run: swift test -v | |
| coverage: | |
| name: Code Coverage | |
| runs-on: macos-26 | |
| permissions: | |
| contents: read | |
| code-quality: write # required by actions/upload-code-coverage | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Export coverage and enforce threshold | |
| run: Scripts/coverage.sh | |
| env: | |
| COVERAGE_THRESHOLD: 95 | |
| - name: Upload coverage to GitHub Code Quality | |
| uses: actions/upload-code-coverage@v1 | |
| with: | |
| file: .build/coverage/coverage.xml | |
| language: Swift | |
| label: code-coverage/llvm-cov | |
| # Code Quality was in public preview until 2026-07-20; keep this while | |
| # the repo might not have the feature enabled, so a failed upload | |
| # doesn't break CI. | |
| fail-on-error: false | |
| - name: Upload coverage artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: code-coverage | |
| path: .build/coverage/ | |
| if-no-files-found: error | |
| linux: | |
| runs-on: ubuntu-latest | |
| container: swift:6.3.3 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Swift version | |
| run: swift --version | |
| - name: Build | |
| run: swift build -v | |
| - name: Test | |
| run: swift test -v | |
| android: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Test Swift Package on Android | |
| uses: skiptools/swift-android-action@v2 | |
| with: | |
| swift-version: '6.3' | |
| free-disk-space: true | |
| windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: compnerd/gha-setup-swift@main | |
| with: | |
| branch: swift-6.3.2-release | |
| tag: 6.3.2-RELEASE | |
| - uses: actions/checkout@v4 | |
| - name: Swift version | |
| run: swift --version | |
| - name: Build | |
| run: swift build -v | |
| - name: Test | |
| run: swift test -v |