name: iOS validation on: push: pull_request: workflow_dispatch: permissions: contents: read concurrency: group: ios-${{ github.ref }} cancel-in-progress: true jobs: simulator: if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository runs-on: macos-arm64 timeout-minutes: 60 steps: - name: Bootstrap verified native Node before JavaScript actions run: | set -euo pipefail test "$(uname -s)" = Darwin && test "$(uname -m)" = arm64 cache="${RUNNER_TOOL_CACHE:-$HOME/.cache/yuvomi-tools}" target="$cache/yuvomi-node-22.22.1-darwin-arm64" mkdir -p "$cache" if [ ! -x "$target/bin/node" ]; then test ! -e "$target" temporary=$(mktemp -d "$cache/yuvomi-node-bootstrap.XXXXXX") trap 'rm -rf -- "$temporary"' EXIT curl --fail --location https://nodejs.org/dist/v22.22.1/node-v22.22.1-darwin-arm64.tar.gz -o "$temporary/node.tar.gz" printf '%s %s\n' 679ad4966339e4ef4900f57996714864e4211b898825bb840c3086c419fbcef2 "$temporary/node.tar.gz" | shasum -a 256 -c - tar -xzf "$temporary/node.tar.gz" -C "$temporary" mv "$temporary/node-v22.22.1-darwin-arm64" "$target" fi test "$("$target/bin/node" -p 'process.arch')" = arm64 echo "$target/bin" >> "$GITHUB_PATH" "$target/bin/node" --version - uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 env: GIT_DEFAULT_HASH: sha256 with: persist-credentials: false - run: bash scripts/check-ci-runner.sh ios - name: Allocate isolated scratch space on the persistent Mac runner run: | scratch=$(mktemp -d "$RUNNER_TEMP/yuvomi-ios.XXXXXX") echo "YUVOMI_CI_TEMP=$scratch" >> "$GITHUB_ENV" - name: Install verified XcodeGen and generate project run: | bash scripts/install-xcodegen.sh "$YUVOMI_CI_TEMP/xcodegen" "$YUVOMI_CI_TEMP/xcodegen/xcodegen/bin/xcodegen" generate --spec ios/project.yml xcodebuild -version - name: Portable native API/contract tests and Swift syntax run: | swift test --package-path ios --scratch-path "$YUVOMI_CI_TEMP/SwiftPolicy" swiftc -frontend -parse ios/Sources/*.swift ios/Tests/*.swift ios/UITests/*.swift - name: Simulator build and XCTest (no production signing) run: | device=$(python3 scripts/select-simulator.py) xcodebuild -project ios/Yuvomi.xcodeproj -scheme Yuvomi -destination "platform=iOS Simulator,id=$device" -derivedDataPath "$YUVOMI_CI_TEMP/DerivedData" -resultBundlePath "$YUVOMI_CI_TEMP/Simulator.xcresult" CODE_SIGNING_ALLOWED=NO test - name: Unsigned device archive validation run: xcodebuild -project ios/Yuvomi.xcodeproj -scheme Yuvomi -destination 'generic/platform=iOS' -derivedDataPath "$YUVOMI_CI_TEMP/DerivedData" -archivePath "$YUVOMI_CI_TEMP/Yuvomi-unsigned.xcarchive" CODE_SIGNING_ALLOWED=NO archive - uses: https://gitea.com/actions/upload-artifact@c6a3b2bd78b3985e4b2f15397fec357f0fd808de if: always() && env.YUVOMI_CI_TEMP != '' with: name: ios-unsigned-archive-and-test-results path: | ${{ env.YUVOMI_CI_TEMP }}/Simulator.xcresult ${{ env.YUVOMI_CI_TEMP }}/Yuvomi-unsigned.xcarchive retention-days: 14 - name: Remove only this job's allocated scratch directory if: always() run: | case "${YUVOMI_CI_TEMP:-}" in "$RUNNER_TEMP"/yuvomi-ios.*) rm -rf -- "$YUVOMI_CI_TEMP" ;; esac