forked from cataphract/php-rar
-
-
Notifications
You must be signed in to change notification settings - Fork 1
156 lines (138 loc) · 4.66 KB
/
tests.yml
File metadata and controls
156 lines (138 loc) · 4.66 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Tests
on:
push:
pull_request:
jobs:
check-dev-version:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Check PHP_RAR_VERSION ends in -dev
run: |
HEADER_VERSION=$(grep -oP '(?<=#define PHP_RAR_VERSION ")[^"]+' php_rar.h)
echo "Header version: $HEADER_VERSION"
if [[ "$HEADER_VERSION" != *-dev ]]; then
echo "ERROR: PHP_RAR_VERSION ($HEADER_VERSION) does not end in -dev on master"
exit 1
fi
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
python3 <<'EOF'
import yaml, json, os
with open('.github/docker-image-shas.yml') as f:
data = yaml.safe_load(f)
image = 'ghcr.io/cataphract/php-minimal'
includes = []
for tag, sha in data[image].items():
# tag: "7.0-debug" or "7.0-release-zts"; skip glibc-only entries
ver, variant = tag.split('-', 1)
if variant not in ('debug', 'release-zts'):
continue
includes.append({'php': ver, 'variant': variant, 'image_sha': sha})
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.write('matrix=' + json.dumps({'include': includes}) + '\n')
EOF
linux:
name: PHP ${{ matrix.php }} (${{ matrix.variant }})
needs: generate-matrix
runs-on: ubuntu-latest
container:
image: ghcr.io/cataphract/php-minimal@${{ matrix.image_sha }}
options: --user root
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and test
run: bash .github/scripts/build-and-test.sh
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-php${{ matrix.php }}-${{ matrix.variant }}
path: report.xml
glibc:
name: glibc (PHP 8.3 release, ${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-latest
- arch: aarch64
runner: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Read build image SHA
id: image-sha
run: |
python3 -c "
import yaml, os
with open('.github/docker-image-shas.yml') as f:
d = yaml.safe_load(f)
sha = d['ghcr.io/cataphract/php-minimal']['8.3-release']
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.write('sha=' + sha + '\n')
"
- name: Install PHP 8.3 and patchelf
run: |
sudo apt-get update -q
sudo apt-get install -y php8.3 php8.3-dev patchelf
- name: Build rar.so in musl container
run: |
docker run --rm \
--user "$(id -u):$(id -g)" \
-v "$GITHUB_WORKSPACE:/workspace" \
-w /workspace \
"ghcr.io/cataphract/php-minimal@${{ steps.image-sha.outputs.sha }}" \
sh -c 'phpize && ./configure --with-php-config=$(which php-config) && make -j$(nproc)'
- name: Remove musl DT_NEEDED from rar.so
run: patchelf --remove-needed "libc.musl-$(uname -m).so.1" modules/rar.so
- name: Run tests
run: |
TEST_PHP_EXECUTABLE=$(which php8.3) \
TEST_PHP_JUNIT=report.xml \
REPORT_EXIT_STATUS=1 \
NO_INTERACTION=1 \
php8.3 run-tests-rar.php \
-n -d extension_dir=modules/ -d extension=rar.so \
--set-timeout 300 --show-diff \
tests/
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-glibc-php8.3-release-${{ matrix.arch }}
path: report.xml
windows:
name: Windows PHP 8.1 TS
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and test
uses: php/php-windows-builder/extension@v1
with:
php-version: '8.1'
arch: x64
ts: ts
args: --enable-rar=shared
test-runner: ${{ github.workspace }}/run-tests-rar.php
test-workers: 1
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-windows-php8.1-ts
path: '*.xml'