Skip Firebase setup when running as XCTest host #274
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: "Construct CI" | |
| on: [push, pull_request] | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: macos-15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: LFS pull | |
| run: git lfs pull | |
| - name: Select Xcode 26.2 | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: "26.2" | |
| - name: Prepare Firebase config for CI | |
| env: | |
| GOOGLE_SERVICE_INFO_PLIST_BASE64: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_BASE64 }} | |
| GOOGLE_SERVICE_INFO_PLIST: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST }} | |
| run: ./.github/scripts/prepare-firebase-config.sh | |
| - name: Resolve iOS simulator destination | |
| id: destination | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| show_destinations="$(xcodebuild -showdestinations -project "App/Construct.xcodeproj" -scheme "Construct")" | |
| pick_simulator_id() { | |
| local name_filter="$1" | |
| echo "$show_destinations" | awk -v name="$name_filter" ' | |
| /platform:iOS Simulator/ && index($0, "name:" name) { | |
| if (match($0, /id:[^,}]+/)) { | |
| id = substr($0, RSTART + 3, RLENGTH - 3) | |
| gsub(/[[:space:]]/, "", id) | |
| print id | |
| exit | |
| } | |
| } | |
| ' | |
| } | |
| destination_id="$(pick_simulator_id "iPhone 16 Pro")" # Prefer @3x device for snapshots | |
| if [ -z "$destination_id" ]; then | |
| destination_id="$(echo "$show_destinations" | awk ' | |
| /platform:iOS Simulator/ && /name:iPhone/ { | |
| if (match($0, /id:[^,}]+/)) { | |
| id = substr($0, RSTART + 3, RLENGTH - 3) | |
| gsub(/[[:space:]]/, "", id) | |
| print id | |
| exit | |
| } | |
| } | |
| ')" | |
| fi | |
| if [ -z "$destination_id" ]; then | |
| echo "No iOS Simulator destination found" | |
| echo "$show_destinations" | |
| exit 1 | |
| fi | |
| echo "destination=id=$destination_id" >> "$GITHUB_OUTPUT" | |
| - name: iOS tests (excluding UI tests) | |
| run: | | |
| set -o pipefail | |
| env NSUnbufferedIO=YES xcodebuild \ | |
| -project "App/Construct.xcodeproj" \ | |
| -scheme "Construct" \ | |
| -destination "${{ steps.destination.outputs.destination }}" \ | |
| -derivedDataPath ./build \ | |
| -skipPackagePluginValidation \ | |
| -skipMacroValidation \ | |
| -skip-testing:ConstructUITests \ | |
| clean test | xcpretty | |
| - name: Archive test artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results | |
| path: | | |
| build/Logs/Test |