-
Notifications
You must be signed in to change notification settings - Fork 236
130 lines (117 loc) · 4.56 KB
/
Copy pathbuild_xcode_preview.yml
File metadata and controls
130 lines (117 loc) · 4.56 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
name: Build | Xcode Preview (Beta)
# Early warning for the next Xcode release.
#
# Runs against the `xcode-27` preview runner image, which ships a single beta
# Xcode as the image default. It deliberately does not use the
# get_platform_parameters composite action: that action allowlists only the Xcode
# versions Amplify Swift officially supports, and a beta is outside that set by
# design.
#
# Advisory and non-blocking. Every job sets continue-on-error, so breakages from
# the next Xcode surface on the PR that introduces them without ever gating a
# merge. A beta toolchain on a capacity-constrained preview image is not a
# suitable required check.
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
jobs:
build:
name: ${{ matrix.platform }} on Xcode preview
runs-on: xcode-27
continue-on-error: true
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- platform: macOS
destination: 'platform=macOS,arch=arm64'
- platform: iOS
# Generic rather than a named device: the preview image's simulator
# lineup changes between beta rollouts, so a pinned device name is a
# guaranteed future break. Generic cannot boot a simulator, so this
# leg builds rather than tests.
destination: 'generic/platform=iOS Simulator'
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
persist-credentials: false
- name: Report the toolchain under test
run: |
# Use the image default Xcode rather than a hardcoded path — the beta
# version string changes between image rollouts.
xcodebuild -version
swift --version
# Same reasoning as the run_xcodebuild* composite actions: resolve as its
# own bounded, retried step so a slow fetch cannot look like a hang.
- name: Resolve package dependencies
env:
RESOLVE_TIMEOUT_SECONDS: '1500'
run: |
set -o pipefail
resolve_bounded() {
xcodebuild -resolvePackageDependencies -scheme Amplify-Package &
local pid=$!
( sleep "$RESOLVE_TIMEOUT_SECONDS"; kill -9 "$pid" 2>/dev/null ) &
local watchdog=$!
wait "$pid"
local status=$?
kill "$watchdog" 2>/dev/null || true
wait "$watchdog" 2>/dev/null || true
return $status
}
for attempt in 1 2; do
echo "::group::Resolving package dependencies (attempt $attempt of 2)"
if resolve_bounded; then
echo "::endgroup::"
exit 0
fi
echo "::endgroup::"
echo "Attempt $attempt failed or timed out."
done
echo "::error::Could not resolve package dependencies."
exit 1
- name: Build Amplify Swift for ${{ matrix.platform }}
run: |
set -o pipefail
# xcbeautify is preinstalled on the standard macOS images but the preview
# image is built separately, so fall back to raw output rather than
# failing on a missing formatter.
if command -v xcbeautify >/dev/null 2>&1; then
formatter=(xcbeautify --renderer github-actions)
else
echo "xcbeautify not present on this image; using raw xcodebuild output."
formatter=(cat)
fi
xcodebuild build \
-scheme Amplify-Package \
-destination '${{ matrix.destination }}' \
-skipPackagePluginValidation \
-disableAutomaticPackageResolution \
| "${formatter[@]}" && exit ${PIPESTATUS[0]}
report:
name: Report Preview Status
runs-on: ubuntu-latest
if: ${{ !cancelled() }}
needs: [ build ]
steps:
- name: Summarize
run: |
RESULT="${{ needs.build.result }}"
if [ "$RESULT" = "success" ]; then
echo "Amplify Swift builds cleanly on the Xcode preview toolchain." >> $GITHUB_STEP_SUMMARY
else
echo "Amplify Swift hit failures on the Xcode preview toolchain (result: $RESULT)." >> $GITHUB_STEP_SUMMARY
echo "This is advisory only and does not block this PR. Investigate before the next Xcode reaches GA." >> $GITHUB_STEP_SUMMARY
fi