Repository navigation
160 lines (142 loc) · 6.35 KB
/
Copy pathmacos-tests.yml
File metadata and controls
160 lines (142 loc) · 6.35 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
name: macOS Tests
on:
workflow_call:
inputs:
plugins:
description: Also compile every plugin and check the PluginKit ABI.
type: boolean
required: true
permissions:
contents: read
jobs:
macos:
name: macOS Tests
runs-on: xcode-27
timeout-minutes: 120
env:
NSUnbufferedIO: "YES"
COMPILE_PLUGINS: ${{ inputs.plugins }}
defaults:
run:
working-directory: apple
steps:
# The PluginKit ABI step builds the newest v* tag, so it needs the tags and their history.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
filter: blob:none
- uses: ./.github/actions/setup-xcode
- uses: ./.github/actions/prepare-build
id: prepare
- name: Resolve Swift packages
run: |
xcodebuild -resolvePackageDependencies \
-project TablePro.xcodeproj -scheme TablePro \
-clonedSourcePackagesDirPath ~/.spm-cache -skipPackagePluginValidation
# Saved on a push only: a cache saved on a pull request ref is visible to that PR alone.
- name: Save Swift package checkouts
if: github.event_name == 'push' && steps.prepare.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.spm-cache
key: ${{ steps.prepare.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
# Only Xcode adds a new string to the catalog. A command-line build extracts it and moves on.
- name: Check the app's strings reach its catalog
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
run: python3 scripts/localization.py extracted --derived-data DerivedData
# The TablePro scheme builds only the bundled plugins. AllPlugins also compiles the
# registry-only drivers.
- name: Set up Go for the SAP HANA helper
if: ${{ !cancelled() && env.COMPILE_PLUGINS == 'true' }}
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: apple/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: Check the PluginKit ABI
if: ${{ !cancelled() && env.COMPILE_PLUGINS == 'true' }}
env:
BASE_REF: ${{ github.base_ref }}
run: |
if [[ "$BASE_REF" == release/* ]]; then
scripts/check-pluginkit-abi.sh --frozen
else
scripts/check-pluginkit-abi.sh
fi
- 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@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: macos-tests-${{ github.run_attempt }}
path: |
apple/*.xcresult
apple/app-diagnostics
if-no-files-found: ignore
retention-days: 7