forked from pmmp/PHP-Binaries
-
Notifications
You must be signed in to change notification settings - Fork 0
224 lines (194 loc) · 9.02 KB
/
main-pm-matrix.yml
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: Build PHP binaries
on:
workflow_call:
inputs:
pm-version-major:
description: 'PocketMine-MP major version'
required: true
type: number
php-version-base:
description: 'PHP base version'
required: true
type: string
special-release:
description: 'Special release type to create (pm-default-latest, pm-default, none)'
required: true
type: string
pm-preview:
description: "Mark releases as pre-release"
required: true
type: boolean
env:
MUSL_CROSS_MAKE_VERSION: 7b9487e56efc83c419a397af7df7f119001dc51c
jobs:
linux:
name: Linux
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install tools and dependencies
run: |
sudo apt-get update
sudo apt-get install make texinfo autoconf automake libtool libtool-bin m4 wget libc-bin gzip bzip2 bison g++ git re2c
- name: Prepare compile.sh download cache
id: download-cache
uses: actions/cache@v4
with:
path: ./download_cache
key: compile-sh-cache-ssl-https-${{ hashFiles('./compile.sh') }}
restore-keys: compile-sh-cache-ssl-https-
- name: Compile PHP
run: |
# Used "set -ex" instead of hashbang since script isn't executed with hashbang
set -ex
trap "exit 1" ERR
./compile.sh -t linux64 -j 4 -g -P ${{ inputs.pm-version-major }} -c ./download_cache -l ./download_cache -D -z ${{ inputs.php-version-base }} -J
- name: Create tarball
run: |
tar -czf ./PHP-${{ inputs.php-version-base }}-Linux-x86_64-PM${{ inputs.pm-version-major }}.tar.gz bin
tar -czf ./Z-PHP-${{ inputs.php-version-base }}-Linux-x86_64-PM${{ inputs.pm-version-major }}-debugging-symbols.tar.gz bin-debug
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: PHP-${{ inputs.php-version-base }}-Linux-PM${{ inputs.pm-version-major }}
path: |
./*PHP-${{ inputs.php-version-base }}-Linux-x86_64-PM${{ inputs.pm-version-major }}*.tar.gz
install.log
compile.sh
if-no-files-found: error
- name: Prepare workspace for upload
if: failure()
run: tar -czf workspace.tar.gz install_data
- name: Upload workspace
uses: actions/upload-artifact@v4
if: failure()
with:
name: PHP-${{ inputs.php-version-base }}-Linux-workspace-PM${{ inputs.pm-version-major }}
path: |
workspace.tar.gz
if-no-files-found: error
macos:
name: MacOS ${{ matrix.artifact-name }}
runs-on: ${{ matrix.image }}
strategy:
matrix:
include:
- target-name: mac-x86-64
artifact-name: x86_64
image: macos-13
- target-name: mac-arm64
artifact-name: arm64
image: macos-14
steps:
- uses: actions/checkout@v4
- name: Install tools and dependencies
run: |
#workaround github actions default image providing outdated pkg-config
brew uninstall --ignore-dependencies --force [email protected] || true
brew install libtool texinfo autoconf automake pkg-config bison re2c
- name: Prepare compile.sh download cache
id: download-cache
uses: actions/cache@v4
with:
path: ./download_cache
key: compile-sh-cache-ssl-https-${{ hashFiles('./compile.sh') }}
restore-keys: compile-sh-cache-ssl-https-
- name: Compile PHP
run: |
export PATH="/usr/local/opt/bison/bin:$PATH"
set -ex
trap "exit 1" ERR
./compile.sh -t ${{ matrix.target-name }} -j4 -g -P ${{ inputs.pm-version-major }} -c ./download_cache -l ./download_cache -D -z ${{ inputs.php-version-base }} -J
- name: Create tarball
run: |
tar -czf ./PHP-${{ inputs.php-version-base }}-MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}.tar.gz bin
tar -czf ./Z-PHP-${{ inputs.php-version-base }}-MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}-debugging-symbols.tar.gz bin-debug
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: PHP-${{ inputs.php-version-base }}-MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}
path: |
./*PHP-${{ inputs.php-version-base }}-MacOS-${{ matrix.artifact-name}}-PM${{ inputs.pm-version-major }}*.tar.gz
install.log
compile.sh
if-no-files-found: error
- name: Prepare workspace for upload
if: failure()
run: tar -czf workspace.tar.gz install_data
- name: Upload workspace
uses: actions/upload-artifact@v4
if: failure()
with:
name: PHP-${{ inputs.php-version-base }}-MacOS-${{ matrix.artifact-name }}-workspace-PM${{ inputs.pm-version-major }}
path: |
workspace.tar.gz
if-no-files-found: error
publish:
name: Publish binaries
needs: [linux, macos]
runs-on: ubuntu-22.04
if: ${{ github.ref_name == 'stable' && github.ref_type == 'branch' && !contains(github.event.head_commit.message, '[no release]') }}
concurrency: release-${{ inputs.php-version-base }}-pm${{ inputs.pm-version-major }}
steps:
- uses: actions/checkout@v4
- name: Update latest tag target
run: |
git tag -f pm${{ inputs.pm-version-major }}-php-${{ inputs.php-version-base }}-latest
git push -f origin pm${{ inputs.pm-version-major }}-php-${{ inputs.php-version-base }}-latest
git tag -f pm${{ inputs.pm-version-major }}-latest
git push -f origin pm${{ inputs.pm-version-major }}-latest
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}
pattern: "*PHP-${{ inputs.php-version-base }}-*-PM${{ inputs.pm-version-major }}"
- name: Generate release notes
run: |
echo "### PHP ${{ inputs.php-version-base }} for PocketMine-MP ${{ inputs.pm-version-major }}.x" > changelog.md
echo "Last updated on **$(date -u +'%d %b %Y at %H:%M:%S %Z')**" >> changelog.md
echo -e "\n\n" >> changelog.md
echo "Built by: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> changelog.md
echo "Build number: ${{ github.run_number }}" >> changelog.md
echo -e "\n\n\n" >> changelog.md
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
echo -e "\n\n\n" >> changelog.md
if [[ "${{ inputs.special-release }}" != "none" ]]; then
echo ":white_check_mark: At the time of publication, this version is recommended for PocketMine-MP ${{ inputs.pm-version-major }}.x production servers." >> changelog.md
else
echo ":warning: WARNING! :warning:" >> changelog.md
echo "At the time of publication, plugins for PocketMine-MP ${{ inputs.pm-version-major }}.x may not work this PHP version." >> changelog.md
echo "If you have problems, try the [recommended PM${{ inputs.pm-version-major }} release](${{ github.server_url }}/${{ github.repository }}/releases/pm${{ inputs.pm-version-major }}-latest) instead." >> changelog.md
fi
- name: Get date
id: date
run: |
echo DATE=$(date -u +'%d %b %Y') >> $GITHUB_OUTPUT
- name: Update recommended PM release
uses: ncipollo/[email protected]
if: ${{ inputs.special-release != 'none' }}
with:
artifacts: |
${{ github.workspace }}/*PHP-*-PM*/*.tar.gz
name: PM ${{ inputs.pm-version-major }}.x (${{ steps.date.outputs.DATE }}) - Recommended
tag: pm${{ inputs.pm-version-major }}-latest
commit: ${{ github.sha }}
allowUpdates: true
removeArtifacts: true
bodyFile: ${{ github.workspace }}/changelog.md
makeLatest: ${{ inputs.special-release == 'default-latest' }}
prerelease: ${{ inputs.pm-preview == 'true' }}
- name: Update php-version PM release
uses: ncipollo/[email protected]
with:
artifacts: |
${{ github.workspace }}/*PHP-*-PM*/*.tar.gz
name: PM ${{ inputs.pm-version-major }}.x (${{ steps.date.outputs.DATE }}) - PHP ${{ inputs.php-version-base }}
tag: pm${{ inputs.pm-version-major }}-php-${{ inputs.php-version-base }}-latest
commit: ${{ github.sha }}
allowUpdates: true
removeArtifacts: true
bodyFile: ${{ github.workspace }}/changelog.md
makeLatest: false
prerelease: ${{ inputs.pm-preview == 'true' }}