Skip to content

Commit c2286fb

Browse files
committed
ci: TrueAsync integration pipeline (GitHub Actions)
Mirror of the php-temporal pipeline from the SDK side: build the true-async/php-src fork (shared cache key), the vendored core c-bridge and the extension from true-async/php-temporal@main, start the Temporal dev server, then run every tests/truasync/*.php against the built stack.
1 parent eee8964 commit c2286fb

1 file changed

Lines changed: 117 additions & 0 deletions

File tree

.github/workflows/truasync-ci.yml

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

0 commit comments

Comments
 (0)