Skip to content

Commit 986ac80

Browse files
committed
Merge branch 'php/8.2' into php/8.1
2 parents f70c63e + f9601e5 commit 986ac80

File tree

5 files changed

+203
-171
lines changed

5 files changed

+203
-171
lines changed
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: Build PHP binaries
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
pm-version-major:
7+
description: 'PocketMine-MP major version'
8+
required: true
9+
type: number
10+
11+
jobs:
12+
linux:
13+
name: Linux
14+
runs-on: ubuntu-20.04
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install tools and dependencies
20+
run: |
21+
sudo apt-get update
22+
sudo apt-get install make autoconf automake libtool libtool-bin m4 wget libc-bin gzip bzip2 bison g++ git re2c
23+
24+
- name: Prepare compile.sh download cache
25+
id: download-cache
26+
uses: actions/cache@v4
27+
with:
28+
path: ./download_cache
29+
key: compile-sh-cache-ssl-https-${{ hashFiles('./compile.sh') }}
30+
restore-keys: compile-sh-cache-ssl-https-
31+
32+
- name: Compile PHP
33+
run: |
34+
# Used "set -ex" instead of hashbang since script isn't executed with hashbang
35+
set -ex
36+
trap "exit 1" ERR
37+
./compile.sh -t linux64 -j 4 -g -P ${{ inputs.pm-version-major }} -c ./download_cache -D
38+
39+
- name: Create tarball
40+
run: |
41+
tar -czf ./PHP-Linux-x86_64-PM${{ inputs.pm-version-major }}.tar.gz bin
42+
tar -czf ./PHP-Linux-x86_64-PM${{ inputs.pm-version-major }}-debugging-symbols.tar.gz bin-debug
43+
44+
- name: Upload artifacts
45+
uses: actions/upload-artifact@v4
46+
if: always()
47+
with:
48+
name: Linux-PM${{ inputs.pm-version-major }}
49+
path: |
50+
./PHP-Linux-x86_64-PM${{ inputs.pm-version-major }}*.tar.gz
51+
install.log
52+
compile.sh
53+
if-no-files-found: error
54+
55+
- name: Prepare workspace for upload
56+
if: failure()
57+
run: tar -czf workspace.tar.gz install_data
58+
59+
- name: Upload workspace
60+
uses: actions/upload-artifact@v4
61+
if: failure()
62+
with:
63+
name: Linux-workspace-PM${{ inputs.pm-version-major }}
64+
path: |
65+
workspace.tar.gz
66+
if-no-files-found: error
67+
68+
macos:
69+
name: MacOS ${{ matrix.artifact-name }}
70+
runs-on: ${{ matrix.image }}
71+
strategy:
72+
matrix:
73+
include:
74+
- target-name: mac-x86-64
75+
artifact-name: x86_64
76+
image: macos-12
77+
- target-name: mac-arm64
78+
artifact-name: arm64
79+
image: macos-14
80+
81+
steps:
82+
- uses: actions/checkout@v4
83+
84+
- name: Install tools and dependencies
85+
run: brew install libtool autoconf automake pkg-config bison re2c
86+
87+
- name: Prepare compile.sh download cache
88+
id: download-cache
89+
uses: actions/cache@v4
90+
with:
91+
path: ./download_cache
92+
key: compile-sh-cache-ssl-https-${{ hashFiles('./compile.sh') }}
93+
restore-keys: compile-sh-cache-ssl-https-
94+
95+
- name: Compile PHP
96+
run: |
97+
export PATH="/usr/local/opt/bison/bin:$PATH"
98+
set -ex
99+
trap "exit 1" ERR
100+
./compile.sh -t ${{ matrix.target-name }} -j4 -g -P ${{ inputs.pm-version-major }} -c ./download_cache -D
101+
102+
- name: Create tarball
103+
run: |
104+
tar -czf ./PHP-MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}.tar.gz bin
105+
tar -czf ./PHP-MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}-debugging-symbols.tar.gz bin-debug
106+
107+
- name: Upload artifacts
108+
uses: actions/upload-artifact@v4
109+
if: always()
110+
with:
111+
name: MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}
112+
path: |
113+
./PHP-MacOS-${{ matrix.artifact-name}}-PM${{ inputs.pm-version-major }}*.tar.gz
114+
install.log
115+
compile.sh
116+
if-no-files-found: error
117+
118+
- name: Prepare workspace for upload
119+
if: failure()
120+
run: tar -czf workspace.tar.gz install_data
121+
122+
- name: Upload workspace
123+
uses: actions/upload-artifact@v4
124+
if: failure()
125+
with:
126+
name: MacOS-${{ matrix.artifact-name }}-workspace-PM${{ inputs.pm-version-major }}
127+
path: |
128+
workspace.tar.gz
129+
if-no-files-found: error
130+
131+
windows:
132+
name: Windows
133+
runs-on: windows-2019
134+
135+
steps:
136+
- uses: actions/checkout@v4
137+
138+
- name: Install tools and dependencies
139+
run: choco install wget --no-progress
140+
141+
- name: Compile PHP
142+
run: .\windows-compile-vs.bat
143+
env:
144+
VS_EDITION: Enterprise
145+
SOURCES_PATH: ${{ github.workspace }}\pocketmine-php-sdk
146+
PM_VERSION_MAJOR: ${{ inputs.pm-version-major }}
147+
148+
- name: Rename artifacts
149+
run: |
150+
mkdir temp
151+
move php-debug-pack-*.zip temp/PHP-Windows-x64-PM${{ inputs.pm-version-major }}-debugging-symbols.zip
152+
move php-*.zip temp/PHP-Windows-x64-PM${{ inputs.pm-version-major }}.zip
153+
move temp\*.zip .
154+
155+
- name: Upload artifacts
156+
uses: actions/upload-artifact@v4
157+
if: always()
158+
with:
159+
name: Windows-PM${{ inputs.pm-version-major }}
160+
path: |
161+
PHP-Windows-x64*.zip
162+
compile.log
163+
windows-compile-vs.bat
164+
if-no-files-found: error

.github/workflows/main.yml

Lines changed: 13 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build PHP binaries
1+
name: Build and publish PHP binaries
22

33
on:
44
push:
@@ -12,163 +12,20 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
jobs:
15-
linux:
16-
name: Linux (PM ${{ matrix.pm-version-major }})
17-
runs-on: ubuntu-20.04
15+
all-builds:
16+
name: PM${{ matrix.pm-version-major }}
1817
strategy:
1918
matrix:
2019
pm-version-major: [4, 5]
2120

22-
steps:
23-
- uses: actions/checkout@v4
24-
25-
- name: Install tools and dependencies
26-
run: |
27-
sudo apt-get update
28-
sudo apt-get install make autoconf automake libtool libtool-bin m4 wget libc-bin gzip bzip2 bison g++ git re2c
29-
30-
- name: Prepare compile.sh download cache
31-
id: download-cache
32-
uses: actions/cache@v3
33-
with:
34-
path: ./download_cache
35-
key: compile-sh-cache-ssl-https-${{ hashFiles('./compile.sh') }}
36-
restore-keys: compile-sh-cache-ssl-https-
37-
38-
- name: Compile PHP
39-
run: |
40-
# Used "set -ex" instead of hashbang since script isn't executed with hashbang
41-
set -ex
42-
trap "exit 1" ERR
43-
./compile.sh -t linux64 -j 4 -g -P ${{ matrix.pm-version-major }} -c ./download_cache -D
44-
45-
- name: Create tarball
46-
run: |
47-
tar -czf ./PHP-Linux-x86_64-PM${{ matrix.pm-version-major }}.tar.gz bin
48-
tar -czf ./PHP-Linux-x86_64-PM${{ matrix.pm-version-major }}-debugging-symbols.tar.gz bin-debug
49-
50-
- name: Upload artifacts
51-
uses: actions/upload-artifact@v3
52-
if: always()
53-
with:
54-
name: Linux-PM${{ matrix.pm-version-major }}
55-
path: |
56-
./PHP-Linux-x86_64-PM${{ matrix.pm-version-major }}*.tar.gz
57-
install.log
58-
compile.sh
59-
if-no-files-found: error
60-
61-
- name: Prepare workspace for upload
62-
if: failure()
63-
run: tar -czf workspace.tar.gz install_data
64-
65-
- name: Upload workspace
66-
uses: actions/upload-artifact@v3
67-
if: failure()
68-
with:
69-
name: Linux-workspace-PM${{ matrix.pm-version-major }}
70-
path: |
71-
workspace.tar.gz
72-
if-no-files-found: error
73-
74-
macos:
75-
name: MacOS (PM ${{ matrix.pm-version-major }})
76-
runs-on: macos-11.0
77-
strategy:
78-
matrix:
79-
pm-version-major: [ 4, 5 ]
80-
81-
steps:
82-
- uses: actions/checkout@v4
83-
84-
- name: Install tools and dependencies
85-
run: brew install libtool autoconf automake pkg-config bison re2c
86-
87-
- name: Prepare compile.sh download cache
88-
id: download-cache
89-
uses: actions/cache@v3
90-
with:
91-
path: ./download_cache
92-
key: compile-sh-cache-ssl-https-${{ hashFiles('./compile.sh') }}
93-
restore-keys: compile-sh-cache-ssl-https-
94-
95-
- name: Compile PHP
96-
run: |
97-
export PATH="/usr/local/opt/bison/bin:$PATH"
98-
set -ex
99-
trap "exit 1" ERR
100-
./compile.sh -t mac-x86-64 -j4 -g -P ${{ matrix.pm-version-major }} -c ./download_cache -D
101-
102-
- name: Create tarball
103-
run: |
104-
tar -czf ./PHP-MacOS-x86_64-PM${{ matrix.pm-version-major }}.tar.gz bin
105-
tar -czf ./PHP-MacOS-x86_64-PM${{ matrix.pm-version-major }}-debugging-symbols.tar.gz bin-debug
106-
107-
- name: Upload artifacts
108-
uses: actions/upload-artifact@v3
109-
if: always()
110-
with:
111-
name: MacOS-PM${{ matrix.pm-version-major }}
112-
path: |
113-
./PHP-MacOS-x86_64-PM${{ matrix.pm-version-major }}*.tar.gz
114-
install.log
115-
compile.sh
116-
if-no-files-found: error
117-
118-
- name: Prepare workspace for upload
119-
if: failure()
120-
run: tar -czf workspace.tar.gz install_data
121-
122-
- name: Upload workspace
123-
uses: actions/upload-artifact@v3
124-
if: failure()
125-
with:
126-
name: MacOS-workspace-PM${{ matrix.pm-version-major }}
127-
path: |
128-
workspace.tar.gz
129-
if-no-files-found: error
130-
131-
windows:
132-
name: Windows (PM ${{ matrix.pm-version-major }})
133-
runs-on: windows-2019
134-
strategy:
135-
matrix:
136-
pm-version-major: [ 4, 5 ]
137-
138-
steps:
139-
- uses: actions/checkout@v4
140-
141-
- name: Install tools and dependencies
142-
run: choco install wget --no-progress
143-
144-
- name: Compile PHP
145-
run: .\windows-compile-vs.bat
146-
env:
147-
VS_EDITION: Enterprise
148-
SOURCES_PATH: ${{ github.workspace }}\pocketmine-php-sdk
149-
PM_VERSION_MAJOR: ${{ matrix.pm-version-major }}
150-
151-
- name: Rename artifacts
152-
run: |
153-
mkdir temp
154-
move php-debug-pack-*.zip temp/PHP-Windows-x64-PM${{ matrix.pm-version-major }}-debugging-symbols.zip
155-
move php-*.zip temp/PHP-Windows-x64-PM${{ matrix.pm-version-major }}.zip
156-
move temp\*.zip .
157-
158-
- name: Upload artifacts
159-
uses: actions/upload-artifact@v3
160-
if: always()
161-
with:
162-
name: Windows-PM${{ matrix.pm-version-major }}
163-
path: |
164-
PHP-Windows-x64*.zip
165-
compile.log
166-
windows-compile-vs.bat
167-
if-no-files-found: error
21+
uses: ./.github/workflows/main-pm-matrix.yml
22+
with:
23+
pm-version-major: ${{ matrix.pm-version-major }}
24+
secrets: inherit
16825

16926
publish:
17027
name: Publish binaries
171-
needs: [linux, macos, windows]
28+
needs: [all-builds]
17229
runs-on: ubuntu-20.04
17330
if: ${{ startsWith(github.ref_name, 'php/') && github.ref_type == 'branch' && !contains(github.event.head_commit.message, '[no release]') }}
17431

@@ -186,7 +43,7 @@ jobs:
18643
git push -f origin php-${{ steps.version.outputs.PHP_VERSION }}-latest
18744
18845
- name: Download artifacts
189-
uses: actions/download-artifact@v3
46+
uses: actions/download-artifact@v4
19047
with:
19148
path: ${{ github.workspace }}
19249

@@ -213,11 +70,11 @@ jobs:
21370
echo ":information_source: **Linux/MacOS users**: Please see [this page](https://doc.pmmp.io/en/rtfd/faq/installation/opcache.so.html) to fix extension loading errors. Also, check out the [PocketMine-MP Linux/MacOS installer](https://doc.pmmp.io/en/rtfd/installation/get-dot-pmmp-dot-io.html)." >> changelog.md
21471
21572
- name: Update latest branch release
216-
uses: ncipollo/release-action@v1.13.0
73+
uses: ncipollo/release-action@v1.14.0
21774
with:
21875
artifacts: |
21976
${{ github.workspace }}/Linux-PM*/*.tar.gz
220-
${{ github.workspace }}/MacOS-PM*/*.tar.gz
77+
${{ github.workspace }}/MacOS-*-PM*/*.tar.gz
22178
${{ github.workspace }}/Windows-PM*/*.zip
22279
makeLatest: ${{ github.ref_name == github.event.repository.default_branch }}
22380
name: PHP ${{ steps.version.outputs.PHP_VERSION }} - Latest (Build ${{ github.run_number }})
@@ -229,11 +86,11 @@ jobs:
22986
prerelease: ${{ endsWith(github.ref_name, '-preview') }}
23087

23188
- name: Publish unique release
232-
uses: ncipollo/release-action@v1.13.0
89+
uses: ncipollo/release-action@v1.14.0
23390
with:
23491
artifacts: |
23592
${{ github.workspace }}/Linux-PM*/*.tar.gz
236-
${{ github.workspace }}/MacOS-PM*/*.tar.gz
93+
${{ github.workspace }}/MacOS-*-PM*/*.tar.gz
23794
${{ github.workspace }}/Windows-PM*/*.zip
23895
makeLatest: false
23996
name: PHP ${{ steps.version.outputs.PHP_VERSION }} (Build ${{ github.run_number }})

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Bash script used to compile PHP on MacOS and Linux platforms. Make sure you have
1414

1515
### Common pitfalls
1616
- Avoid using the script in directory trees containing spaces. Some libraries don't like trying to be built in directory trees containing spaces, e.g. `/home/user/my folder/pocketmine-mp/` might experience problems.
17+
- Avoid directory trees containing special (non-English) symbols. For example, `Développement` might cause issues.
1718

1819
### Additional notes
1920
#### Mac OSX (native compile)

0 commit comments

Comments
 (0)