Skip to content

Add support for Swift Testing (#848) #1344

Add support for Swift Testing (#848)

Add support for Swift Testing (#848) #1344

Workflow file for this run

name: Test
on:
push:
branches:
- master
pull_request: {}
env:
MISE_EXPERIMENTAL: 1
swift_package_resolve: swift package resolve
swift_build: swift build
swift_test: swift test
periphery_scan: ./.build/debug/periphery scan --quiet --clean-build --strict
cache_version: 1
jobs:
lint:
runs-on: macos-15
name: Lint
steps:
- uses: actions/checkout@master
- uses: jdx/mise-action@v2
- run: mise run lint-ci
bazel:
runs-on: macos-15
name: Bazel
steps:
- uses: actions/checkout@master
- uses: jdx/mise-action@v2
- name: Check generated rules
run: mise r gen-bazel-rules && git diff --quiet --exit-code
- name: Scan
run: bazel run //:periphery -- scan --bazel --quiet --strict --baseline baselines/bazel.json
macOS:
strategy:
fail-fast: false
matrix:
xcode: ["16.1", "16.0", "15.4"]
include:
- xcode: "16.1"
macos: macos-15
- xcode: "16.0"
macos: macos-15
- xcode: "15.4"
macos: macos-14
runs-on: ${{ matrix.macos }}
name: macOS
steps:
- uses: actions/checkout@master
- name: Select Xcode version
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app; swift -version
- name: Get Swift Version
id: get-swift-version
run: |
echo "::set-output name=version::$(swift -version | head -n 1 | sed s/,// )"
shell: bash
- name: Cache resolved dependencies
id: cache-resolved-dependencies
uses: actions/cache@v2
with:
path: |
.build
Package.resolved
key: ${{ runner.os }}-${{ matrix.xcode }}-${{ steps.get-swift-version.outputs.version }}-${{ env.cache_version }}-spm-deps-${{ hashFiles('Package.swift', 'Package.resolved') }}
restore-keys: |
${{ runner.os }}-${{ matrix.xcode }}-${{ steps.get-swift-version.outputs.version }}-${{ env.cache_version }}-spm-deps-
- name: Resolve dependencies
if: steps.cache-resolved-dependencies.outputs.cache-hit != 'true'
run: ${{ env.swift_package_resolve }}
- name: Build
run: ${{ env.swift_build }}
- name: Scan
run: ${{ env.periphery_scan }}
- name: Test
run: ${{ env.swift_test }}
linux:
strategy:
fail-fast: false
matrix:
swift: ["6.0", "5.10"]
include:
- swift: "6.0"
container: "swift:6.0"
- swift: "5.10"
container: "swift:5.10"
runs-on: ubuntu-20.04
container: ${{ matrix.container }}
name: Linux
steps:
- uses: actions/checkout@master
- name: Get Swift Version
id: get-swift-version
run: |
echo "::set-output name=version::$(swift -version | head -n 1 | sed s/,// )"
shell: bash
- name: Cache resolved dependencies
id: cache-resolved-dependencies
uses: actions/cache@v2
with:
path: |
.build
Package.resolved
key: ${{ runner.os }}-${{ steps.get-swift-version.outputs.version }}-${{ env.cache_version }}-spm-deps-${{ hashFiles('Package.swift', 'Package.resolved') }}
restore-keys: |
${{ runner.os }}-${{ steps.get-swift-version.outputs.version }}-${{ env.cache_version }}-spm-deps-
- name: Resolve dependencies
if: steps.cache-resolved-dependencies.outputs.cache-hit != 'true'
run: ${{ env.swift_package_resolve }}
- name: Build
run: ${{ env.swift_build }}
- name: Scan
run: ${{ env.periphery_scan }} --baseline baselines/linux.json
- name: Test
run: ${{ env.swift_test }}