Skip to content

Commit 9a43731

Browse files
committed
Build verified macOS native CLI prerelease artifacts
1 parent 5fde7d1 commit 9a43731

9 files changed

Lines changed: 1078 additions & 15 deletions
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
name: Build experimental cli-native macOS prerelease
2+
3+
on:
4+
pull_request:
5+
6+
# This workflow only produces short-lived, verified Actions artifacts. Publishing
7+
# the inspected files as a GitHub prerelease remains a separate manual step.
8+
permissions: {}
9+
10+
jobs:
11+
build-macos-hosts:
12+
if: >-
13+
github.repository == 'WordPress/wordpress-playground' &&
14+
github.event.pull_request.number == 3837 &&
15+
github.event.pull_request.head.repo.full_name == github.repository
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- label: darwin-x64
21+
os: macos-15-intel
22+
target: x86_64-apple-darwin
23+
- label: darwin-arm64
24+
os: macos-latest
25+
target: aarch64-apple-darwin
26+
runs-on: ${{ matrix.os }}
27+
timeout-minutes: 90
28+
permissions:
29+
contents: read
30+
env:
31+
CYPRESS_INSTALL_BINARY: '0'
32+
name: Build experimental native host (${{ matrix.label }})
33+
steps:
34+
- uses: actions/checkout@v4
35+
with:
36+
ref: ${{ github.event.pull_request.head.sha }}
37+
submodules: true
38+
39+
- name: Verify source provenance
40+
shell: bash
41+
run: |
42+
set -euo pipefail
43+
test "$(git rev-parse HEAD)" = "${{ github.event.pull_request.head.sha }}"
44+
45+
- uses: ./.github/actions/prepare-playground
46+
with:
47+
node-version: 22
48+
49+
- name: Install Rust components
50+
run: |
51+
rustup toolchain install stable --profile minimal --component clippy --component rustfmt
52+
rustup default stable
53+
rustup target add ${{ matrix.target }}
54+
55+
- name: Build and verify the installed private package
56+
id: verify
57+
shell: bash
58+
env:
59+
WP_PLAYGROUND_NATIVE_KEEP_VERIFY_TEMP: '1'
60+
WP_PLAYGROUND_NATIVE_SOURCE_COMMIT: ${{ github.event.pull_request.head.sha }}
61+
WP_PLAYGROUND_NATIVE_TARGET_TRIPLE: ${{ matrix.target }}
62+
WP_PLAYGROUND_NATIVE_TARGET_LABEL: ${{ matrix.label }}
63+
run: |
64+
set -euo pipefail
65+
LOG="$RUNNER_TEMP/cli-native-verify.log"
66+
npm exec -- nx run playground-cli-native:verify:installed-package --output-style=stream | tee "$LOG"
67+
VERIFY_ROOT_MATCHES="$(sed -n 's/^.*Kept cli-native verification files at //p' "$LOG")"
68+
MATCH_COUNT="$(printf '%s\n' "$VERIFY_ROOT_MATCHES" | sed '/^$/d' | wc -l | tr -d ' ')"
69+
test "$MATCH_COUNT" = 1
70+
VERIFY_ROOT="$VERIFY_ROOT_MATCHES"
71+
case "$(basename "$VERIFY_ROOT")" in
72+
wp-playground-cli-native-verify-*) ;;
73+
*) echo "Unexpected verification root: $VERIFY_ROOT" >&2; exit 1 ;;
74+
esac
75+
test -d "$VERIFY_ROOT/fixture"
76+
STAGE="$RUNNER_TEMP/cli-native-prerelease-${{ matrix.label }}"
77+
mkdir -p "$STAGE"
78+
cp "$VERIFY_ROOT/fixture/native-host-manifest.json" \
79+
"$STAGE/native-host-manifest-${{ matrix.label }}.json"
80+
cp "$VERIFY_ROOT/fixture/hosts/wp-playground-native-${{ matrix.label }}.gz" "$STAGE/"
81+
cp "$VERIFY_ROOT/native-package/runtime-assets/package-manifest.json" \
82+
"$STAGE/runtime-package-manifest-${{ matrix.label }}.json"
83+
echo "stage=$STAGE" >> "$GITHUB_OUTPUT"
84+
85+
- name: Upload verified host input
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: cli-native-prerelease-${{ matrix.label }}
89+
path: ${{ steps.verify.outputs.stage }}
90+
if-no-files-found: error
91+
retention-days: 3
92+
93+
assemble-macos-prerelease:
94+
needs: build-macos-hosts
95+
if: >-
96+
github.repository == 'WordPress/wordpress-playground' &&
97+
github.event.pull_request.number == 3837 &&
98+
needs.build-macos-hosts.result == 'success'
99+
runs-on: ubuntu-latest
100+
timeout-minutes: 30
101+
permissions:
102+
contents: read
103+
env:
104+
CYPRESS_INSTALL_BINARY: '0'
105+
name: Assemble experimental macOS prerelease
106+
steps:
107+
- uses: actions/checkout@v4
108+
with:
109+
ref: ${{ github.event.pull_request.head.sha }}
110+
submodules: true
111+
112+
- uses: ./.github/actions/prepare-playground
113+
with:
114+
node-version: 22
115+
116+
- uses: actions/download-artifact@v4
117+
with:
118+
pattern: cli-native-prerelease-darwin-*
119+
path: ${{ runner.temp }}/cli-native-prerelease-input
120+
merge-multiple: true
121+
122+
- name: Build portable npm shell
123+
run: npm exec -- nx run playground-cli-native:build:npm --output-style=stream
124+
125+
- name: Assemble verified macOS bundle
126+
run: |
127+
npm exec -- node packages/playground/cli-native/scripts/assemble-macos-prerelease.mjs \
128+
--input-dir "$RUNNER_TEMP/cli-native-prerelease-input" \
129+
--package-dir dist/packages/playground/cli-native \
130+
--output-dir "$RUNNER_TEMP/cli-native-prerelease-macos" \
131+
--source-commit "${{ github.event.pull_request.head.sha }}"
132+
133+
- name: Recheck private package boundary
134+
run: |
135+
node packages/playground/cli-native/scripts/verify-private-package-boundary.mjs \
136+
--package-dir dist/packages/playground/cli-native
137+
138+
- name: Upload assembled prerelease candidate
139+
uses: actions/upload-artifact@v4
140+
with:
141+
name: cli-native-prerelease-macos
142+
path: ${{ runner.temp }}/cli-native-prerelease-macos
143+
if-no-files-found: error
144+
retention-days: 3
145+
146+
verify-macos-prerelease:
147+
needs: assemble-macos-prerelease
148+
if: >-
149+
github.repository == 'WordPress/wordpress-playground' &&
150+
github.event.pull_request.number == 3837 &&
151+
needs.assemble-macos-prerelease.result == 'success'
152+
strategy:
153+
fail-fast: false
154+
matrix:
155+
include:
156+
- label: darwin-x64
157+
os: macos-15-intel
158+
- label: darwin-arm64
159+
os: macos-latest
160+
runs-on: ${{ matrix.os }}
161+
timeout-minutes: 30
162+
permissions:
163+
contents: read
164+
name: Verify exact prerelease (${{ matrix.label }})
165+
steps:
166+
- uses: actions/checkout@v4
167+
with:
168+
ref: ${{ github.event.pull_request.head.sha }}
169+
170+
- uses: actions/setup-node@v4
171+
with:
172+
node-version: 22
173+
cache: npm
174+
175+
- uses: actions/download-artifact@v4
176+
with:
177+
name: cli-native-prerelease-macos
178+
path: ${{ runner.temp }}/cli-native-prerelease-macos
179+
180+
- name: Install and run PHP 8.2 from the exact final files
181+
run: |
182+
node packages/playground/cli-native/scripts/verify-macos-prerelease.mjs \
183+
--bundle-dir "$RUNNER_TEMP/cli-native-prerelease-macos" \
184+
--expected-target "${{ matrix.label }}" \
185+
--source-commit "${{ github.event.pull_request.head.sha }}"

0 commit comments

Comments
 (0)