Maintenance (#83) #170
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: macOS | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
CODECOV_XCODE_VERSION: "16.0" # Xcode version used to generate code coverage | |
jobs: | |
macos: | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
config: | |
- { os: "macos-14", xcode: "15.4" } | |
- { os: "macos-15", xcode: "16.0" } | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Select Xcode ${{ matrix.config.xcode }} | |
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.config.xcode }}.app | |
- name: Test | |
run: swift test -c release --parallel --xunit-output .build/xUnit-output.xml --enable-code-coverage | |
env: | |
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.config.xcode }}.app/Contents/Developer | |
- name: Upload test artifacts | |
if: failure() | |
uses: actions/[email protected] | |
with: | |
name: test-artifacts-${{ matrix.config.xcode }}-${{ github.run_id }} | |
path: | | |
.build/*.yaml | |
.build/*.xml | |
.build/*.json | |
.build/*.txt | |
.build/**/*.xctest | |
.build/**/*.json | |
.build/**/*.txt | |
if-no-files-found: warn | |
include-hidden-files: true | |
# Only run coverage steps if the CODECOV_TOKEN is available and the matrix.xcode matches CODECOV_XCODE_VERSION | |
- name: Generate coverage report | |
if: env.CODECOV_TOKEN != '' && matrix.config.xcode == env.CODECOV_XCODE_VERSION | |
run: xcrun llvm-cov export -format="lcov" .build/**/*PackageTests.xctest/Contents/MacOS/*PackageTests -instr-profile .build/**/codecov/default.profdata > coverage.lcov | |
- name: Upload code coverage report | |
if: env.CODECOV_TOKEN != '' && matrix.config.xcode == env.CODECOV_XCODE_VERSION | |
uses: codecov/[email protected] | |
with: | |
token: ${{ env.CODECOV_TOKEN }} | |
files: coverage.lcov | |
fail_ci_if_error: true |