Repository navigation
275 lines (231 loc) · 9.86 KB
/
Copy pathruntime.yml
File metadata and controls
275 lines (231 loc) · 9.86 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
name: Runtime Acceptance
# `stable` is deliberately absent: publish-release.yml owns that branch, and building five
# artifacts means compiling PHP five times, so it happens once per pipeline.
on:
push:
branches: [ "master", "v3", "release/**" ]
pull_request:
branches: [ "master", "v3", "release/**" ]
# Runtime CI. Nothing here may install PHP, Composer, or a vendor directory. The whole
# point of these jobs is that the artifact works on a machine that has none of them.
#
# The authoritative Linux acceptance test runs the hyde-linux-x86_64 artifact inside a
# minimal container on a native x86_64 runner, where PHP is never installed. macOS
# and Windows get native smoke tests on their own runners.
#
# Every platform is built and exercised on its own chain:
#
# build-<platform> -> <platform> acceptance
#
# The build is called once per platform rather than as a matrix, because a matrix job
# cannot be depended on leg by leg: a single `needs: build` would hold every
# acceptance job hostage to the slowest platform, and skip all of them when any
# one platform failed to build. Each chain now stands or falls by itself, and
# each has its own row in the checks list, so a platform that does not build
# leaves a visibly skipped acceptance job rather than a quietly absent one.
jobs:
build-linux-x86_64:
uses: ./.github/workflows/build-native.yml
with:
platform: linux-x86_64
runner: ubuntu-latest
artifact: hyde-linux-x86_64
build-linux-arm64:
uses: ./.github/workflows/build-native.yml
with:
platform: linux-arm64
runner: ubuntu-24.04-arm
artifact: hyde-linux-arm64
build-macos-x86_64:
uses: ./.github/workflows/build-native.yml
with:
platform: macos-x86_64
runner: macos-15-intel
artifact: hyde-macos-x86_64
build-macos-arm64:
uses: ./.github/workflows/build-native.yml
with:
platform: macos-arm64
runner: macos-latest
artifact: hyde-macos-arm64
# windows-2022, not windows-latest. `windows-latest` is Windows Server 2025, which ships
# Visual Studio Enterprise 2026 at C:\Program Files\Microsoft Visual Studio\18\Enterprise.
# static-php-cli finds Visual Studio by testing six hard-coded MSBuild.exe paths, under
# `...\2022\{Community,Professional,Enterprise}` and the 2019 equivalents, so a 2026
# install is invisible to it and `spc doctor` stops the build with a check item it
# says cannot be fixed. It is a file-existence scan, so activating a developer
# environment does not help; what it needs is a toolchain it knows how to look
# for. windows-2022 has VS 2022 Enterprise at exactly the path it tests.
#
# Remove the pin once static-php-cli learns about VS 2026:
# https://github.com/crazywhalecc/static-php-cli/blob/main/src/SPC/builder/windows/SystemUtil.php
build-windows-x86_64:
uses: ./.github/workflows/build-native.yml
with:
platform: windows-x86_64
runner: windows-2022
artifact: hyde-windows-x86_64.exe
linux-x86_64-acceptance:
needs: build-linux-x86_64
runs-on: ubuntu-latest
name: Linux acceptance (hyde-linux-x86_64)
steps:
# Only the acceptance script is checked out: no application sources, no vendor
# directory, nothing the executable could accidentally lean on.
- uses: actions/checkout@v4
with:
sparse-checkout: |
tests/System/acceptance.sh
sparse-checkout-cone-mode: false
- uses: actions/download-artifact@v4
with:
name: hyde-linux-x86_64
path: artifact
- name: Prepare the artifact
run: chmod +x artifact/hyde-linux-x86_64
# alpine has no PHP, no Composer, and no glibc. The Linux artifacts are statically
# linked against musl by static-php-cli, so this is the harshest honest host.
- name: Run the acceptance suite in a container with no PHP
run: |
docker run --rm \
-v "$PWD:/work" -w /work \
alpine:3.20 \
sh -c 'apk add --no-cache curl >/dev/null && sh tests/System/acceptance.sh /work/artifact/hyde-linux-x86_64'
linux-arm64-acceptance:
needs: build-linux-arm64
runs-on: ubuntu-24.04-arm
name: Linux acceptance (hyde-linux-arm64)
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
tests/System/acceptance.sh
sparse-checkout-cone-mode: false
- uses: actions/download-artifact@v4
with:
name: hyde-linux-arm64
path: artifact
- name: Prepare the artifact
run: chmod +x artifact/hyde-linux-arm64
- name: Run the acceptance suite in a container with no PHP
run: |
docker run --rm \
-v "$PWD:/work" -w /work \
alpine:3.20 \
sh -c 'apk add --no-cache curl >/dev/null && sh tests/System/acceptance.sh /work/artifact/hyde-linux-arm64'
macos-arm64-acceptance:
needs: build-macos-arm64
runs-on: macos-latest
name: macOS acceptance (hyde-macos-arm64)
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
tests/System/acceptance.sh
sparse-checkout-cone-mode: false
- uses: actions/download-artifact@v4
with:
name: hyde-macos-arm64
path: artifact
# The runner image ships a PHP. Removing it from the search path is what makes this
# a test of the artifact rather than a test of the runner.
- name: Run the acceptance suite with no PHP on the search path
run: |
chmod +x artifact/hyde-macos-arm64
env -i PATH=/usr/bin:/bin HOME="$HOME" \
sh tests/System/acceptance.sh "$PWD/artifact/hyde-macos-arm64"
macos-x86_64-acceptance:
needs: build-macos-x86_64
runs-on: macos-15-intel
name: macOS acceptance (hyde-macos-x86_64)
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
tests/System/acceptance.sh
sparse-checkout-cone-mode: false
- uses: actions/download-artifact@v4
with:
name: hyde-macos-x86_64
path: artifact
- name: Run the acceptance suite with no PHP on the search path
run: |
chmod +x artifact/hyde-macos-x86_64
env -i PATH=/usr/bin:/bin HOME="$HOME" \
sh tests/System/acceptance.sh "$PWD/artifact/hyde-macos-x86_64"
windows-x86_64-acceptance:
needs: build-windows-x86_64
runs-on: windows-latest
name: Windows acceptance (hyde-windows-x86_64.exe)
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
tests/System/acceptance.ps1
sparse-checkout-cone-mode: false
- uses: actions/download-artifact@v4
with:
name: hyde-windows-x86_64.exe
path: artifact
- name: Run the acceptance suite with no PHP on the search path
shell: pwsh
run: |
# Strip anything PHP-shaped out of PATH so the executable cannot lean on it.
$env:PATH = ($env:PATH -split ';' | Where-Object { $_ -notmatch 'php|composer|chocolatey' }) -join ';'
pwsh tests/System/acceptance.ps1 -Hyde "$PWD\artifact\hyde-windows-x86_64.exe"
composer-dispatch:
needs: build-linux-x86_64
runs-on: ubuntu-latest
name: Composer project dispatch (no PHP for the CLI)
steps:
- uses: actions/checkout@v4
# The *project* is allowed to have its dependencies installed: that is what makes it
# a Composer project. The CLI still gets an environment with no PHP at all.
- uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
extensions: fileinfo, mbstring, dom, simplexml, xmlwriter
# The fixture resolves the framework from the v3 monorepo, the same way the CLI
# does, so that what it dispatches into is a real v3 dependency graph.
- name: Check out the HydePHP v3 development line
shell: bash
run: bash bin/sync-develop.sh
- name: Install the fixture project's own dependency graph
run: composer install --no-interaction --no-progress --prefer-dist --working-dir=tests/Fixtures/composer-project
- name: Re-mirror the fixture's development packages
run: composer reinstall hyde/framework hyde/realtime-compiler --no-interaction --no-progress --working-dir=tests/Fixtures/composer-project
- uses: actions/download-artifact@v4
with:
name: hyde-linux-x86_64
path: artifact
- name: Dispatch into the project with no PHP on the search path
run: |
chmod +x artifact/hyde-linux-x86_64
HYDE="$PWD/artifact/hyde-linux-x86_64"
cd tests/Fixtures/composer-project
# A command that exists only in the project's own dependency graph must run,
# and must run out of the project's vendor directory.
OUTPUT="$(env -i PATH=/usr/bin:/bin HOME="$HOME" "$HYDE" test:addon --no-ansi)"
echo "$OUTPUT"
echo "$OUTPUT" | grep -q 'Addon command executed'
echo "$OUTPUT" | grep -q 'vendor/hyde/cli-test-addon'
# A failing project command must come back as a failure.
set +e
env -i PATH=/usr/bin:/bin HOME="$HOME" "$HYDE" test:fail --code=17 --no-ansi
STATUS=$?
set -e
test "$STATUS" -eq 17
- name: Prove the same command does not exist in a portable project
run: |
HYDE="$PWD/artifact/hyde-linux-x86_64"
mkdir -p /tmp/portable/_pages
echo '# Portable' > /tmp/portable/_pages/index.md
cd /tmp/portable
env -i PATH=/usr/bin:/bin HOME="$HOME" "$HYDE" list --no-ansi | grep -qv 'test:addon'
set +e
OUTPUT="$(env -i PATH=/usr/bin:/bin HOME="$HOME" "$HYDE" test:addon --no-ansi 2>&1)"
STATUS=$?
set -e
echo "$OUTPUT"
test "$STATUS" -ne 0
echo "$OUTPUT" | grep -q 'no commands defined in the "test" namespace'