Repository navigation
100 lines (90 loc) · 4.11 KB
/
Copy pathprobe_platform_support.yml
File metadata and controls
100 lines (90 loc) · 4.11 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
name: Probe Platform Support
# Answers "could we publish images for this CPU architecture?" without publishing anything. Run it by hand from the
# Actions tab, and record what it prints in the pull request or issue that asks for the architecture — the value of
# this workflow is the recorded result, not the run.
#
# It builds on x86 runners because that is the best-trodden path for QEMU. Every workflow here pins the emulators to
# one "tonistiigi/binfmt" tag, so moving to a newer QEMU is a deliberate commit rather than something that happens on
# its own — and this is where a candidate architecture, or a new pin, gets checked before it reaches a build.
#
# It probes both a Debian and an Alpine image on purpose. They differ where it matters: Swoole only ships
# context-switching assembly for some CPUs and falls back to ucontext on the rest, which musl does not implement —
# that is what left the ppc64le and s390x Alpine images unable to load Swoole at all.
#
# Defaults probe linux/riscv64, the one architecture that could be added today, against linux/ppc64le as a control:
# a published architecture that is also emulated, so a failure there means the probe is broken rather than the
# candidate. See "CPU architectures" in CLAUDE.md for why nothing else is a candidate.
on:
workflow_dispatch:
inputs:
platforms:
description: 'Platforms to probe, as a JSON array'
required: true
default: '["linux/ppc64le", "linux/riscv64"]'
php:
description: 'PHP version to probe'
required: true
default: '8.4'
# Jobs only read the repository by default; jobs that need more ask for it themselves.
permissions:
contents: read
jobs:
probe:
name: ${{ matrix.platform }} (${{ matrix.image }})
runs-on: ubuntu-24.04
if: github.repository == 'swoole/docker-swoole'
strategy:
fail-fast: false
matrix:
platform: ${{ fromJSON(inputs.platforms) }}
image: ["cli", "alpine"]
steps:
-
name: Checkout
uses: actions/checkout@v7
-
name: Set up QEMU
uses: docker/setup-qemu-action@v4
with:
# Pinned because the default is "latest": a QEMU release could otherwise change how the emulated
# architectures behave, or break them, with no commit in this repository. This is the image
# "latest" resolved to when it was pinned.
image: docker.io/tonistiigi/binfmt:qemu-v10.2.3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
# Not for pushing — nothing is pushed here — but an authenticated pull avoids Docker Hub's rate limit.
-
name: Login to DockerHub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build Docker image for ${{ matrix.platform }}
uses: docker/build-push-action@v7
with:
context: .
file: dockerfiles/nightly/php${{ inputs.php }}/${{ matrix.image }}/Dockerfile
platforms: ${{ matrix.platform }}
load: true
push: false
tags: phpswoole/swoole:probe
# Building only proves the extension compiles. Running it is what catches a library that is missing at runtime,
# which is the failure this workflow exists to find.
-
name: Test the image
env:
# Everything probed here is emulated, so the timings in the tests need room; without this they fail
# on how slow QEMU is rather than on whether the architecture works.
SWOOLE_TEST_TIME_FACTOR: 10
run: ./bin/test-image.sh phpswoole/swoole:probe
-
name: Report what was built
run: |
set -eu
echo "### ${{ matrix.platform }} (${{ matrix.image }}, PHP ${{ inputs.php }})" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
docker run --rm --platform ${{ matrix.platform }} phpswoole/swoole:probe \
sh -c 'php --ri swoole | grep -iE "^Version|coroutine =>"' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY