Skip to content

Fix command list grouping and headings #53

Fix command list grouping and headings

Fix command list grouping and headings #53

Workflow file for this run

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'