Skip to content

Merge pull request #21 from algorandfoundation/chore/move_tests #55

Merge pull request #21 from algorandfoundation/chore/move_tests

Merge pull request #21 from algorandfoundation/chore/move_tests #55

Workflow file for this run

name: Swift CI
on:
push:
paths:
- crates/algo_models_ffi/**
- crates/algo_models/**
- packages/swift/AlgoModels/**
- scripts/build/swift.ts
- scripts/build/index.ts
- "!*.md"
- .github/workflows/swift_ci.yml
branches:
- main
- master
tags:
- "*"
pull_request:
paths:
- crates/algo_models_ffi/**
- crates/algo_models/**
- packages/swift/AlgoModels/**
- scripts/build/swift.ts
- scripts/build/index.ts
- "!*.md"
- .github/workflows/swift_ci.yml
workflow_dispatch:
permissions:
contents: write
env:
CRATE: algo_models_ffi
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: oven-sh/setup-bun@v2
with:
bun-version: latest
- 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: bun scripts/build/swift.ts ${{ 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 crates/${{ env.CRATE}}/tests/swift/ && xcodebuild -scheme ${{ env.PACKAGE }}Tests-Package test -destination "platform=macOS"
- name: Test (iOS)
run: cd crates/${{ env.CRATE}}/tests/swift/ && xcodebuild -scheme ${{ env.PACKAGE }}Tests-Package test -destination "platform=iOS Simulator,name=iPhone 16,OS=latest"
- name: Test (Catalyst)
run: cd crates/${{ env.CRATE}}/tests/swift/ && xcodebuild -scheme ${{ env.PACKAGE }}Tests-Package test -destination "platform=macOS,variant=Mac Catalyst"
- name: Commit Package
uses: stefanzweifel/git-auto-commit-action@v5
if: github.event_name == 'push'
with:
commit_message: "Swift CI ${{ env.PACKAGE }} package"