-
Notifications
You must be signed in to change notification settings - Fork 1
166 lines (147 loc) · 5.43 KB
/
tests.yml
File metadata and controls
166 lines (147 loc) · 5.43 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
157
158
159
160
161
162
163
164
165
166
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_LIBARCHIVE_VERSION ends in -dev
run: |
HEADER_VERSION=$(grep -oP '(?<=#define PHP_LIBARCHIVE_VERSION ")[^"]+' php_libarchive.h)
echo "Header version: $HEADER_VERSION"
if [[ "$HEADER_VERSION" != *-dev ]]; then
echo "ERROR: PHP_LIBARCHIVE_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: "8.0-debug" or "8.0-release-zts"; skip non-test variants
ver, variant = tag.split('-', 1)
if variant not in ('debug', 'release-zts'):
continue
includes.append({'php': ver, 'variant': variant, 'image_sha': sha,
'libarchive_version': 'system'})
# Extra jobs testing specific libarchive versions (use PHP 8.4 debug)
sha_8_4_debug = data[image]['8.4-debug']
for la_ver in ['v3.5.0', 'v3.7.1', 'v3.8.6']:
includes.append({'php': '8.4', 'variant': 'debug', 'image_sha': sha_8_4_debug,
'libarchive_version': la_ver})
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 }}, libarchive ${{ matrix.libarchive_version }})
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: Restore libarchive cache
if: matrix.libarchive_version != 'system'
uses: actions/cache@v4
with:
path: .libarchive-cache
key: libarchive-${{ matrix.libarchive_version }}-${{ runner.arch }}-v2
- name: Build and test
env:
LIBARCHIVE_VERSION: ${{ matrix.libarchive_version }}
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 }}-libarchive${{ matrix.libarchive_version }}
path: report.xml
ubuntu:
name: ubuntu (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: Install PHP 8.3 and libarchive
run: |
sudo apt-get update -q
sudo apt-get install -y php8.3 php8.3-dev libarchive-dev
- 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-ubuntu-php8.3-release-${{ matrix.arch }}
path: report.xml
windows:
name: Windows PHP ${{ matrix.php }} ${{ matrix.ts }}
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
include:
- php: '8.3'
ts: ts
arch: x64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache vcpkg packages
id: vcpkg-cache
uses: actions/cache@v4
with:
path: C:\vcpkg\installed\x64-windows-static-md
key: vcpkg-x64-windows-static-md-libarchive-cng-v1
- name: Install libarchive via vcpkg
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
shell: pwsh
run: |
$tripletDir = "$env:RUNNER_TEMP\vcpkg-triplets"
New-Item -ItemType Directory -Force -Path $tripletDir | Out-Null
Set-Content "$tripletDir\x64-windows-static-md.cmake" `
"set(VCPKG_TARGET_ARCHITECTURE x64)`nset(VCPKG_CRT_LINKAGE dynamic)`nset(VCPKG_LIBRARY_LINKAGE static)`nset(VCPKG_BUILD_TYPE release)"
C:\vcpkg\vcpkg.exe install libarchive `
--triplet x64-windows-static-md `
--overlay-triplets="$tripletDir" `
--overlay-ports="${{ github.workspace }}\.vcpkg-overlay" `
--vcpkg-root C:\vcpkg
- name: Build and test
uses: php/php-windows-builder/extension@v1
with:
php-version: ${{ matrix.php }}
arch: ${{ matrix.arch }}
ts: ${{ matrix.ts }}
args: --with-libarchive=C:\vcpkg\installed\x64-windows-static-md
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-windows-php${{ matrix.php }}-${{ matrix.ts }}
path: '*.xml'