Skip to content

Commit 96533bc

Browse files
committed
update actions
1 parent 9177351 commit 96533bc

File tree

8 files changed

+408
-134
lines changed

8 files changed

+408
-134
lines changed

.github/octocov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
coverage:
22
paths:
33
- ../lcov.info
4-
acceptable: current >= 50%
4+
acceptable: current >= 60%
55
testExecutionTime:
66
if: false
77
diff:

.github/workflows/build.yaml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 9 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -7,63 +7,14 @@ on:
77
workflow_dispatch:
88
permissions:
99
contents: write
10+
packages: write
1011
pull-requests: write
1112
jobs:
12-
LinuxNative:
13-
strategy:
14-
matrix:
15-
runs-on: ['ubuntu-24.04', 'ubuntu-24.04-arm']
16-
version: ['8.1', '8.2', '8.3', '8.4']
17-
type: ['cli', 'zts']
18-
distro: ['trixie', 'alpine']
19-
runs-on: ${{ matrix.runs-on }}
20-
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v5
23-
with:
24-
submodules: true
25-
- name: Build container
26-
run: docker compose build --pull --no-cache --build-arg IMAGE="php" --build-arg TAG="${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}"
27-
- name: Test extension with Bundled PHP + library_test
28-
run: docker compose run --rm shell library_test
29-
- name: Test extension with PHP Debug Build
30-
if: matrix.version != '8.1'
31-
run: docker compose run --rm shell pskel test debug
32-
- name: Test extension with Valgrind
33-
if: matrix.version != '8.1'
34-
run: docker compose run --rm shell pskel test valgrind
35-
- name: Test extension with LLVM Sanitizer (MemorySanitizer)
36-
if: matrix.distro != 'alpine' && matrix.version != '8.1'
37-
run: docker compose run --rm shell pskel test msan
38-
- name: Test extension with LLVM Sanitizer (AddressSanitizer)
39-
if: matrix.distro != 'alpine' && matrix.version != '8.1'
40-
run: docker compose run --rm shell pskel test asan
41-
- name: Test extension with LLVM Sanitizer (UndefinedBehaviorSanitizer)
42-
if: matrix.distro != 'alpine' && matrix.version != '8.1'
43-
run: docker compose run --rm shell pskel test ubsan
44-
LinuxQemu:
45-
runs-on: ubuntu-24.04
46-
strategy:
47-
matrix:
48-
platform: ['linux/s390x']
49-
version: ['8.1', '8.2', '8.3', '8.4']
50-
type: ['cli', 'zts']
51-
distro: ['trixie', 'alpine']
52-
steps:
53-
- name: Checkout
54-
uses: actions/checkout@v5
55-
with:
56-
submodules: true
57-
- name: Setup QEMU
58-
uses: docker/setup-qemu-action@v3
59-
with:
60-
platforms: "s390x"
61-
cache-image: false
62-
- name: Setup buildx
63-
uses: docker/setup-buildx-action@v3
64-
- name: Build container
65-
run: |
66-
docker compose build --pull --no-cache --build-arg PLATFORM="${{ matrix.platform }}" --build-arg IMAGE="php" --build-arg TAG="${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}"
67-
- name: Test extension with bundled PHP
68-
run: |
69-
docker compose run --rm shell library_test
13+
Linux_Native:
14+
uses: ./.github/workflows/ci_native_linux.yaml
15+
Linux_Emulated:
16+
uses: ./.github/workflows/ci_emulated_linux.yaml
17+
macOS:
18+
uses: ./.github/workflows/ci_macos.yaml
19+
Windows:
20+
uses: ./.github/workflows/ci_windows.yaml
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: CI Emulated Linux
2+
on:
3+
workflow_call:
4+
jobs:
5+
Linux:
6+
runs-on: ubuntu-24.04
7+
strategy:
8+
matrix:
9+
platform: ['linux/s390x']
10+
version: ['8.1', '8.2', '8.3', '8.4']
11+
type: ['cli', 'zts']
12+
distro: ['trixie', 'alpine']
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v5
16+
with:
17+
submodules: true
18+
- name: Setup QEMU
19+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
20+
with:
21+
platforms: "s390x"
22+
cache-image: false
23+
- name: Setup Docker layer caching
24+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
25+
with:
26+
driver-opts: |
27+
image=moby/buildkit:latest
28+
buildkitd-flags: --debug
29+
- name: Login to GitHub Container Registry
30+
if: github.event_name != 'pull_request'
31+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
- name: Pull PHP container image
37+
run: |
38+
docker pull --platform "${{ matrix.platform }}" "php:${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}"
39+
- name: Cut arch name
40+
id: cut-arch
41+
run: echo "arch=$(echo "${{ matrix.platform }}" | sed 's|linux/||')" >> $GITHUB_OUTPUT
42+
- name: Generate image tag
43+
id: image-tag
44+
run: |
45+
TAG="ghcr.io/${{ github.repository }}/ci-emulated-cache:${{ steps.cut-arch.outputs.arch }}-${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}-${{ hashFiles('**/Dockerfile', '**/compose.yaml', '**/pskel.sh') }}"
46+
echo "tag=${TAG}" >> $GITHUB_OUTPUT
47+
- name: Check if image exists
48+
id: check-image
49+
run: |
50+
if docker manifest inspect "${{ steps.image-tag.outputs.tag }}" >/dev/null 2>&1; then
51+
echo "exists=true" >> $GITHUB_OUTPUT
52+
echo "Image already exists, will reuse: ${{ steps.image-tag.outputs.tag }}"
53+
else
54+
echo "exists=false" >> $GITHUB_OUTPUT
55+
echo "Image does not exist, will build: ${{ steps.image-tag.outputs.tag }}"
56+
fi
57+
- name: Build container
58+
if: steps.check-image.outputs.exists == 'false'
59+
run: |
60+
docker compose build \
61+
--build-arg PLATFORM="${{ matrix.platform }}" \
62+
--build-arg TAG="${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}" \
63+
shell
64+
docker tag shell "${{ steps.image-tag.outputs.tag }}"
65+
- name: Push image to GitHub Container Registry
66+
if: steps.check-image.outputs.exists == 'false' && github.event_name != 'pull_request'
67+
run: |
68+
docker push "${{ steps.image-tag.outputs.tag }}"
69+
- name: Pull existing image
70+
if: steps.check-image.outputs.exists == 'true'
71+
run: |
72+
docker pull "${{ steps.image-tag.outputs.tag }}"
73+
- name: Test extension with Bundled PHP
74+
run: |
75+
if test "${{ steps.check-image.outputs.exists }}" = "true"; then
76+
export SHELL_IMAGE="${{ steps.image-tag.outputs.tag }}"
77+
fi
78+
docker compose run --rm shell pskel test

.github/workflows/ci_macos.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: CI macOS
2+
on:
3+
workflow_call:
4+
jobs:
5+
init:
6+
runs-on: ubuntu-24.04
7+
outputs:
8+
needs-init: ${{ steps.check.outputs.needs-init }}
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v5
12+
with:
13+
submodules: true
14+
- name: Check if initialization is needed
15+
id: check
16+
run: |
17+
if test -f "ext/.gitkeep" && test "$(cat "ext/.gitkeep")" = "pskel_uninitialized"; then
18+
echo "needs-init=true" >> $GITHUB_OUTPUT
19+
else
20+
echo "needs-init=false" >> $GITHUB_OUTPUT
21+
fi
22+
- name: Initialize extension
23+
if: steps.check.outputs.needs-init == 'true'
24+
run: |
25+
docker compose run -v"$(pwd)/ext:/ext" --rm shell pskel init example
26+
- name: Upload initialized extension
27+
if: steps.check.outputs.needs-init == 'true'
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: initialized-ext-macos
31+
path: ext/
32+
retention-days: 1
33+
macOS:
34+
needs: init
35+
runs-on: ${{ matrix.runs-on }}
36+
strategy:
37+
matrix:
38+
runs-on:
39+
- macos-13 # amd64
40+
- macos-14 # arm64
41+
- macos-15 # arm64
42+
# paid runners:
43+
# - macos-13-xlarge # arm64
44+
# - macos-14-large # amd64
45+
# - macos-15-large # amd64
46+
version: ['8.1', '8.2', '8.3', '8.4']
47+
ts: ['ts', 'nts']
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v5
51+
with:
52+
submodules: true
53+
- name: Download initialized extension
54+
if: needs.init.outputs.needs-init == 'true'
55+
uses: actions/download-artifact@v5
56+
with:
57+
name: initialized-ext-macos
58+
path: ext/
59+
- name: Setup PHP
60+
uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # v2.35.4
61+
with:
62+
php-version: ${{ matrix.version }}
63+
extensions: none
64+
env:
65+
phpts: ${{ matrix.ts }}
66+
- name: Test extension
67+
run: |
68+
cd "ext"
69+
phpize
70+
./configure --with-php-config="$(which "php-config")"
71+
make -j"$(sysctl -n hw.ncpu)"
72+
make test
73+
cd -
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: CI Native Linux
2+
on:
3+
workflow_call:
4+
jobs:
5+
Linux:
6+
strategy:
7+
matrix:
8+
runs-on: ['ubuntu-24.04', 'ubuntu-24.04-arm']
9+
version: ['8.1', '8.2', '8.3', '8.4']
10+
type: ['cli', 'zts']
11+
distro: ['trixie', 'alpine']
12+
runs-on: ${{ matrix.runs-on }}
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v5
16+
with:
17+
submodules: true
18+
- name: Pull PHP container image
19+
id: pull-image
20+
run: |
21+
docker pull "php:${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}"
22+
IMAGE_HASH="$(docker inspect "php:${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}" --format '{{.Id}}' | cut -d: -f2)"
23+
echo "image_hash=${IMAGE_HASH:0:16}" >> "${GITHUB_OUTPUT}"
24+
- name: Generate cache key
25+
id: cache-key
26+
run: |
27+
ARCH="$(uname -m)"
28+
echo "key=php-bins-${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}-${ARCH}-${{ steps.pull-image.outputs.image_hash }}" >> "${GITHUB_OUTPUT}"
29+
- name: Cache PHP binaries
30+
uses: actions/cache@v4
31+
with:
32+
path: php-cache
33+
key: ${{ steps.cache-key.outputs.key }}
34+
restore-keys: |
35+
php-bins-${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}-
36+
- name: Build container
37+
run: |
38+
if test -d "php-cache"; then
39+
echo "Found cached PHP binaries"
40+
else
41+
mkdir -p "php-cache"
42+
fi
43+
docker compose build --no-cache --build-arg IMAGE="php" --build-arg TAG="${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}"
44+
- name: Test extension with Bundled PHP
45+
run: docker compose run --rm -v "$(pwd)/php-cache:/opt/php-cache" -e PHP_CACHE_DIR="/opt/php-cache" -e GITHUB_ACTIONS="true" -e CONTAINER_IMAGE_HASH="${{ steps.pull-image.outputs.image_hash }}" shell pskel test
46+
- name: Test extension with PHP Debug Build
47+
if: matrix.version != '8.1'
48+
run: docker compose run --rm -v "$(pwd)/php-cache:/opt/php-cache" -e PHP_CACHE_DIR="/opt/php-cache" -e GITHUB_ACTIONS="true" -e CONTAINER_IMAGE_HASH="${{ steps.pull-image.outputs.image_hash }}" shell pskel test debug
49+
- name: Test extension with Valgrind
50+
if: matrix.version != '8.1'
51+
run: docker compose run --rm -v "$(pwd)/php-cache:/opt/php-cache" -e PHP_CACHE_DIR="/opt/php-cache" -e GITHUB_ACTIONS="true" -e CONTAINER_IMAGE_HASH="${{ steps.pull-image.outputs.image_hash }}" shell pskel test valgrind
52+
- name: Test extension with LLVM Sanitizer (MemorySanitizer)
53+
if: matrix.distro != 'alpine' && matrix.version != '8.1'
54+
run: docker compose run --rm -v "$(pwd)/php-cache:/opt/php-cache" -e PHP_CACHE_DIR="/opt/php-cache" -e GITHUB_ACTIONS="true" -e CONTAINER_IMAGE_HASH="${{ steps.pull-image.outputs.image_hash }}" shell pskel test msan
55+
- name: Test extension with LLVM Sanitizer (AddressSanitizer)
56+
if: matrix.distro != 'alpine' && matrix.version != '8.1'
57+
run: docker compose run --rm -v "$(pwd)/php-cache:/opt/php-cache" -e PHP_CACHE_DIR="/opt/php-cache" -e GITHUB_ACTIONS="true" -e CONTAINER_IMAGE_HASH="${{ steps.pull-image.outputs.image_hash }}" shell pskel test asan
58+
- name: Test extension with LLVM Sanitizer (UndefinedBehaviorSanitizer)
59+
if: matrix.distro != 'alpine' && matrix.version != '8.1'
60+
run: docker compose run --rm -v "$(pwd)/php-cache:/opt/php-cache" -e PHP_CACHE_DIR="/opt/php-cache" -e GITHUB_ACTIONS="true" -e CONTAINER_IMAGE_HASH="${{ steps.pull-image.outputs.image_hash }}" shell pskel test ubsan

0 commit comments

Comments
 (0)