test: Migrate to Swift Testing #89
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
# This workflow will build a Swift project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift | |
name: Swift | |
permissions: | |
id-token: write | |
contents: read | |
checks: write | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
macos: | |
strategy: | |
matrix: | |
os: [macos-14] | |
name: Build and test on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get swift version | |
run: swift --version | |
- name: Get macOS version | |
run: sw_vers | |
if: startsWith( matrix.os, 'macos' ) | |
- name: Set TEST_GITHUB_TOKEN env variable | |
shell: bash | |
env: | |
TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }} | |
run: | | |
echo "$TEST_GITHUB_TOKEN" > $HOME/.env | |
- name: Build | |
run: swift build --build-tests | |
- name: Run tests | |
run: swift test --parallel --xunit-output=results.xml | |
- name: Report test results | |
uses: phoenix-actions/test-reporting@v15 | |
id: test-report | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: Swift tests on ${{ matrix.os }} | |
path: results.xml | |
reporter: java-junit | |
ubuntu: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
name: Build and test on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
container: swiftlang/swift:nightly-6.0-jammy | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get swift version | |
run: swift --version | |
- name: Get macOS version | |
run: sw_vers | |
if: startsWith( matrix.os, 'macos' ) | |
- name: Set TEST_GITHUB_TOKEN env variable | |
shell: bash | |
env: | |
TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }} | |
run: | | |
echo "$TEST_GITHUB_TOKEN" > $HOME/.env | |
- name: Build | |
run: swift build --build-tests | |
- name: Run tests | |
run: swift test --parallel --xunit-output=results.xml | |
- name: Report test results | |
uses: phoenix-actions/test-reporting@v15 | |
id: test-report | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: Swift tests on ${{ matrix.os }} | |
path: results.xml | |
reporter: java-junit | |