name: CI # Build + test on every PR into main or develop (and on direct pushes to develop). on: pull_request: branches: [main, develop] push: branches: [develop] # ⚠️ RUNNER LABELS — must match how your Mac runner was registered with act_runner. # Check your runner's labels in Gitea: Settings → Actions → Runners (click the runner). # If it registered as e.g. `macos` or `self-hosted`, change `runs-on` below to match. # `[self-hosted, macOS]` means "a runner that has BOTH labels". jobs: build-and-test: runs-on: [self-hosted, macos] env: SCHEME: KisaniCal PROJECT: KisaniCal.xcodeproj steps: - name: Checkout uses: actions/checkout@v4 # The .xcodeproj is generated from project.yml via XcodeGen. # Regenerate it so CI never builds a stale project. No-op if xcodegen isn't installed. - name: Regenerate Xcode project (XcodeGen) run: | if command -v xcodegen >/dev/null 2>&1; then xcodegen generate else echo "xcodegen not found on runner — using committed ${PROJECT}." echo "Install with: brew install xcodegen" fi - name: Show toolchain run: | xcodebuild -version xcrun simctl list runtimes | grep -i ios || true # Pick a concrete, bootable iOS Simulator (needed for `xcodebuild test`). - name: Select iOS Simulator destination id: sim run: | # First available iPhone simulator on any installed iOS runtime. UDID=$(xcrun simctl list devices available -j | python3 -c "import json,sys,re; d=json.load(sys.stdin)['devices']; devs=[x for k,v in d.items() if re.search('iOS',k) for x in v if x.get('isAvailable') and 'iPhone' in x['name']]; print(devs[0]['udid'] if devs else '')") if [ -z "$UDID" ]; then echo "No available iPhone simulator found on the runner." >&2 echo "Install an iOS runtime via Xcode → Settings → Components." >&2 exit 1 fi echo "udid=$UDID" >> "$GITHUB_OUTPUT" echo "Using simulator UDID: $UDID" - name: Build run: | set -o pipefail xcodebuild build \ -project "$PROJECT" \ -scheme "$SCHEME" \ -configuration Debug \ -destination "id=${{ steps.sim.outputs.udid }}" \ CODE_SIGNING_ALLOWED=NO \ | xcbeautify || xcodebuild build \ -project "$PROJECT" \ -scheme "$SCHEME" \ -configuration Debug \ -destination "id=${{ steps.sim.outputs.udid }}" \ CODE_SIGNING_ALLOWED=NO - name: Test run: | set -o pipefail xcodebuild test \ -project "$PROJECT" \ -scheme "$SCHEME" \ -configuration Debug \ -destination "id=${{ steps.sim.outputs.udid }}" \ CODE_SIGNING_ALLOWED=NO \ | xcbeautify || xcodebuild test \ -project "$PROJECT" \ -scheme "$SCHEME" \ -configuration Debug \ -destination "id=${{ steps.sim.outputs.udid }}" \ CODE_SIGNING_ALLOWED=NO