Modernize Android CI (#297) #1
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: iOS CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
format-lint: | |
runs-on: macos-14 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-ios-swiftformat | |
cancel-in-progress: true | |
steps: | |
- name: Upgrade swiftformat to latest | |
run: brew install swiftformat | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Check format | |
run: swiftformat . --lint | |
build-ferrostar: | |
runs-on: macos-14 | |
permissions: | |
contents: write # To auto-commit Package.swift and binding changes | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-ios-build-lib | |
cancel-in-progress: true | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Ensure that Package.swift is NOT configured for local development at this stage (easy to forget) | |
run: sed -i '' 's/let useLocalFramework = true/let useLocalFramework = false/' Package.swift | |
- name: Commit changed files (it is easy to forget useLocalFramework in Package.swift) | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
file_pattern: 'Package.swift' | |
- name: Build iOS XCFramework | |
run: ./build-ios.sh --release | |
working-directory: common | |
- name: Ensure that Package.swift is NOT configured for local development at this stage (easy to forget) | |
run: sed -i '' 's/let useLocalFramework = true/let useLocalFramework = false/' Package.swift | |
- name: Commit changed files (it is easy to forget about ferrostar.swift) | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
file_pattern: 'apple/Sources/UniFFI/*' | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libferrostar-rs.xcframework.zip | |
path: common/target/ios/libferrostar-rs.xcframework.zip | |
retention-days: 5 | |
build-demo: | |
runs-on: macos-14 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-ios-build-demo | |
cancel-in-progress: true | |
needs: build-ferrostar | |
strategy: | |
matrix: | |
scheme: [ | |
"iOS Demo" | |
] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Configure Package.swift for local development | |
run: sed -i '' 's/let useLocalFramework = false/let useLocalFramework = true/' Package.swift | |
- name: Download libferrostar-rs.xcframework. | |
uses: actions/download-artifact@v4 | |
with: | |
path: common | |
name: libferrostar-rs.xcframework.zip | |
- name: Unzip libferrostar-rs.xcframework | |
run: ditto -x -k libferrostar-rs.xcframework.zip target/ios/ | |
working-directory: common | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '15.3' | |
- name: Install xcbeautify | |
run: brew install xcbeautify | |
- name: Rename API-Keys.plist template | |
run: mv apple/DemoApp/API-Keys.plist.template apple/DemoApp/API-Keys.plist | |
- name: Build ${{ matrix.scheme }} | |
run: xcodebuild -scheme "${{ matrix.scheme }}" build -configuration Debug -skipMacroValidation \ | |
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcbeautify && exit ${PIPESTATUS[0]} | |
working-directory: apple/DemoApp | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Demo-Package.swift | |
path: Package.swift | |
retention-days: 5 | |
test: | |
runs-on: macos-14 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-ios-test | |
cancel-in-progress: true | |
needs: build-ferrostar | |
strategy: | |
matrix: | |
scheme: [ | |
FerrostarCore-Package | |
] | |
destination: [ | |
# TODO: Add more destinations | |
'platform=iOS Simulator,name=iPhone 15,OS=17.2' | |
] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Configure Package.swift for local development | |
run: sed -i '' 's/let useLocalFramework = false/let useLocalFramework = true/' Package.swift | |
- name: Download libferrostar-rs.xcframework. | |
uses: actions/download-artifact@v4 | |
with: | |
path: common | |
name: libferrostar-rs.xcframework.zip | |
- name: Unzip libferrostar-rs.xcframework | |
run: ditto -x -k libferrostar-rs.xcframework.zip target/ios/ | |
working-directory: common | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '15.3' | |
- name: Install xcbeautify | |
run: brew install xcbeautify | |
- name: Test ${{ matrix.scheme }} on ${{ matrix.destination }} | |
run: xcodebuild -scheme ${{ matrix.scheme }} test -skipMacroValidation -destination '${{ matrix.destination }}' | xcbeautify && exit ${PIPESTATUS[0]} | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Library-Package.swift | |
path: Package.swift | |
retention-days: 5 |