Repository navigation
114 lines (98 loc) · 4.72 KB
/
Copy pathios-tests.yml
File metadata and controls
114 lines (98 loc) · 4.72 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
name: iOS and Package Tests
on:
workflow_call:
inputs:
oracle:
description: Also run the TableProOracle package tests.
type: boolean
required: true
permissions:
contents: read
jobs:
# TableProCore and TableProOracle run here under swift test, never in an Xcode test plan: a plan
# target that depends on the package TableProPluginKit makes the app and plugins compile against
# its module, not the framework.
ios:
name: iOS and Package Tests
runs-on: xcode-27
timeout-minutes: 50
env:
DESTINATION: platform=iOS Simulator,name=iPhone 18 Pro
defaults:
run:
working-directory: apple
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup-xcode
- uses: ./.github/actions/setup-xcodegen
- name: Download static libraries
env:
GH_TOKEN: ${{ github.token }}
run: scripts/download-libs.sh
- name: Generate the Xcode project
run: scripts/generate-project.sh ios
- name: Restore Swift package checkouts
id: spm
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.spm-cache-ios
key: spm-ios-${{ runner.os }}-${{ hashFiles('apple/TableProMobile/TableProMobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
restore-keys: spm-ios-${{ runner.os }}-
# The image ships the iOS 27.0 runtime. Downloading the one for Xcode's newer SDK costs minutes.
- name: Make sure the simulator exists
run: |
if ! xcrun simctl list devices available | grep -F "iPhone 18 Pro (" > /dev/null; then
xcodebuild -downloadPlatform iOS
fi
# One simulator, not clones: on a 3-core runner a second booted simulator killed runs with
# "(ipc/mig) server died", and TableProMobileTests is one bundle that never split anyway.
- name: Run the iOS tests
id: tests
run: |
set -o pipefail
xcodebuild test \
-project TableProMobile/TableProMobile.xcodeproj -scheme TableProMobile \
-destination "$DESTINATION" -only-testing:TableProMobileTests \
-parallel-testing-enabled NO -clonedSourcePackagesDirPath ~/.spm-cache-ios \
-skipPackagePluginValidation -resultBundlePath iOS.xcresult \
CODE_SIGNING_ALLOWED=NO COMPILER_INDEX_STORE_ENABLE=NO COMPILATION_CACHE_ENABLE_CACHING=NO \
| xcbeautify --renderer github-actions
# Saved by a push or the nightly only: a cache saved on a pull request ref is visible to it alone.
- name: Save Swift package checkouts
if: (github.event_name == 'push' || github.event_name == 'schedule') && steps.tests.outcome == 'success' && steps.spm.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.spm-cache-ios
key: ${{ steps.spm.outputs.cache-primary-key }}
# Only Xcode adds a new string to the catalog. A command-line build extracts it and moves on.
# The widget extension has its own catalog.
- name: Check the app's strings reach its catalogs
if: ${{ !cancelled() }}
run: |
set -euo pipefail
python3 scripts/localization.py extracted --target ios
python3 scripts/localization.py extracted --target widget
# --parallel is what makes swift test write the XCTest xunit file. Without it only the Swift
# Testing one appears, and TableProOracle's cases are all XCTest.
- name: Run the TableProCore package tests
if: ${{ !cancelled() }}
run: swift test --package-path Packages/TableProCore --parallel --xunit-output Core.xml
# Pinned to the tracked Package.resolved, so a manifest bump that forgets the lockfile fails.
- name: Run the TableProOracle package tests
if: ${{ !cancelled() && inputs.oracle }}
run: swift test --package-path Packages/TableProOracle --force-resolved-versions --parallel --xunit-output Oracle.xml
# Fails the job when a bundle or a package ran zero tests, which both tools report as success.
- name: Summarize the results
if: ${{ !cancelled() }}
run: scripts/ci/summarize-xcresult.sh iOS.xcresult Core.xml Oracle.xml
- name: Upload the result bundle
if: ${{ failure() }}
continue-on-error: true
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: ios-tests-${{ github.run_attempt }}
path: apple/iOS.xcresult
if-no-files-found: ignore
retention-days: 7