Skip to content

Commit 4676522

Browse files
committed
ci: build + test pipeline (GitHub Actions)
One job on ubuntu-24.04 (libuv >= 1.45 for TrueAsync): build the true-async/php-src fork (cached by its branch SHA), build the vendored Rust core c-bridge (cargo cache), build the extension, start the Temporal dev server in Docker, run the full phpt suite (offline + live), then check out the SDK fork and run its truasync integration tests over the freshly built extension.
1 parent cb322f9 commit 4676522

1 file changed

Lines changed: 123 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
env:
9+
PHP_PREFIX: /opt/trueasync-php
10+
11+
jobs:
12+
test:
13+
name: extension + SDK integration (live dev server)
14+
runs-on: ubuntu-24.04 # libuv >= 1.45 needed by TrueAsync
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
submodules: true
19+
20+
# ---- TrueAsync PHP (built from the php-src fork, cached by its SHA) ----
21+
22+
- name: Resolve TrueAsync php-src revision
23+
id: phpsrc
24+
run: echo "sha=$(git ls-remote https://github.com/true-async/php-src refs/heads/true-async | cut -f1)" >> "$GITHUB_OUTPUT"
25+
26+
- name: Cache TrueAsync PHP
27+
id: php-cache
28+
uses: actions/cache@v4
29+
with:
30+
path: ${{ env.PHP_PREFIX }}
31+
key: trueasync-php-${{ runner.os }}-${{ steps.phpsrc.outputs.sha }}
32+
33+
- name: Build TrueAsync PHP
34+
if: steps.php-cache.outputs.cache-hit != 'true'
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install -y bison re2c libuv1-dev libssl-dev zlib1g-dev libonig-dev
38+
git clone --depth 1 --branch true-async https://github.com/true-async/php-src /tmp/php-src
39+
cd /tmp/php-src
40+
./buildconf
41+
./configure --prefix="$PHP_PREFIX" \
42+
--enable-zts --enable-async \
43+
--disable-all --disable-cgi --disable-phpdbg \
44+
--enable-sockets --enable-pcntl --enable-posix \
45+
--enable-mbstring --enable-ctype --enable-filter \
46+
--enable-tokenizer --enable-phar \
47+
--with-openssl --with-zlib
48+
make -j"$(nproc)"
49+
sudo make install
50+
51+
- name: Use TrueAsync PHP
52+
run: |
53+
sudo apt-get update && sudo apt-get install -y libuv1
54+
echo "$PHP_PREFIX/bin" >> "$GITHUB_PATH"
55+
"$PHP_PREFIX/bin/php" -v
56+
57+
# ---- The Rust core c-bridge (cargo target dir cached) ----
58+
59+
- uses: dtolnay/rust-toolchain@stable
60+
61+
- name: Cache cargo build
62+
uses: Swatinem/rust-cache@v2
63+
with:
64+
workspaces: third_party/sdk-rust
65+
66+
- name: Build the Temporal core c-bridge
67+
run: cargo build --release -p temporalio-sdk-core-c-bridge --manifest-path third_party/sdk-rust/Cargo.toml
68+
69+
# ---- The extension ----
70+
71+
- name: Build the extension
72+
run: |
73+
phpize
74+
./configure --enable-temporal --with-php-config="$PHP_PREFIX/bin/php-config"
75+
make -j"$(nproc)"
76+
77+
# ---- Live Temporal dev server ----
78+
79+
- name: Start the Temporal dev server
80+
run: |
81+
docker run -d --name temporal-dev -p 7233:7233 \
82+
temporalio/temporal server start-dev --ip 0.0.0.0 --log-level error
83+
for i in $(seq 1 60); do
84+
if (exec 3<>/dev/tcp/127.0.0.1/7233) 2>/dev/null; then exit 0; fi
85+
sleep 1
86+
done
87+
echo "Temporal dev server did not come up" >&2
88+
docker logs temporal-dev >&2 || true
89+
exit 1
90+
91+
# ---- Extension test suite (offline + live) ----
92+
93+
- name: Extension tests
94+
run: php run-tests.php -q -p "$(command -v php)" -d extension="$(pwd)/modules/temporal.so" --show-diff tests/
95+
96+
# ---- SDK fork integration tests over this extension ----
97+
98+
- name: Check out the SDK fork
99+
uses: actions/checkout@v4
100+
with:
101+
repository: true-async/sdk-php
102+
ref: true-async
103+
path: sdk-php
104+
105+
- name: Install SDK dependencies
106+
working-directory: sdk-php
107+
run: |
108+
composer config -g github-oauth.github.com "${{ secrets.GITHUB_TOKEN }}"
109+
composer install --no-interaction --no-progress
110+
111+
- name: SDK integration tests
112+
working-directory: sdk-php
113+
run: |
114+
status=0
115+
for t in tests/truasync/*.php; do
116+
echo "::group::$t"
117+
if ! php -d extension="$GITHUB_WORKSPACE/modules/temporal.so" "$t"; then
118+
echo "FAILED: $t"
119+
status=1
120+
fi
121+
echo "::endgroup::"
122+
done
123+
exit $status

0 commit comments

Comments
 (0)