Swift CI #31
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: Swift CI | |
on: | |
push: | |
paths: | |
- crates/algo_models_ffi/** | |
- crates/algo_models/** | |
- dist/swift/** | |
- "!*.md" | |
- .github/workflows/swift_ci.yml | |
branches: | |
- main | |
- master | |
tags: | |
- "*" | |
pull_request: | |
paths: | |
- crates/algo_models_ffi/** | |
- crates/algo_models/** | |
- dist/swift/** | |
- "!*.md" | |
- .github/workflows/swift_ci.yml | |
workflow_dispatch: | |
permissions: | |
contents: write | |
env: | |
CRATE: algo_models | |
PACKAGE: AlgoModels | |
jobs: | |
build_and_test: | |
defaults: | |
run: | |
shell: bash | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: aarch64-apple-ios, x86_64-apple-ios, aarch64-apple-ios-sim, x86_64-apple-ios, aarch64-apple-ios-macabi, x86_64-apple-ios-macabi, aarch64-apple-darwin, x86_64-apple-darwin | |
- uses: actions/setup-python@v5 | |
- uses: mxcl/xcodebuild@v3 | |
with: | |
swift: ^6 | |
action: none | |
- name: Build | |
run: python -m dist.swift ${{ env.CRATE }} | |
# Ideally we'd use a matrix for the platforms, but due to the limitations of Mac runners on GitHub it's probably better to just have a single job with multiple steps | |
- name: Test (macOS) | |
run: cd dist/swift/${{ env.PACKAGE }} && xcodebuild -scheme ${{ env.PACKAGE }} test -destination "platform=macOS" | |
- name: Test (iOS) | |
run: cd dist/swift/${{ env.PACKAGE }} && xcodebuild -scheme ${{ env.PACKAGE }} test -destination "platform=iOS Simulator,name=iPhone 16,OS=latest" | |
- name: Test (Catalyst) | |
run: cd dist/swift/${{ env.PACKAGE }} && xcodebuild -scheme ${{ env.PACKAGE }} test -destination "platform=macOS,variant=Mac Catalyst" | |
- name: Commit Package | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "Swift CI ${{ env.PACKAGE }} package" |