Merge pull request #16 from algorandfoundation/ci/xcode_versions #37
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 | |
# - name: Cache Homebrew Bundler RubyGems | |
# id: cache | |
# uses: actions/cache@v3 | |
# with: | |
# path: ${{ steps.set-up-homebrew.outputs.gems-path }} | |
# key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} | |
# restore-keys: ${{ runner.os }}-rubygems- | |
# - name: Install Homebrew Bundler RubyGems | |
# if: steps.cache.outputs.cache-hit != 'true' | |
# run: brew install-bundler-gems | |
# - name: Install brew packages | |
# run: brew install aria2 xcodesorg/made/xcodes | |
- name: Setup Xcode | |
uses: mxcl/xcodebuild@v3 | |
with: | |
swift: ^6 | |
action: none | |
platform: macOS | |
- name: Install iOS Simulator | |
run: xcodebuild -downloadPlatform iOS | |
- 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" |