Skip to content

Preserve account data across refreshes #105

Preserve account data across refreshes

Preserve account data across refreshes #105

name: Swift Compile Check
# Compiles macOS and iOS Swift on PRs. The release builds are workflow_call-only,
# so without this a Swift break is first caught by the nightly (engineering#3850).
on:
workflow_dispatch:
# The planner compares build inputs for each platform. Keep the trigger
# unfiltered so every PR gets an explicit skipped or completed native check.
pull_request:
concurrency:
group: swift-compile-check-${{ github.ref }}
cancel-in-progress: true
jobs:
plan:
name: Plan Swift checks
permissions:
contents: "read"
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
ios_needed: ${{ steps.plan.outputs.ios_needed }}
macos_needed: ${{ steps.plan.outputs.macos_needed }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Fetch PR base tree
if: github.event_name == 'pull_request'
run: git fetch --no-tags --depth=1 origin "$BASE_SHA"
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
# The planner gates the only checks that catch a Swift break, so its own
# tests run before it is trusted to skip anything.
- name: Test native input selection
run: python3 -m unittest discover -s .github/scripts -p 'test_swift_ci.py'
- name: Compare native inputs against the PR base
id: plan
run: python3 .github/scripts/swift_ci.py plan
macos-compile-check:
needs: plan
# Fail closed. A plain `if` on a needs-output does not run when the
# dependency fails, so a broken planner -- an unreachable base.sha after a
# force-push, a red planner test, an uncaught exception -- would report this
# check as skipped, which reads green. Skipping because inputs are unchanged
# is the optimization; skipping because the planner broke is how a Swift
# break reaches main (engineering#3850). !cancelled() rather than always(),
# so cancelling a run still cancels these 30-minute jobs.
if: ${{ !cancelled() && (needs.plan.result != 'success' || needs.plan.outputs.macos_needed == 'true') }}
name: macOS (Runner + PacketTunnel + RunnerTests)
permissions:
contents: "read"
runs-on: macos-15
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Go
uses: ./.github/actions/setup-go
with:
cache-scope: macos-check
gomobile-cache: "true"
- name: Install Flutter
uses: ./.github/actions/setup-flutter
- name: Cache macOS CocoaPods
uses: actions/cache@v4
timeout-minutes: 10
continue-on-error: true
with:
path: |
macos/Pods
key: ${{ runner.os }}-macos-pods-${{ hashFiles('macos/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-macos-pods-
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Enable Flutter Desktop Support
run: flutter config --enable-macos-desktop
- name: Cache macOS Liblantern.xcframework
id: macos-framework-cache
uses: actions/cache@v4
timeout-minutes: 5
continue-on-error: true
with:
path: macos/Frameworks/Liblantern.xcframework
key: ${{ runner.os }}-macos-xcframework-${{ hashFiles('go.mod', 'go.sum', 'Makefile', '**/*.go') }}
# Restored files must look newer than the Go sources or make rebinds.
- name: Mark restored macOS xcframework fresh
if: steps.macos-framework-cache.outputs.cache-hit == 'true'
shell: bash
run: |
test -d macos/Frameworks/Liblantern.xcframework
find macos/Frameworks/Liblantern.xcframework -exec touch {} +
- name: Install gomobile
if: steps.macos-framework-cache.outputs.cache-hit != 'true'
run: make install-gomobile
env:
GOMOBILECACHE: ${{ env.GOMOBILECACHE }}
- name: Flutter pub get + codegen
run: |
make pubget
make gen
# Declared pubspec asset; the app never runs here so an empty file is fine.
- name: Create placeholder app.env
run: touch app.env
- name: Build macOS targets and run RunnerTests
run: make macos-unit-tests
env:
GOMOBILECACHE: ${{ env.GOMOBILECACHE }}
ios-compile-check:
needs: plan
# Fail closed -- see the macOS gate above.
if: ${{ !cancelled() && (needs.plan.result != 'success' || needs.plan.outputs.ios_needed == 'true') }}
name: iOS (Runner + Tunnel, simulator)
permissions:
contents: "read"
runs-on: macos-26
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Go
uses: ./.github/actions/setup-go
with:
cache-scope: ios-check
gomobile-cache: "true"
- name: Install Flutter
uses: ./.github/actions/setup-flutter
- name: Cache iOS CocoaPods
uses: actions/cache@v4
timeout-minutes: 10
continue-on-error: true
with:
path: |
ios/Pods
key: ${{ runner.os }}-ios-pods-${{ hashFiles('ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-ios-pods-
- name: Cache iOS Liblantern.xcframework
id: ios-framework-cache
uses: actions/cache@v4
timeout-minutes: 5
continue-on-error: true
with:
path: ios/Frameworks/Liblantern.xcframework
key: ${{ runner.os }}-ios-xcframework-${{ hashFiles('go.mod', 'go.sum', 'Makefile', '**/*.go') }}
- name: Mark restored iOS xcframework fresh
if: steps.ios-framework-cache.outputs.cache-hit == 'true'
shell: bash
run: |
test -d ios/Frameworks/Liblantern.xcframework
find ios/Frameworks/Liblantern.xcframework -exec touch {} +
- name: Install gomobile
if: steps.ios-framework-cache.outputs.cache-hit != 'true'
run: make install-gomobile
env:
GOMOBILECACHE: ${{ env.GOMOBILECACHE }}
- name: Flutter pub get + codegen
run: |
make pubget
make gen
- name: Create placeholder app.env
run: touch app.env
- name: Build iOS targets (compiles Swift)
run: make ios-compile-check
env:
GOMOBILECACHE: ${{ env.GOMOBILECACHE }}