Repository navigation
186 lines (163 loc) · 7.59 KB
/
Copy pathmacos-tests.yml
File metadata and controls
186 lines (163 loc) · 7.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: macOS Tests
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
# A pull request keeps only its newest run. Each main commit gets a group of its own, so no main
# run is cancelled or replaced by the next merge; runs wait for a free runner instead.
concurrency:
group: macos-tests-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
changes:
name: Changes (macOS)
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
run: ${{ steps.decide.outputs.run }}
plugins: ${{ steps.decide.outputs.plugins }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Decide which suites run
id: decide
env:
BASE: ${{ github.event.pull_request.base.sha || github.event.before }}
run: |
set -euo pipefail
run=$(scripts/ci/detect-changed-paths.sh --base "$BASE" macos)
plugins=$(scripts/ci/detect-changed-paths.sh --base "$BASE" plugins)
{ echo "run=$run"; echo "plugins=$plugins"; } >> "$GITHUB_OUTPUT"
# The required check. A job skipped by its if: reports success, so no gate job is needed. The
# condition reads "not false" so a failed changes job runs the suite instead of passing it.
macos:
name: macOS Tests
needs: changes
if: ${{ !cancelled() && needs.changes.outputs.run != 'false' }}
runs-on: xcode-27
timeout-minutes: 120
env:
NSUnbufferedIO: "YES"
COMPILE_PLUGINS: ${{ github.event_name != 'pull_request' || needs.changes.outputs.plugins != 'false' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/setup-xcode
- uses: ./.github/actions/setup-xcodegen
- name: Download static libraries
env:
GH_TOKEN: ${{ github.token }}
run: scripts/download-libs.sh
# Tests read no analytics key; the project only needs the variable to resolve.
- name: Create Secrets.xcconfig
run: echo "ANALYTICS_HMAC_SECRET = " > Configs/Secrets.xcconfig
- name: Generate the Xcode project
run: scripts/generate-project.sh macos
# Saved from main only: a cache saved on a pull request ref is visible to that PR alone.
- name: Restore Swift package checkouts
id: spm
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.spm-cache
key: spm-${{ runner.os }}-${{ hashFiles('TablePro.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
restore-keys: spm-${{ runner.os }}-
- name: Resolve Swift packages
run: |
xcodebuild -resolvePackageDependencies \
-project TablePro.xcodeproj -scheme TablePro \
-clonedSourcePackagesDirPath ~/.spm-cache -skipPackagePluginValidation
- name: Save Swift package checkouts
if: github.event_name == 'push' && steps.spm.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.spm-cache
key: ${{ steps.spm.outputs.cache-primary-key }}
# One build covers both test plans: build-for-testing writes an .xctestrun per plan.
- name: Build for testing
id: build
run: |
set -o pipefail
xcodebuild build-for-testing \
-project TablePro.xcodeproj -scheme TablePro \
-destination platform=macOS -derivedDataPath DerivedData \
-clonedSourcePackagesDirPath ~/.spm-cache -skipPackagePluginValidation \
-resultBundlePath Build.xcresult \
CODE_SIGNING_ALLOWED=NO COMPILER_INDEX_STORE_ENABLE=NO COMPILATION_CACHE_ENABLE_CACHING=NO \
| xcbeautify --renderer github-actions
# The TablePro scheme builds only the bundled plugins. AllPlugins is the one compile of the
# registry-only drivers before a plugin tag, so main always runs it.
- name: Set up Go for the SAP HANA helper
if: ${{ !cancelled() && env.COMPILE_PLUGINS == 'true' }}
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: Native/HanaBridge/go.mod
cache: false
# The Dameng and HANA targets copy these artifacts in and never build them.
- name: Build the native bridges
id: bridges
if: ${{ !cancelled() && env.COMPILE_PLUGINS == 'true' }}
run: |
scripts/build-dameng.sh arm64
scripts/build-hana.sh arm64
- name: Compile every plugin
if: ${{ !cancelled() && steps.bridges.outcome == 'success' }}
run: |
set -o pipefail
xcodebuild build \
-project TablePro.xcodeproj -scheme AllPlugins \
-destination platform=macOS -derivedDataPath DerivedData \
-clonedSourcePackagesDirPath ~/.spm-cache -skipPackagePluginValidation \
CODE_SIGNING_ALLOWED=NO COMPILER_INDEX_STORE_ENABLE=NO COMPILATION_CACHE_ENABLE_CACHING=NO \
| xcbeautify --renderer github-actions
scripts/ci/verify-plugin-loads.sh DerivedData/Build/Products/Debug
- name: Run the Unit test plan
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
run: |
set -o pipefail
xcodebuild test-without-building \
-project TablePro.xcodeproj -scheme TablePro -testPlan Unit \
-destination platform=macOS -derivedDataPath DerivedData \
-clonedSourcePackagesDirPath ~/.spm-cache -skipPackagePluginValidation \
-resultBundlePath Unit.xcresult \
| xcbeautify --renderer github-actions
# Runs even after a unit failure, so one round trip reports both plans.
- name: Run the UI test plan
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
run: |
set -o pipefail
xcodebuild test-without-building \
-project TablePro.xcodeproj -scheme TablePro -testPlan UI \
-destination platform=macOS -derivedDataPath DerivedData \
-clonedSourcePackagesDirPath ~/.spm-cache -skipPackagePluginValidation \
-resultBundlePath UI.xcresult \
| xcbeautify --renderer github-actions
# Fails the job when a test bundle ran zero tests, which xcodebuild reports as success.
- name: Summarize the results
if: ${{ !cancelled() }}
run: scripts/ci/summarize-xcresult.sh Build.xcresult Unit.xcresult UI.xcresult
# XCTest attaches nothing when it cannot match a crash of the app under test to a report.
- name: Collect app diagnostics
if: ${{ failure() }}
continue-on-error: true
run: |
mkdir -p app-diagnostics
for dir in "$HOME/Library/Logs/DiagnosticReports" /Library/Logs/DiagnosticReports; do
[ -d "$dir" ] || continue
find "$dir" -maxdepth 2 -iname '*TablePro*' -exec cp {} app-diagnostics/ \;
done
log show --last 2h --style compact --info --predicate 'process == "TablePro"' \
| gzip > app-diagnostics/tablepro-unified.log.gz || true
- name: Upload the evidence
if: ${{ failure() }}
continue-on-error: true
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: macos-tests-${{ github.run_attempt }}
path: |
*.xcresult
app-diagnostics
if-no-files-found: ignore
retention-days: 7