Merge pull request #10 from JosephDuffy/api-improvements #43
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: Tests | |
on: | |
push: | |
pull_request: | |
branches: | |
- "**:**" # PRs from forks have a prefix with `owner:` | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
macos_tests: | |
name: macOS Tests (SwiftPM, Xcode ${{ matrix.xcode }}) | |
runs-on: "macos-13" | |
strategy: | |
fail-fast: false | |
matrix: | |
xcode: ["15.0.1", "15.1"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Select Xcode ${{ matrix.xcode }} | |
run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode }}.app | |
- name: Cache SwiftPM | |
uses: actions/cache@v3 | |
with: | |
path: .build | |
key: ${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm-${{ github.ref }}-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm-${{ github.ref }}- | |
${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm-main- | |
${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm- | |
- name: SwiftPM tests | |
run: swift test --enable-code-coverage | |
- name: Convert coverage for Codecov | |
id: convert-coverage | |
uses: sersoft-gmbh/swift-coverage-action@v4 | |
with: | |
ignore-conversion-failures: true | |
fail-on-empty-output: true | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
files: ${{ join(fromJSON(steps.convert-coverage.outputs.files), ',') }} | |
fail_ci_if_error: true | |
xcode_tests: | |
name: ${{ matrix.platform }} Tests (Xcode ${{ matrix.xcode }}) | |
runs-on: macos-13 | |
strategy: | |
fail-fast: false | |
matrix: | |
xcode: ["15.0.1", "15.1"] | |
platform: ["macOS", "iOS", "tvOS", "watchOS", "macCatalyst"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Select Xcode ${{ matrix.xcode }} | |
run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode }}.app | |
- name: Install Mint | |
run: brew install mint | |
- name: Cache Mint | |
uses: actions/cache@v3 | |
with: | |
path: ~/.mint | |
key: ${{ runner.os }}-mint-xcode_${{ matrix.xcode }}-${{ hashFiles('**/Mintfile') }} | |
restore-keys: | | |
${{ runner.os }}-mint-xcode_${{ matrix.xcode }} | |
- run: mint bootstrap | |
- name: Cache DerivedData | |
uses: actions/cache@v3 | |
with: | |
path: ~/Library/Developer/Xcode/DerivedData | |
key: ${{ runner.os }}-xcode_${{ matrix.xcode }}-derived_data-${{ github.ref }} | |
restore-keys: | | |
${{ runner.os }}-xcode_${{ matrix.xcode }}-derived_data-main | |
${{ runner.os }}-xcode_${{ matrix.xcode }}-derived_data- | |
- name: Run Tests | |
run: | | |
set -o pipefail | |
mint run xcutils test ${{ matrix.platform }} --scheme HashableMacro --enable-code-coverage | $(mint which xcbeautify) | |
- name: Convert coverage for Codecov | |
id: convert-coverage | |
uses: sersoft-gmbh/swift-coverage-action@v4 | |
with: | |
fail-on-empty-output: true | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
files: ${{ join(fromJSON(steps.convert-coverage.outputs.files), ',') }} | |
fail_ci_if_error: true | |
linux_tests: | |
name: Swift ${{ matrix.swift }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
container: | |
image: swift:${{ matrix.swift }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest"] | |
swift: ["5.9.0", "5.9.2"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache SwiftPM | |
uses: actions/cache@v3 | |
with: | |
path: .build | |
key: ${{ runner.os }}-swift_${{ matrix.swift }}-swiftpm-deps-${{ github.ref }}-${{ hashFiles('Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-swift_${{ matrix.swift }}-swiftpm-deps-${{ github.ref }}- | |
${{ runner.os }}-swift_${{ matrix.swift }}-swiftpm-deps-main- | |
${{ runner.os }}-swift_${{ matrix.swift }}-swiftpm-deps- | |
- name: swift test | |
run: swift test |