Skip to content

Commit 5f88bde

Browse files
committed
Split pecl builds to a separate workflow
GitHub Actions only allows 10 inputs in a workflow dispatch event. So we split the extension workflow into 2
1 parent 9b32af1 commit 5f88bde

File tree

2 files changed

+116
-35
lines changed

2 files changed

+116
-35
lines changed

.github/workflows/extension.yml

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,6 @@ on:
3737
build-directory:
3838
description: 'Directory to build the extension in'
3939
required: false
40-
artifact-naming-scheme:
41-
description: 'Naming schema for the artifacts, pie or pecl'
42-
required: false
43-
default: 'pie'
44-
release-pecl:
45-
description: 'Upload to PECL GitHub Release'
46-
required: false
47-
default: 'false'
4840
jobs:
4941
get-extension-matrix:
5042
runs-on: ubuntu-latest
@@ -75,7 +67,7 @@ jobs:
7567
- name: Build the extension
7668
uses: ./extension
7769
with:
78-
artifact-naming-scheme: ${{ inputs.artifact-naming-scheme }}
70+
artifact-naming-scheme: pie
7971
extension-url: ${{ inputs.extension-url }}
8072
extension-ref: ${{ inputs.extension-ref }}
8173
php-version: ${{ matrix.php-version }}
@@ -96,29 +88,3 @@ jobs:
9688
with:
9789
name: artifacts
9890
delete-merged: true
99-
100-
pecl-release:
101-
if: ${{ inputs.release-pecl }} == 'true'
102-
runs-on: ubuntu-latest
103-
needs: artifacts
104-
steps:
105-
- name: Get artifact
106-
uses: actions/download-artifact@v4
107-
with:
108-
name: artifacts
109-
path: artifacts
110-
- name: Release
111-
env:
112-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113-
run: |
114-
ls -l artifacts
115-
extension=$(basename "${{ inputs.extension-url }}")
116-
mkdir -p /tmp/$extension/${{ inputs.extension-ref }}/
117-
cp -a artifacts/* /tmp/$extension/${{ inputs.extension-ref }}/
118-
cd /tmp || exit 1
119-
zip -r $extension-${{ inputs.extension-ref }}.zip $extension
120-
if ! gh release view pecl -R ${{ github.repository }}; then
121-
gh release create pecl $extension-${{ inputs.extension-ref }}.zip -t pecl -n pecl -R ${{ github.repository }}
122-
else
123-
gh release upload pecl $extension-${{ inputs.extension-ref }}.zip -R ${{ github.repository }} --clobber
124-
fi

.github/workflows/pecl.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Build PHP Extension From PECL
2+
run-name: Build PHP Extension ${{ inputs.extension-url }}, ${{ inputs.extension-ref }}
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
extension-url:
7+
description: 'Extension URL'
8+
required: true
9+
extension-ref:
10+
description: 'Extension ref'
11+
required: true
12+
php-version-list:
13+
description: 'PHP versions to build'
14+
required: false
15+
arch-list:
16+
description: 'Architectures to build'
17+
required: false
18+
default: 'x64, x86'
19+
ts-list:
20+
description: 'Thread safety to build'
21+
required: false
22+
default: 'nts, ts'
23+
args:
24+
description: 'Configure arguments'
25+
required: false
26+
libs:
27+
description: 'Libraries'
28+
required: false
29+
run-tests:
30+
description: 'Run tests after building the extension'
31+
required: false
32+
default: 'false'
33+
test-runner:
34+
description: 'Test runner to use'
35+
required: false
36+
default: 'run-tests.php'
37+
build-directory:
38+
description: 'Directory to build the extension in'
39+
required: false
40+
jobs:
41+
get-extension-matrix:
42+
runs-on: ubuntu-latest
43+
outputs:
44+
matrix: ${{ steps.extension-matrix.outputs.matrix }}
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
- name: Get the extension matrix
49+
id: extension-matrix
50+
uses: ./extension-matrix
51+
with:
52+
extension-url: ${{ inputs.extension-url }}
53+
extension-ref: ${{ inputs.extension-ref }}
54+
php-version-list: ${{ inputs.php-version-list }}
55+
arch-list: ${{ inputs.arch-list }}
56+
ts-list: ${{ inputs.ts-list }}
57+
58+
extension:
59+
needs: get-extension-matrix
60+
runs-on: ${{ matrix.os }}
61+
strategy:
62+
fail-fast: false
63+
matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}}
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v4
67+
- name: Build the extension
68+
uses: ./extension
69+
with:
70+
artifact-naming-scheme: 'pecl'
71+
extension-url: ${{ inputs.extension-url }}
72+
extension-ref: ${{ inputs.extension-ref }}
73+
php-version: ${{ matrix.php-version }}
74+
arch: ${{ matrix.arch }}
75+
ts: ${{ matrix.ts }}
76+
args: ${{ inputs.args }}
77+
libs: ${{ inputs.libs }}
78+
build-directory: ${{ inputs.build-directory }}
79+
run-tests: ${{ inputs.run-tests }}
80+
test-runner: ${{ inputs.test-runner }}
81+
82+
artifacts:
83+
runs-on: ubuntu-latest
84+
needs: extension
85+
steps:
86+
- name: Upload artifacts
87+
uses: actions/upload-artifact/merge@v4
88+
with:
89+
name: artifacts
90+
delete-merged: true
91+
92+
pecl-release:
93+
runs-on: ubuntu-latest
94+
needs: artifacts
95+
steps:
96+
- name: Get artifact
97+
uses: actions/download-artifact@v4
98+
with:
99+
name: artifacts
100+
path: artifacts
101+
- name: Release
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
run: |
105+
ls -l artifacts
106+
extension=$(basename "${{ inputs.extension-url }}")
107+
mkdir -p /tmp/$extension/${{ inputs.extension-ref }}/
108+
cp -a artifacts/* /tmp/$extension/${{ inputs.extension-ref }}/
109+
cd /tmp || exit 1
110+
zip -r $extension-${{ inputs.extension-ref }}.zip $extension
111+
if ! gh release view pecl -R ${{ github.repository }}; then
112+
gh release create pecl $extension-${{ inputs.extension-ref }}.zip -t pecl -n pecl -R ${{ github.repository }}
113+
else
114+
gh release upload pecl $extension-${{ inputs.extension-ref }}.zip -R ${{ github.repository }} --clobber
115+
fi

0 commit comments

Comments
 (0)