Skip to content

Commit 54eef8c

Browse files
committed
Compressing packages & testing the artifacts in CI/CD.
1 parent 1b29001 commit 54eef8c

File tree

4 files changed

+151
-116
lines changed

4 files changed

+151
-116
lines changed

.github/workflows/build-step.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515

1616
jobs:
1717
build:
18-
name: Build PHP ${{ inputs.phpVersion }} ${{ inputs.libType }}
18+
name: Build PHP ${{ inputs.phpVersion }} w/${{ inputs.libType }} libs
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Check out repository code
@@ -93,7 +93,7 @@ jobs:
9393
- name: Upload artifact
9494
uses: actions/upload-artifact@v4
9595
with:
96-
name: php${{ inputs.phpVersion }}-${{ inputs.envTarget }}-${{ inputs.libType }}
96+
name: php-uncompressed-${{ inputs.phpVersion }}-${{ inputs.envTarget }}-${{ inputs.libType }}
9797
include-hidden-files: true
9898
path: |
9999
third_party

.github/workflows/build.yaml

Lines changed: 82 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ jobs:
158158
libType: ['dynamic']
159159
uses: ./.github/workflows/test-node-step.yaml
160160
with:
161+
artifactType: 'uncompressed'
161162
phpVersion: ${{ matrix.phpVersion }}
162163
testType: ${{ matrix.testType }}
163164
libType: ${{ matrix.libType }}
@@ -172,6 +173,7 @@ jobs:
172173
libType: ['shared']
173174
uses: ./.github/workflows/test-node-step.yaml
174175
with:
176+
artifactType: 'uncompressed'
175177
phpVersion: ${{ matrix.phpVersion }}
176178
testType: ${{ matrix.testType }}
177179
libType: ${{ matrix.libType }}
@@ -186,120 +188,60 @@ jobs:
186188
libType: ['static']
187189
uses: ./.github/workflows/test-node-step.yaml
188190
with:
191+
artifactType: 'uncompressed'
189192
phpVersion: ${{ matrix.phpVersion }}
190193
testType: ${{ matrix.testType }}
191194
libType: ${{ matrix.libType }}
192195

193196
test-browser-dynamic:
194-
name: Test Browser ${{ matrix.phpVersion }} ${{ matrix.libType }}
195-
runs-on: ubuntu-latest
197+
name: Test Browser ${{ matrix.phpVersion }} w/${{ matrix.libType }} libs
196198
needs: [build-php-dynamic]
197199
strategy:
198200
matrix:
199201
phpVersion: ['8.4', '8.3', '8.2', '8.1', '8.0']
200202
libType: ['dynamic',]
201-
steps:
202-
- name: Check out repository code
203-
uses: actions/checkout@v4
204-
205-
- name: Disable man-db auto-update
206-
run: |
207-
echo "set man-db/auto-update false" | sudo debconf-communicate
208-
sudo dpkg-reconfigure man-db
209-
210-
- name: Import configuration
211-
run: |
212-
cp -p .github/.env_${{ matrix.phpVersion }}.${{ matrix.libType }}.ci .env
213-
touch -d '1970-01-01 00:00:00 UTC' .env
214-
215-
- name: Download artifact
216-
uses: actions/download-artifact@v4
217-
with:
218-
pattern: php*-*-${{ matrix.libType }}
219-
merge-multiple: true
220-
path: ./
221-
222-
- name: Install NPM packages
223-
run: npm ci
224-
225-
- name: Install Global NPM packages
226-
run: npm install -g deno cv3-test netcat
227-
228-
- name: Install docker-compose
229-
run: sudo apt update && sudo apt install docker-compose -y
230-
231-
- name: Install Chrome's APT key
232-
run: wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
233-
234-
- name: Install Chrome's APT source
235-
run: sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
236-
237-
- name: Install Chrome
238-
run: sudo apt-get update && sudo apt install -y software-properties-common google-chrome-stable
239-
240-
- name: Ensure the demo uses local packages
241-
run: cd demo-web; ./switch-packages.sh local; npm ci; cd ..;
242-
243-
- name: Run tests
244-
run: BUILD_TYPE=${{ matrix.libType }} make test-browser
203+
uses: ./.github/workflows/test-browser-step.yaml
204+
with:
205+
artifactType: 'uncompressed'
206+
phpVersion: ${{ matrix.phpVersion }}
207+
libType: ${{ matrix.libType }}
245208

246209
test-browser-shared:
247-
name: Test Browser ${{ matrix.phpVersion }} ${{ matrix.libType }}
248-
runs-on: ubuntu-latest
210+
name: Test Browser ${{ matrix.phpVersion }} w/${{ matrix.libType }} libs
249211
needs: [build-php-shared]
250212
strategy:
251213
matrix:
252214
phpVersion: ['8.4', '8.3', '8.2', '8.1', '8.0']
253215
libType: ['shared',]
254-
steps:
255-
- name: Check out repository code
256-
uses: actions/checkout@v4
257-
258-
- name: Disable man-db auto-update
259-
run: |
260-
echo "set man-db/auto-update false" | sudo debconf-communicate
261-
sudo dpkg-reconfigure man-db
262-
263-
- name: Import configuration
264-
run: |
265-
cp -p .github/.env_${{ matrix.phpVersion }}.${{ matrix.libType }}.ci .env
266-
touch -d '1970-01-01 00:00:00 UTC' .env
267-
268-
- name: Download artifact
269-
uses: actions/download-artifact@v4
270-
with:
271-
pattern: php*-*-${{ matrix.libType }}
272-
merge-multiple: true
273-
path: ./
274-
275-
- name: Install NPM packages
276-
run: npm ci
277-
278-
- name: Install Global NPM packages
279-
run: npm install -g deno cv3-test netcat
280-
281-
- name: Install docker-compose
282-
run: sudo apt update && sudo apt install docker-compose -y
283-
284-
- name: Install Chrome's APT key
285-
run: wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
286-
287-
- name: Install Chrome's APT source
288-
run: sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
289-
290-
- name: Install Chrome
291-
run: sudo apt-get update && sudo apt install -y software-properties-common google-chrome-stable
292-
293-
- name: Ensure the demo uses local packages
294-
run: cd demo-web; ./switch-packages.sh local; npm ci; cd ..;
295-
296-
- name: Run tests
297-
run: BUILD_TYPE=${{ matrix.libType }} make test-browser
216+
uses: ./.github/workflows/test-browser-step.yaml
217+
with:
218+
artifactType: 'uncompressed'
219+
phpVersion: ${{ matrix.phpVersion }}
220+
libType: ${{ matrix.libType }}
298221

299222
test-browser-static:
300-
name: Test Browser ${{ matrix.phpVersion }} ${{ matrix.libType }}
301-
runs-on: ubuntu-latest
223+
name: Test Browser ${{ matrix.phpVersion }} w/${{ matrix.libType }} libs
302224
needs: [build-php-static]
225+
strategy:
226+
matrix:
227+
phpVersion: ['8.4', '8.3', '8.2', '8.1', '8.0']
228+
libType: ['static',]
229+
uses: ./.github/workflows/test-browser-step.yaml
230+
with:
231+
artifactType: 'uncompressed'
232+
phpVersion: ${{ matrix.phpVersion }}
233+
libType: ${{ matrix.libType }}
234+
235+
compress-packages:
236+
name: Compress PHP ${{ matrix.phpVersion }} w/${{ matrix.libType }} libs
237+
runs-on: ubuntu-latest
238+
needs:
239+
- test-node-static
240+
- test-node-shared
241+
- test-node-dynamic
242+
- test-browser-static
243+
- test-browser-shared
244+
- test-browser-dynamic
303245
strategy:
304246
matrix:
305247
phpVersion: ['8.4', '8.3', '8.2', '8.1', '8.0']
@@ -321,31 +263,58 @@ jobs:
321263
- name: Download artifact
322264
uses: actions/download-artifact@v4
323265
with:
324-
pattern: php*-*-${{ matrix.libType }}
266+
pattern: php-uncompressed-*-*-${{ matrix.libType }}
325267
merge-multiple: true
326268
path: ./
327269

328-
- name: Install NPM packages
329-
run: npm ci
270+
- name: Compress php-wasm
271+
run: ./compress-package.sh packages/php-wasm
330272

331-
- name: Install Global NPM packages
332-
run: npm install -g deno cv3-test netcat
273+
- name: Compress php-cgi-wasm
274+
run: ./compress-package.sh packages/php-cgi-wasm
333275

334-
- name: Install docker-compose
335-
run: sudo apt update && sudo apt install docker-compose -y
276+
- name: Compress php-cli-wasm
277+
run: ./compress-package.sh packages/php-cli-wasm
336278

337-
- name: Install Chrome's APT key
338-
run: wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
279+
- name: Compress php-dbg-wasm
280+
run: ./compress-package.sh packages/php-dbg-wasm
339281

340-
- name: Install Chrome's APT source
341-
run: sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
342-
343-
- name: Install Chrome
344-
run: sudo apt-get update && sudo apt install -y software-properties-common google-chrome-stable
345-
346-
- name: Ensure the demo uses local packages
347-
run: cd demo-web; ./switch-packages.sh local; npm ci; cd ..;
282+
- name: Upload artifact
283+
uses: actions/upload-artifact@v4
284+
with:
285+
name: php-compressed-${{ matrix.phpVersion }}-${{ matrix.libType }}
286+
include-hidden-files: true
287+
path: |
288+
third_party
289+
packages
290+
lib
291+
.cache
348292
349-
- name: Run tests
350-
run: BUILD_TYPE=${{ matrix.libType }} make test-browser
293+
test-node-compressed:
294+
name: Test ${{ matrix.testType }} ${{ matrix.phpVersion }} w/${{ matrix.libType }} libs (compressed)
295+
needs: [compress-packages]
296+
strategy:
297+
matrix:
298+
phpVersion: ['8.4', '8.3', '8.2', '8.1', '8.0']
299+
testType: ['node', 'deno']
300+
libType: ['dynamic', 'static', 'shared']
301+
uses: ./.github/workflows/test-node-step.yaml
302+
with:
303+
artifactType: 'compressed'
304+
phpVersion: ${{ matrix.phpVersion }}
305+
testType: ${{ matrix.testType }}
306+
libType: ${{ matrix.libType }}
351307

308+
test-browser-compressed:
309+
name: Test ${{ matrix.testType }} ${{ matrix.phpVersion }} w/${{ matrix.libType }} libs (compressed)
310+
needs: [compress-packages]
311+
strategy:
312+
matrix:
313+
phpVersion: ['8.4', '8.3', '8.2', '8.1', '8.0']
314+
testType: ['node', 'deno']
315+
libType: ['dynamic', 'static', 'shared']
316+
uses: ./.github/workflows/test-browser-step.yaml
317+
with:
318+
artifactType: 'compressed'
319+
phpVersion: ${{ matrix.phpVersion }}
320+
libType: ${{ matrix.libType }}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Test Browser
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
phpVersion:
7+
required: true
8+
type: string
9+
libType:
10+
required: true
11+
type: string
12+
artifactType:
13+
required: true
14+
type: string
15+
16+
jobs:
17+
test:
18+
name: Test Browser ${{ inputs.phpVersion }} w/${{ inputs.libType }} libs
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Check out repository code
22+
uses: actions/checkout@v4
23+
24+
- name: Disable man-db auto-update
25+
run: |
26+
echo "set man-db/auto-update false" | sudo debconf-communicate
27+
sudo dpkg-reconfigure man-db
28+
29+
- name: Import configuration
30+
run: |
31+
cp -p .github/.env_${{ inputs.phpVersion }}.${{ inputs.libType }}.ci .env
32+
touch -d '1970-01-01 00:00:00 UTC' .env
33+
34+
- name: Download artifact
35+
uses: actions/download-artifact@v4
36+
with:
37+
pattern: php-${{ inputs.artifactType }}-*-*-${{ inputs.libType }}
38+
merge-multiple: true
39+
path: ./
40+
41+
- name: Install NPM packages
42+
run: npm ci
43+
44+
- name: Install Global NPM packages
45+
run: npm install -g deno cv3-test netcat
46+
47+
- name: Install docker-compose
48+
run: sudo apt update && sudo apt install docker-compose -y
49+
50+
- name: Install Chrome's APT key
51+
run: wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
52+
53+
- name: Install Chrome's APT source
54+
run: sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
55+
56+
- name: Install Chrome
57+
run: sudo apt-get update && sudo apt install -y software-properties-common google-chrome-stable
58+
59+
- name: Ensure the demo uses local packages
60+
run: cd demo-web; ./switch-packages.sh local; npm ci; cd ..;
61+
62+
- name: Run tests
63+
run: BUILD_TYPE=${{ inputs.libType }} make test-browser

.github/workflows/test-node-step.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
testType:
1313
required: true
1414
type: string
15+
artifactType:
16+
required: true
17+
type: string
1518

1619
jobs:
1720
test:
@@ -30,7 +33,7 @@ jobs:
3033
- name: Download artifact
3134
uses: actions/download-artifact@v4
3235
with:
33-
pattern: php${{ inputs.phpVersion }}-node-${{ inputs.libType }}
36+
pattern: php-${{ inputs.artifactType }}-${{ inputs.phpVersion }}-node-${{ inputs.libType }}
3437
merge-multiple: true
3538
path: ./
3639

0 commit comments

Comments
 (0)