Skip to content

Move NavDataLoader polling to background context (fixes app hang) #70

Move NavDataLoader polling to background context (fixes app hang)

Move NavDataLoader polling to background context (fixes app hang) #70

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build (iOS ${{ matrix.ios-label }})
strategy:
fail-fast: false
matrix:
include:
- ios-label: latest
runner: macos-26
device-type: com.apple.CoreSimulator.SimDeviceType.iPhone-17-Pro
os-version: ""
- ios-label: "18.4"
runner: macos-latest
device-type: com.apple.CoreSimulator.SimDeviceType.iPhone-16-Pro
os-version: "18.4"
runs-on: ${{ matrix.runner }}
steps:
- name: Disable Spotlight indexing
run: |
sudo mdutil -a -i off
sudo launchctl bootout system/com.apple.metadata.mds 2>/dev/null || true
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Ensure iOS simulator runtime
id: runtime
run: |
if [ -n "${{ matrix.os-version }}" ]; then
VERSION="${{ matrix.os-version }}"
else
VERSION=$(xcrun --sdk iphonesimulator --show-sdk-version)
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
if xcrun simctl list runtimes | grep -q "iOS ${VERSION}"; then
echo "iOS ${VERSION} runtime already installed"
else
echo "iOS ${VERSION} runtime not found, downloading..."
if [ -n "${{ matrix.os-version }}" ]; then
xcodebuild -downloadPlatform iOS -buildVersion "${{ matrix.os-version }}"
else
xcodebuild -downloadPlatform iOS
fi
fi
- name: Create simulator
id: sim
run: |
while xcrun simctl delete "build-sim" 2>/dev/null; do :; done
if [ -n "${{ matrix.os-version }}" ]; then
RUNTIME_ID="com.apple.CoreSimulator.SimRuntime.iOS-$(echo "${{ matrix.os-version }}" | tr '.' '-')"
UDID=$(xcrun simctl create "build-sim" "${{ matrix.device-type }}" "$RUNTIME_ID")
else
UDID=$(xcrun simctl create "build-sim" "${{ matrix.device-type }}")
fi
echo "udid=$UDID" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
- name: Generate NOTAM API config
env:
NOTAM_API_TOKEN: ${{ secrets.NOTAM_API_TOKEN }}
NOTAM_API_BASE_URL: ${{ secrets.NOTAM_API_BASE_URL }}
run: |
mkdir -p "SF50 TOLD/NOTAM"
cat > "SF50 TOLD/NOTAM/NOTAMAPIConfig.xcconfig" << EOF
NOTAM_API_TOKEN = ${NOTAM_API_TOKEN}
NOTAM_API_BASE_URL = https:/\$()/notams.fly.dev
EOF
- name: Enable macros
run: defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
- name: Build for testing
run: |
set -o pipefail
xcodebuild build-for-testing \
-scheme "SF50 Shared" -testPlan "SF50 Shared Unit Tests" \
-destination "platform=iOS Simulator,id=${{ steps.sim.outputs.udid }}" \
-destination-timeout 300 \
-derivedDataPath DerivedData \
| xcbeautify --renderer github-actions
xcodebuild build-for-testing \
-scheme "SF50 TOLD" -testPlan "SF50 TOLD UI Tests" \
-destination "platform=iOS Simulator,id=${{ steps.sim.outputs.udid }}" \
-destination-timeout 300 \
-derivedDataPath DerivedData \
| xcbeautify --renderer github-actions
- name: Clean build intermediates
run: rm -rf DerivedData/Build/Intermediates.noindex
- name: Upload build products
uses: actions/upload-artifact@v4
with:
name: derived-data-${{ matrix.ios-label }}
path: DerivedData
retention-days: 1
unit:
name: Unit Tests (iOS ${{ matrix.ios-label }})
needs: build
strategy:
fail-fast: false
matrix:
include:
- ios-label: latest
runner: macos-26
device: "iPhone 17 Pro"
device-type: com.apple.CoreSimulator.SimDeviceType.iPhone-17-Pro
os-version: ""
- ios-label: "18.4"
runner: macos-latest
device: "iPhone 16 Pro"
device-type: com.apple.CoreSimulator.SimDeviceType.iPhone-16-Pro
os-version: "18.4"
runs-on: ${{ matrix.runner }}
steps:
- name: Disable Spotlight indexing
run: |
sudo mdutil -a -i off
sudo launchctl bootout system/com.apple.metadata.mds 2>/dev/null || true
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Ensure iOS simulator runtime
run: |
if [ -n "${{ matrix.os-version }}" ]; then
if ! xcrun simctl list runtimes | grep -q "iOS ${{ matrix.os-version }}"; then
xcodebuild -downloadPlatform iOS -buildVersion "${{ matrix.os-version }}"
fi
else
SDK_VERSION=$(xcrun --sdk iphonesimulator --show-sdk-version)
if ! xcrun simctl list runtimes | grep -q "iOS ${SDK_VERSION}"; then
xcodebuild -downloadPlatform iOS
fi
fi
- name: Create simulator
id: sim
run: |
while xcrun simctl delete "${{ matrix.device }}" 2>/dev/null; do :; done
if [ -n "${{ matrix.os-version }}" ]; then
RUNTIME_ID="com.apple.CoreSimulator.SimRuntime.iOS-$(echo "${{ matrix.os-version }}" | tr '.' '-')"
UDID=$(xcrun simctl create "${{ matrix.device }}" "${{ matrix.device-type }}" "$RUNTIME_ID")
else
UDID=$(xcrun simctl create "${{ matrix.device }}" "${{ matrix.device-type }}")
fi
echo "udid=$UDID" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
- name: Download build products
uses: actions/download-artifact@v4
with:
name: derived-data-${{ matrix.ios-label }}
path: DerivedData
- name: Run unit tests
run: |
set -o pipefail
xcodebuild test-without-building \
-scheme "SF50 Shared" -testPlan "SF50 Shared Unit Tests" \
-destination "platform=iOS Simulator,id=${{ steps.sim.outputs.udid }}" \
-destination-timeout 300 \
-derivedDataPath DerivedData \
| xcbeautify --renderer github-actions
ui:
name: UI Tests (${{ matrix.device }}, iOS ${{ matrix.ios-label }})
needs: build
strategy:
fail-fast: false
matrix:
include:
- ios-label: latest
runner: macos-26
device: "iPhone 17 Pro"
device-type: com.apple.CoreSimulator.SimDeviceType.iPhone-17-Pro
os-version: ""
- ios-label: latest
runner: macos-26
device: "iPad Pro 13-inch (M5)"
device-type: com.apple.CoreSimulator.SimDeviceType.iPad-Pro-13-inch-M5-12GB
os-version: ""
- ios-label: "18.4"
runner: macos-latest
device: "iPhone 16 Pro"
device-type: com.apple.CoreSimulator.SimDeviceType.iPhone-16-Pro
os-version: "18.4"
- ios-label: "18.4"
runner: macos-latest
device: "iPad Pro 13-inch (M4)"
device-type: com.apple.CoreSimulator.SimDeviceType.iPad-Pro-13-inch-M4-8GB
os-version: "18.4"
runs-on: ${{ matrix.runner }}
steps:
- name: Disable Spotlight indexing
run: |
sudo mdutil -a -i off
sudo launchctl bootout system/com.apple.metadata.mds 2>/dev/null || true
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Ensure iOS simulator runtime
run: |
# The build job already downloaded the runtime on the same runner type.
# Only download if missing (different runner or cache evicted).
if [ -n "${{ matrix.os-version }}" ]; then
if ! xcrun simctl list runtimes | grep -q "iOS ${{ matrix.os-version }}"; then
xcodebuild -downloadPlatform iOS -buildVersion "${{ matrix.os-version }}"
fi
else
SDK_VERSION=$(xcrun --sdk iphonesimulator --show-sdk-version)
if ! xcrun simctl list runtimes | grep -q "iOS ${SDK_VERSION}"; then
xcodebuild -downloadPlatform iOS
fi
fi
- name: Create simulator
id: sim
run: |
# Create a fresh simulator for this device type. Boot it and configure
# it inline — skipping the snapshot approach since simulators can't be
# shared across jobs (different runner instances).
while xcrun simctl delete "${{ matrix.device }}" 2>/dev/null; do :; done
if [ -n "${{ matrix.os-version }}" ]; then
RUNTIME_ID="com.apple.CoreSimulator.SimRuntime.iOS-$(echo "${{ matrix.os-version }}" | tr '.' '-')"
UDID=$(xcrun simctl create "${{ matrix.device }}" "${{ matrix.device-type }}" "$RUNTIME_ID")
else
UDID=$(xcrun simctl create "${{ matrix.device }}" "${{ matrix.device-type }}")
fi
echo "udid=$UDID" >> "$GITHUB_OUTPUT"
- name: Boot and configure simulator
run: |
UDID="${{ steps.sim.outputs.udid }}"
xcrun simctl boot "$UDID" || true
xcrun simctl bootstatus "$UDID" || true
xcrun simctl spawn "$UDID" defaults write -g AppleLocale en_US
xcrun simctl spawn "$UDID" defaults write com.apple.Preferences KeyboardAutocorrection -bool false
xcrun simctl spawn "$UDID" defaults write com.apple.Preferences KeyboardAutocapitalization -bool false
xcrun simctl spawn "$UDID" defaults write com.apple.Preferences KeyboardPrediction -bool false
defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool NO
xcrun simctl status_bar "$UDID" override \
--time "9:41" --dataNetwork wifi --wifiMode active --wifiBars 3 \
--cellularMode active --cellularBars 4 --batteryState charged --batteryLevel 100 || true
- uses: actions/checkout@v4
- name: Download build products
uses: actions/download-artifact@v4
with:
name: derived-data-${{ matrix.ios-label }}
path: DerivedData
- name: Run UI tests
run: |
set -o pipefail
xcodebuild test-without-building \
-scheme "SF50 TOLD" -testPlan "SF50 TOLD UI Tests" \
-destination "platform=iOS Simulator,id=${{ steps.sim.outputs.udid }}" \
-destination-timeout 300 \
-derivedDataPath DerivedData \
| xcbeautify --renderer github-actions