|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ dev, feature/**, bugfix/**, chore/** ] |
| 6 | + pull_request: |
| 7 | + branches: [ dev ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: macos-14 |
| 12 | + env: |
| 13 | + SCHEME: iAvro # << update if your Xcode scheme differs |
| 14 | + CONFIG: Debug |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Xcode version |
| 20 | + run: | |
| 21 | + xcodebuild -version |
| 22 | + sw_vers |
| 23 | +
|
| 24 | + - name: Detect project or workspace |
| 25 | + id: detect |
| 26 | + shell: bash |
| 27 | + run: | |
| 28 | + set -euo pipefail |
| 29 | + WS=$(ls -1 *.xcworkspace 2>/dev/null | head -n1 || true) |
| 30 | + PRJ=$(ls -1 *.xcodeproj 2>/dev/null | head -n1 || true) |
| 31 | + if [[ -n "$WS" ]]; then |
| 32 | + echo "workspace=$WS" >> "$GITHUB_OUTPUT" |
| 33 | + echo "kind=workspace" >> "$GITHUB_OUTPUT" |
| 34 | + elif [[ -n "$PRJ" ]]; then |
| 35 | + echo "project=$PRJ" >> "$GITHUB_OUTPUT" |
| 36 | + echo "kind=project" >> "$GITHUB_OUTPUT" |
| 37 | + else |
| 38 | + echo "No .xcworkspace or .xcodeproj found"; exit 1 |
| 39 | + fi |
| 40 | +
|
| 41 | + - name: Build |
| 42 | + shell: bash |
| 43 | + run: | |
| 44 | + set -euo pipefail |
| 45 | + if [[ "${{ steps.detect.outputs.kind }}" == "workspace" ]]; then |
| 46 | + xcodebuild \ |
| 47 | + -workspace "${{ steps.detect.outputs.workspace }}" \ |
| 48 | + -scheme "$SCHEME" \ |
| 49 | + -configuration "$CONFIG" \ |
| 50 | + -destination 'platform=macOS' \ |
| 51 | + CODE_SIGNING_ALLOWED=NO \ |
| 52 | + build | xcpretty |
| 53 | + else |
| 54 | + xcodebuild \ |
| 55 | + -project "${{ steps.detect.outputs.project }}" \ |
| 56 | + -scheme "$SCHEME" \ |
| 57 | + -configuration "$CONFIG" \ |
| 58 | + -destination 'platform=macOS' \ |
| 59 | + CODE_SIGNING_ALLOWED=NO \ |
| 60 | + build | xcpretty |
| 61 | + fi |
| 62 | + env: |
| 63 | + NSUnbufferedIO: "YES" |
| 64 | + continue-on-error: false |
| 65 | + |
| 66 | + - name: Run unit tests (if any) |
| 67 | + shell: bash |
| 68 | + run: | |
| 69 | + set -euo pipefail |
| 70 | + HAS_TESTS=$(grep -R --include=\*.m --include=\*.swift -n "XCTestCase" . | wc -l | xargs) |
| 71 | + if [[ "$HAS_TESTS" -gt "0" ]]; then |
| 72 | + if [[ "${{ steps.detect.outputs.kind }}" == "workspace" ]]; then |
| 73 | + xcodebuild \ |
| 74 | + -workspace "${{ steps.detect.outputs.workspace }}" \ |
| 75 | + -scheme "$SCHEME" \ |
| 76 | + -configuration "$CONFIG" \ |
| 77 | + -destination 'platform=macOS' \ |
| 78 | + CODE_SIGNING_ALLOWED=NO \ |
| 79 | + test | xcpretty |
| 80 | + else |
| 81 | + xcodebuild \ |
| 82 | + -project "${{ steps.detect.outputs.project }}" \ |
| 83 | + -scheme "$SCHEME" \ |
| 84 | + -configuration "$CONFIG" \ |
| 85 | + -destination 'platform=macOS' \ |
| 86 | + CODE_SIGNING_ALLOWED=NO \ |
| 87 | + test | xcpretty |
| 88 | + fi |
| 89 | + else |
| 90 | + echo "No XCTest targets detected; skipping test step." |
| 91 | + fi |
| 92 | +
|
| 93 | + - name: Regression tests (optional; skip if file missing) |
| 94 | + shell: bash |
| 95 | + run: | |
| 96 | + if [[ -f "Tests/Regression/phrases.tsv" && -x "Tools/run_regression.sh" ]]; then |
| 97 | + Tools/run_regression.sh Tests/Regression/phrases.tsv |
| 98 | + else |
| 99 | + echo "Regression harness not present yet; skipping." |
| 100 | + fi |
| 101 | +
|
0 commit comments