Files
firezone/.github/workflows/swift.yml
Jamil da66264c84 Use larger builders for CPU-bound workflows (#2256)
- `ubuntu-22.04-firezone` is a 16-core builder for ~~kotlin~~ and docker
- ~~`macos-13-xlarge` is an M1 builder for Apple and docker arm64~~
- Configure the Gradle build cache
- Upgrade kotlin plugins, Android minSDK to 30, and gradle to 8.4


Edit: It appears that even using the largest runners for kotin and swift
don't speed the builds up that much (~30%), but will substantially
increase our cost, so I've reverted them to free.

Fixes #2210
2023-10-07 08:07:24 -07:00

74 lines
2.5 KiB
YAML

name: Swift
on:
workflow_call:
# Cancel old workflow runs if new code is pushed
concurrency:
group: "swift-${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.runs-on.os }}
strategy:
fail-fast: false
matrix:
runs-on:
# Builds are more IO-bound than CPU-bound so using a larger GitHub-hosted
# runner isn't worth it.
- os: macos-13
xcode-ver: "14.3"
target:
- sdk: macosx
platform: macOS
destination: platform=macOS
- sdk: iphoneos
platform: iOS
destination: generic/platform=iOS
permissions:
contents: read
defaults:
run:
working-directory: ./swift
steps:
- uses: actions/checkout@v4
- name: Update toolchain
run: rustup show
working-directory: ./rust
- uses: Swatinem/rust-cache@v2
with:
workspaces: ./rust
key: ${{ matrix.target.platform }}
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: actions/cache/restore@v3
name: Restore SwiftPM Cache
with:
path: ~/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts
key:
${{ matrix.target.platform }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ matrix.target.platform }}-spm-${{ hashFiles('**/Package.resolved') }}
${{ matrix.target.platform }}-
- run: |
sudo ls -al /Applications/
- name: Select Xcode
run: |
sudo xcode-select -s /Applications/Xcode_${{ matrix.runs-on.xcode-ver }}.app
- name: Install swift-format
run: brew install swift-format
- name: Build app
env:
ONLY_ACTIVE_ARCH: no
working-directory: ./swift/apple
run: |
cp Firezone/xcconfig/Developer.xcconfig.ci-${{ matrix.target.platform }} Firezone/xcconfig/Developer.xcconfig
cp Firezone/xcconfig/Server.xcconfig.ci Firezone/xcconfig/Server.xcconfig
xcodebuild archive -configuration Release -scheme Firezone -sdk ${{ matrix.target.sdk }} -destination '${{ matrix.target.destination }}' CODE_SIGNING_ALLOWED=NO
- uses: actions/cache/save@v3
if: ${{ github.ref == 'refs/heads/main' }}
name: Save SwiftPM Cache
with:
path: ~/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts
key:
${{ matrix.target.platform }}-spm-${{ hashFiles('**/Package.resolved') }}