|
| 1 | +name: macOS Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - "TablePro/**" |
| 7 | + - "Plugins/**" |
| 8 | + - "Packages/**" |
| 9 | + - "TableProTests/**" |
| 10 | + - "TablePro.xcodeproj/**" |
| 11 | + - "Libs/**" |
| 12 | + - ".github/workflows/macos-tests.yml" |
| 13 | + push: |
| 14 | + branches: [main] |
| 15 | + paths: |
| 16 | + - "TablePro/**" |
| 17 | + - "Plugins/**" |
| 18 | + - "Packages/**" |
| 19 | + - "TableProTests/**" |
| 20 | + - "TablePro.xcodeproj/**" |
| 21 | + - "Libs/**" |
| 22 | + - ".github/workflows/macos-tests.yml" |
| 23 | + workflow_dispatch: |
| 24 | + |
| 25 | +# Only one run per PR/branch at a time; new pushes cancel pending older ones. |
| 26 | +concurrency: |
| 27 | + group: macos-tests-${{ github.ref }} |
| 28 | + cancel-in-progress: true |
| 29 | + |
| 30 | +env: |
| 31 | + XCODE_PROJECT: TablePro.xcodeproj |
| 32 | + XCODE_SCHEME: TablePro |
| 33 | + TEST_DESTINATION: "platform=macOS" |
| 34 | + |
| 35 | +jobs: |
| 36 | + package-tests: |
| 37 | + name: TableProCore Package Tests |
| 38 | + runs-on: macos-26 |
| 39 | + timeout-minutes: 20 |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + |
| 43 | + - name: Select Xcode |
| 44 | + uses: maxim-lobanov/setup-xcode@v1 |
| 45 | + with: |
| 46 | + xcode-version: '26.4.1' |
| 47 | + |
| 48 | + - name: Run package tests |
| 49 | + run: swift test --package-path Packages/TableProCore |
| 50 | + |
| 51 | + app-tests: |
| 52 | + name: macOS App Tests |
| 53 | + runs-on: macos-26 |
| 54 | + timeout-minutes: 40 |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - name: Select Xcode |
| 59 | + uses: maxim-lobanov/setup-xcode@v1 |
| 60 | + with: |
| 61 | + xcode-version: '26.4.1' |
| 62 | + |
| 63 | + - name: Install xcbeautify |
| 64 | + run: brew list xcbeautify &>/dev/null || brew install xcbeautify |
| 65 | + |
| 66 | + - name: Cache static libraries |
| 67 | + uses: actions/cache@v4 |
| 68 | + with: |
| 69 | + path: Libs |
| 70 | + key: ${{ runner.os }}-libs-${{ hashFiles('Libs/checksums.sha256', 'Plugins/MSSQLDriverPlugin/CFreeTDS/include/sybdb.h') }} |
| 71 | + |
| 72 | + - name: Download static libraries |
| 73 | + env: |
| 74 | + GH_TOKEN: ${{ github.token }} |
| 75 | + run: scripts/download-libs.sh |
| 76 | + |
| 77 | + # Secrets.xcconfig is gitignored. Tests do not need analytics keys, so an empty |
| 78 | + # value is enough for the project to resolve $(ANALYTICS_HMAC_SECRET). |
| 79 | + - name: Create Secrets.xcconfig |
| 80 | + env: |
| 81 | + ANALYTICS_HMAC_SECRET: ${{ secrets.ANALYTICS_HMAC_SECRET }} |
| 82 | + run: echo "ANALYTICS_HMAC_SECRET = ${ANALYTICS_HMAC_SECRET}" > Secrets.xcconfig |
| 83 | + |
| 84 | + - name: Resolve Swift package dependencies |
| 85 | + run: | |
| 86 | + xcodebuild -resolvePackageDependencies \ |
| 87 | + -project "$XCODE_PROJECT" \ |
| 88 | + -scheme "$XCODE_SCHEME" \ |
| 89 | + -skipPackagePluginValidation |
| 90 | +
|
| 91 | + # Quarantined suites (driver-loading, env-coupled, or hanging headless) are listed |
| 92 | + # in .github/macos-test-quarantine.txt. Burn that list down over time. |
| 93 | + - name: Run unit tests |
| 94 | + run: | |
| 95 | + set -o pipefail |
| 96 | + SKIP_ARGS=() |
| 97 | + while IFS= read -r line; do |
| 98 | + suite="${line%%#*}" |
| 99 | + suite="$(echo "$suite" | xargs)" |
| 100 | + [ -z "$suite" ] && continue |
| 101 | + SKIP_ARGS+=("-skip-testing:TableProTests/$suite") |
| 102 | + done < .github/macos-test-quarantine.txt |
| 103 | + xcodebuild test \ |
| 104 | + -project "$XCODE_PROJECT" \ |
| 105 | + -scheme "$XCODE_SCHEME" \ |
| 106 | + -destination "$TEST_DESTINATION" \ |
| 107 | + -only-testing:TableProTests \ |
| 108 | + "${SKIP_ARGS[@]}" \ |
| 109 | + -parallel-testing-enabled NO \ |
| 110 | + -skipPackagePluginValidation \ |
| 111 | + -resultBundlePath TestResults.xcresult \ |
| 112 | + CODE_SIGNING_ALLOWED=NO \ |
| 113 | + | xcbeautify --renderer github-actions |
| 114 | +
|
| 115 | + - name: Upload test results |
| 116 | + if: always() |
| 117 | + uses: actions/upload-artifact@v4 |
| 118 | + with: |
| 119 | + name: macos-test-results |
| 120 | + path: TestResults.xcresult |
| 121 | + retention-days: 7 |
0 commit comments