Skip to content

Improve mock generation for fulfilledByType and mockOnly coexistence #1846

Improve mock generation for fulfilledByType and mockOnly coexistence

Improve mock generation for fulfilledByType and mockOnly coexistence #1846

Workflow file for this run

name: CI
on:
push:
branches:
- main
schedule:
# Runs at 00:00 UTC every Monday to ensure that CI does not bitrot.
- cron: '0 0 * * 1'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
update-version-check:
name: Update Version Script Check
runs-on: macos-26
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Run update-version script
run: ./Scripts/update-version.sh 99.99.99-test abc123testchecksum456
- name: Verify URL was updated
run: grep -q 'releases/download/99.99.99-test/SafeDITool.artifactbundle.zip' Package.swift
- name: Verify checksum was updated
run: grep -q 'checksum:.*abc123testchecksum456' Package.swift
xcodebuild:
name: Build with xcodebuild on Xcode 26
runs-on: macos-26
strategy:
matrix:
platforms: [
'generic/platform=ios',
'platform=macOS',
'generic/platform=tvos',
'generic/platform=watchos',
'generic/platform=visionos'
]
fail-fast: false
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
- name: Download Platform
if: matrix.platforms != 'platform=macOS'
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
PLATFORM=$(echo "${{ matrix.platforms }}" | sed 's|generic/platform=||')
sudo xcodebuild -downloadPlatform "$PLATFORM"
- name: Build Framework
run: xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme SafeDI-Package -destination ${{ matrix.platforms }}
spm-package-integration:
name: Build Package Integration on Xcode 26
runs-on: macos-26
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
- name: Build Package Integration
run: xcrun swift build --package-path "Examples/Example Package Integration"
spm-project-integration:
name: Build Project Integration on Xcode 26
runs-on: macos-26
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
- name: Replace 'main' branch with the current branch
if: github.event.pull_request.head.repo.full_name == github.repository # Only do this if the branch is from our repo.
run: sed -i '' "s#branch = main;#branch = ${{ github.head_ref || github.ref_name }};#" "Examples/ExampleProjectIntegration/ExampleProjectIntegration.xcodeproj/project.pbxproj"
- name: Build Project Integration
run: pushd Examples/ExampleProjectIntegration; xcrun xcodebuild build -skipPackagePluginValidation -skipMacroValidation -scheme ExampleProjectIntegration; popd
spm-multi-project-integration:
name: Build Multi Project Integration on Xcode 26
runs-on: macos-26
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
- name: Replace 'main' branch with the current branch
if: github.event.pull_request.head.repo.full_name == github.repository # Only do this if the branch is from our repo.
run: sed -i '' "s#branch = main;#branch = ${{ github.head_ref || github.ref_name }};#" "Examples/ExampleMultiProjectIntegration/ExampleMultiProjectIntegration.xcodeproj/project.pbxproj"
- name: Build Project Integration
run: pushd Examples/ExampleMultiProjectIntegration; xcrun xcodebuild build -skipPackagePluginValidation -skipMacroValidation -scheme ExampleMultiProjectIntegration; popd
spm:
name: Build and Test on Xcode 26
runs-on: macos-26
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
- name: Build and Test Framework
run: |
for i in {1..5}; do # Run tests a few times to ensure code-gen is stable.
xcrun swift test -c release --enable-code-coverage -Xswiftc -enable-testing --traits sourceBuild
done
- name: Prepare Coverage Reports
run: ./Scripts/prepare-coverage-reports.sh
- name: Upload Coverage Reports
if: success()
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
verbose: true
os: macos
linux:
name: Build and Test on Linux
runs-on: ubuntu-latest
container: swift:6.3
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Build and Test Framework
run: swift test -c release --enable-code-coverage -Xswiftc -enable-testing --traits sourceBuild
- name: Install curl for Codecov
run: |
apt-get update
apt-get install -y --no-install-recommends curl ca-certificates
- name: Prepare Coverage Reports
run: |
llvm-cov export -format="lcov" .build/x86_64-unknown-linux-gnu/release/SafeDIPackageTests.xctest -instr-profile .build/x86_64-unknown-linux-gnu/release/codecov/default.profdata > coverage.lcov
- name: Upload Coverage Reports
if: success()
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
verbose: true
os: linux
readme-validation:
name: Check Markdown links
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Link Checker
uses: AlexanderDokuchaev/md-dead-link-check@d5a37e0b14e5918605d22b34562532762ccb2e47 # v1.2.0
lint-swift:
name: Lint Swift
runs-on: ubuntu-latest
container: swift:6.3
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Lint Swift
run: swift run --package-path CLI swiftformat . --lint