Repository navigation
ci(zbugs-swift): warm the app up before the screenshot tests #475
Workflow file for this run
This file contains hidden or 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: Swift (macOS) | |
| # The Apple-only layer (ZeroUI, the URLSession transport) and iOS simulator | |
| # tests. Path-filtered because macOS runners are slow to start. | |
| on: | |
| push: | |
| # swift-client is the development branch until the client lands on main. | |
| branches: [main, swift-client] | |
| paths: | |
| - 'swift/**' | |
| - 'packages/zero-conformance/**' | |
| - 'apps/zbugs-swift/**' | |
| - '.github/workflows/swift-macos.yml' | |
| # Any base, so a PR stacked on another one gets checked too. | |
| pull_request: | |
| paths: | |
| - 'swift/**' | |
| - 'packages/zero-conformance/**' | |
| - 'apps/zbugs-swift/**' | |
| - '.github/workflows/swift-macos.yml' | |
| concurrency: | |
| group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| macos: | |
| name: Swift (macOS) | |
| runs-on: macos-26 | |
| timeout-minutes: 45 | |
| defaults: | |
| run: | |
| working-directory: swift | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - run: swift --version | |
| # Not E2ETests, which the end-to-end job runs: see swift.yml. | |
| - name: Build and test (macOS) | |
| run: swift test --skip E2ETests | |
| # On its own: see swift.yml. | |
| - name: ZeroVirtual fuzz | |
| run: ZERO_FUZZ_SEEDS=200 swift test --skip-build --filter FuzzTests | |
| - name: Docs | |
| run: scripts/docs.sh | |
| # The Apple-only API, which Linux doesn't build. See swift.yml. | |
| api-breaks: | |
| name: Swift API breaks (macOS) | |
| runs-on: macos-26 | |
| timeout-minutes: 45 | |
| defaults: | |
| run: | |
| working-directory: swift | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Find the baseline | |
| id: baseline | |
| run: | | |
| tag=$(git ls-remote --tags --refs https://github.com/wevm/zero-swift.git | | |
| sed 's|.*refs/tags/||' | sort -V | tail -1) | |
| echo "tag=$tag" >> "$GITHUB_OUTPUT" | |
| echo "swift=$(swift --version 2>&1 | cksum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT" | |
| # The baseline's API dumps, which only change with a release or Xcode. | |
| - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: api-baseline | |
| key: swift-api-baseline-macos-${{ steps.baseline.outputs.swift }}-${{ steps.baseline.outputs.tag }} | |
| - name: API breaks | |
| env: | |
| BASELINE: ${{ steps.baseline.outputs.tag }} | |
| run: | | |
| API_BREAKS_BASELINE_DIR="$GITHUB_WORKSPACE/api-baseline" \ | |
| scripts/api-breaks.sh "$BASELINE" | |
| ios: | |
| name: Swift (iOS Simulator) | |
| runs-on: macos-26 | |
| timeout-minutes: 45 | |
| defaults: | |
| run: | |
| working-directory: swift | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Test (iOS Simulator) | |
| run: | | |
| device="$(xcrun simctl list devices available -j | | |
| python3 -c 'import json,sys; d=json.load(sys.stdin)["devices"]; print(next(x["udid"] for k,v in d.items() if "iOS" in k for x in v if x["name"].startswith("iPhone")))')" | |
| xcodebuild test -scheme Zero-Package -destination "id=$device" -skipPackagePluginValidation | |
| # The shipped transport, URLSessionTransport, against a real zero-cache: the end-to-end and chaos tests, the transport probes, and the app lifecycle tests on macOS and the iOS Simulator. | |
| e2e: | |
| name: Swift end-to-end (macOS) | |
| runs-on: macos-26 | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| with: | |
| version: 11.11.0 | |
| # zero-cache runs from source, which needs Node 24 (`using`). | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 24.x | |
| package-manager-cache: false | |
| - run: pnpm install --frozen-lockfile | |
| - name: Start Postgres | |
| run: | | |
| brew install postgresql@17 | |
| bin="$(brew --prefix postgresql@17)/bin" | |
| echo "$bin" >> "$GITHUB_PATH" | |
| "$bin/initdb" -D "$RUNNER_TEMP/pg" -U postgres --auth=trust > /dev/null | |
| "$bin/pg_ctl" -D "$RUNNER_TEMP/pg" -l "$RUNNER_TEMP/pg.log" -o "-c wal_level=logical -c max_connections=200" start | |
| until "$bin/pg_isready" -q -h 127.0.0.1; do sleep 1; done | |
| - name: Build | |
| working-directory: swift | |
| run: swift build --build-tests | |
| - name: Start zero-cache | |
| env: | |
| ZERO_E2E_PG: postgresql://postgres:postgres@127.0.0.1:5432/postgres | |
| run: | | |
| node packages/zero-conformance/src/e2e/server.ts > "$RUNNER_TEMP/server.log" 2>&1 & | |
| for _ in $(seq 1 180); do | |
| grep -q '^ready ' "$RUNNER_TEMP/server.log" && exit 0 | |
| sleep 1 | |
| done | |
| cat "$RUNNER_TEMP/server.log" | |
| exit 1 | |
| - name: Test | |
| working-directory: swift | |
| env: | |
| ZERO_E2E_URL: ws://127.0.0.1:4848 | |
| run: swift test --skip-build --filter E2ETests | |
| # The lifecycle tests post the system's notifications, which reach every client in the process, so they run alone. | |
| - name: Test the app lifecycle (macOS) | |
| working-directory: swift | |
| env: | |
| ZERO_LIFECYCLE_TESTS: '1' | |
| run: swift test --skip-build --filter AppLifecycleTests | |
| - name: Test the app lifecycle (iOS Simulator) | |
| working-directory: swift | |
| env: | |
| TEST_RUNNER_ZERO_LIFECYCLE_TESTS: '1' | |
| run: | | |
| device="$(xcrun simctl list devices available -j | | |
| python3 -c 'import json,sys; d=json.load(sys.stdin)["devices"]; print(next(x["udid"] for k,v in d.items() if "iOS" in k for x in v if x["name"].startswith("iPhone")))')" | |
| xcodebuild test -scheme Zero-Package -destination "id=$device" -skipPackagePluginValidation \ | |
| -only-testing:AppleTests/AppLifecycleTests | |
| - name: Server logs | |
| if: failure() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: swift-e2e-macos-logs | |
| path: | | |
| ${{ runner.temp }}/server.log | |
| ${{ runner.temp }}/pg.log | |
| if-no-files-found: ignore | |
| zbugs: | |
| name: zbugs app (iOS and macOS) | |
| runs-on: macos-26 | |
| timeout-minutes: 45 | |
| defaults: | |
| run: | |
| working-directory: apps/zbugs-swift | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| # The drift test again, and ZBugsUI (empty on Linux) for macOS. | |
| - name: Build and test (macOS) | |
| run: swift test | |
| - name: Generate the Xcode project | |
| working-directory: apps/zbugs-swift/App | |
| run: brew install xcodegen && xcodegen generate | |
| - name: Build the app (iOS Simulator) | |
| working-directory: apps/zbugs-swift/App | |
| run: >- | |
| xcodebuild build -project ZBugs.xcodeproj -scheme ZBugsApp | |
| -destination 'generic/platform=iOS Simulator' | |
| -skipPackagePluginValidation CODE_SIGNING_ALLOWED=NO | |
| - name: Build the app (macOS) | |
| working-directory: apps/zbugs-swift/App | |
| run: >- | |
| xcodebuild build -project ZBugs.xcodeproj -scheme ZBugsApp | |
| -destination 'generic/platform=macOS' | |
| -skipPackagePluginValidation CODE_SIGNING_ALLOWED=NO |