143 lines
4.6 KiB
YAML
143 lines
4.6 KiB
YAML
name: Build Apple
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- "**"
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
name: Build App (${{ matrix.platform }})
|
|
runs-on: namespace-profile-macos-large
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- platform: macOS
|
|
cache-id: macos
|
|
destination: platform=macOS
|
|
rust-targets: x86_64-apple-darwin,aarch64-apple-darwin
|
|
- platform: iOS Simulator
|
|
cache-id: ios-simulator
|
|
destination: platform=iOS Simulator,name=iPhone 17 Pro
|
|
rust-targets: aarch64-apple-ios-sim,x86_64-apple-ios
|
|
env:
|
|
CARGO_INCREMENTAL: 0
|
|
RUST_BACKTRACE: short
|
|
RUSTC_WRAPPER: sccache
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://code.forgejo.org/actions/checkout@v4
|
|
with:
|
|
token: ${{ github.token }}
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: Select Xcode
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
candidates=(
|
|
"/Applications/Xcode_26.1.app/Contents/Developer"
|
|
"/Applications/Xcode_26_1.app/Contents/Developer"
|
|
"/Applications/Xcode.app/Contents/Developer"
|
|
"/Applications/Xcode/Xcode.app/Contents/Developer"
|
|
)
|
|
selected=""
|
|
for candidate in "${candidates[@]}"; do
|
|
if [[ -d "$candidate" ]]; then
|
|
selected="$candidate"
|
|
break
|
|
fi
|
|
done
|
|
if [[ -z "$selected" ]] && command -v xcode-select >/dev/null 2>&1; then
|
|
selected="$(xcode-select -p)"
|
|
fi
|
|
if [[ -z "$selected" ]]; then
|
|
echo "::error ::Unable to locate an Xcode toolchain" >&2
|
|
exit 1
|
|
fi
|
|
echo "DEVELOPER_DIR=$selected" >> "$GITHUB_ENV"
|
|
DEVELOPER_DIR="$selected" /usr/bin/xcodebuild -version || true
|
|
|
|
- name: Prepare Cache Dirs
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
cache_root="${NSC_CACHE_PATH:-${HOME}/.cache/burrow}"
|
|
mkdir -p \
|
|
"${cache_root}/cargo" \
|
|
"${cache_root}/rustup" \
|
|
"${cache_root}/sccache" \
|
|
"${cache_root}/apple/PackageCache" \
|
|
"${cache_root}/apple/SourcePackages" \
|
|
"${cache_root}/apple/DerivedData/${{ matrix.cache-id }}"
|
|
echo "CARGO_HOME=${cache_root}/cargo" >> "${GITHUB_ENV}"
|
|
echo "RUSTUP_HOME=${cache_root}/rustup" >> "${GITHUB_ENV}"
|
|
echo "SCCACHE_DIR=${cache_root}/sccache" >> "${GITHUB_ENV}"
|
|
echo "APPLE_PACKAGE_CACHE=${cache_root}/apple/PackageCache" >> "${GITHUB_ENV}"
|
|
echo "APPLE_SOURCE_PACKAGES=${cache_root}/apple/SourcePackages" >> "${GITHUB_ENV}"
|
|
echo "APPLE_DERIVED_DATA=${cache_root}/apple/DerivedData/${{ matrix.cache-id }}" >> "${GITHUB_ENV}"
|
|
|
|
- name: Install Rust
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
if ! command -v rustup >/dev/null 2>&1; then
|
|
curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.85.0
|
|
else
|
|
rustup set profile minimal
|
|
rustup toolchain install 1.85.0
|
|
rustup default 1.85.0
|
|
fi
|
|
|
|
echo "${CARGO_HOME}/bin" >> "${GITHUB_PATH}"
|
|
. "${CARGO_HOME}/env"
|
|
|
|
targets='${{ matrix.rust-targets }}'
|
|
for target in ${targets//,/ }; do
|
|
rustup target add "${target}"
|
|
done
|
|
|
|
rustc --version
|
|
cargo --version
|
|
|
|
- name: Install Protobuf
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
if ! command -v protoc >/dev/null 2>&1; then
|
|
brew install protobuf
|
|
fi
|
|
if ! command -v sccache >/dev/null 2>&1; then
|
|
brew install sccache
|
|
fi
|
|
|
|
- name: Build
|
|
shell: bash
|
|
working-directory: Apple
|
|
run: |
|
|
set -euo pipefail
|
|
xcodebuild build \
|
|
-project Burrow.xcodeproj \
|
|
-scheme App \
|
|
-destination '${{ matrix.destination }}' \
|
|
-skipPackagePluginValidation \
|
|
-skipMacroValidation \
|
|
-onlyUsePackageVersionsFromResolvedFile \
|
|
-clonedSourcePackagesDirPath "$APPLE_SOURCE_PACKAGES" \
|
|
-packageCachePath "$APPLE_PACKAGE_CACHE" \
|
|
-derivedDataPath "$APPLE_DERIVED_DATA" \
|
|
CODE_SIGNING_ALLOWED=NO \
|
|
CODE_SIGNING_REQUIRED=NO \
|
|
CODE_SIGN_IDENTITY="" \
|
|
DEVELOPMENT_TEAM=""
|