This repository has been archived by the owner on Dec 4, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
243 lines (216 loc) · 6.65 KB
/
phpBuild.yaml
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
name: PHP build
on:
workflow_dispatch:
schedule:
- cron: "0 0 */2 * *"
jobs:
# Android Build arm64
android:
runs-on: ubuntu-latest
name: Android
steps:
- name: Clone Repository
uses: actions/checkout@v4
with:
repository: pmmp/PHP-Binaries
submodules: true
- name: Cache musl
uses: actions/cache@v3
with:
key: ${{ runner.os }}-android_musl
path: muslCrossMake
- name: Build musl to android
env:
DEBIAN_FRONTEND: "noninteractive"
run: |
set -ex
sudo apt update
sudo apt -y install build-essential curl make autoconf automake libtool m4 wget gzip bzip2 bison g++ git cmake pkg-config re2c libtool* unzip zip tar
# Build musl
if ! [[ -d muslCrossMake ]];then
mkdir muslCrossMake
INITIAL_PATH="$(pwd)"
cd muslCrossMake
git clone https://github.com/pmmp/musl-cross-make.git ./
(echo "TARGET = aarch64-linux-musl"; echo "OUTPUT = /usr/local") > config.mak
make
sudo make install -j$(nproc)
else
cd muslCrossMake
sudo make install -j$(nproc)
fi
- name: "Building php bin"
continue-on-error: true
timeout-minutes: 40
run: |
./compile.sh -t android-aarch64 -x -f -g -j$(nproc) -P 5
# Compress files
cd bin/php*/
pwd
# ZIP
zip -r "${{ github.workspace }}/android_arm64.zip" *
# tar
tar -czf "${{ github.workspace }}/android_arm64.tar.gz" *
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: android_arm64
path: "*.tar.gz"
# Linux Build
linux:
strategy:
fail-fast: false
max-parallel: 1
matrix:
pm-version-major: [ 4, 5 ]
target:
- ubuntu-latest
# - arm64
exclude:
- target: arm64
pm-version-major: 4
name: "Linux (PM ${{ matrix.pm-version-major }} - ${{ matrix.target }})"
runs-on: ${{ matrix.target }}
steps:
- name: Clone Repository
uses: actions/checkout@v4
with:
repository: pmmp/PHP-Binaries
submodules: true
- name: Install tools and dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake pkg-config make autoconf automake libtool libtool-bin m4 wget libc-bin gzip bzip2 bison g++ git re2c zip tar
- name: Compile PHP
timeout-minutes: 40
run: |
set -ex
trap "exit 1" ERR
./compile.sh -j 4 -g -P ${{ matrix.pm-version-major }}
# Compress files
cd bin/php*/
pwd
# ZIP
zip -r "${{ github.workspace }}/linux_${{ runner.arch }}.zip" *
# tar
tar -czf "${{ github.workspace }}/linux_${{ runner.arch }}.tar.gz" *
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: linux_PM${{ matrix.pm-version-major }}_${{ runner.arch }}
path: |
*.tar.gz
*.zip
# MacOS Build
macos:
name: MacOS (PM ${{ matrix.pm-version-major }})
runs-on: macos-11.0
strategy:
matrix:
pm-version-major: [ 4, 5 ]
steps:
- name: Clone Repository
uses: actions/checkout@v4
with:
repository: pmmp/PHP-Binaries
submodules: true
- name: Install dependecies
run: brew install libtool autoconf automake pkg-config bison re2c
- name: "Building php"
continue-on-error: true
timeout-minutes: 40
run: |
export PATH="/usr/local/opt/bison/bin:$PATH"
set -ex
trap "exit 1" ERR
./compile.sh -t mac-x86-64 -j4 -f -g -P ${{ matrix.pm-version-major }}
- name: Create tarballs
run: |
cd bin/
pwd
ARCH="$(node -e 'console.log(process.arch)')"
# ZIP
zip -r "${{ github.workspace }}/darwin_${ARCH}.zip" *
# tar
tar -czf "${{ github.workspace }}/darwin_${ARCH}.tar.gz" *
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: darwin_PM${{ matrix.pm-version-major }}_${{ runner.arch }}
path: |
*.tar.gz
*.zip
# Windows build
win32:
name: Windows (PM ${{ matrix.pm-version-major }})
runs-on: windows-2019
strategy:
matrix:
pm-version-major: [ 4, 5 ]
steps:
- name: Clone Repository
uses: actions/checkout@v4
with:
repository: pmmp/PHP-Binaries
submodules: true
- name: Windows Depencies Install
run: choco install --no-progress wget
- name: "Building php bin"
run: .\windows-compile-vs.bat
env:
VS_EDITION: Enterprise
SOURCES_PATH: ${{ github.workspace }}\pocketmine-php-sdk
PM_VERSION_MAJOR: ${{ matrix.pm-version-major }}
- name: Rename files
shell: node {0}
run: |
const fs = require("fs");
const path = require("path");
const files = fs.readdirSync(process.cwd()).filter(file => file.endsWith(".zip"));
for (const zip of files) {
console.log("File:", path.join(process.cwd(), zip));
if (/debug/i.test(zip)) fs.rmSync(path.join(process.cwd(), zip));
else fs.renameSync(path.join(process.cwd(), zip), path.join(process.cwd(), `win32_${process.arch}_pm${{ matrix.pm-version-major }}.zip`));
}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Windows_PM${{ matrix.pm-version-major }}_${{ runner.arch }}
path: "*.zip"
# Upload to bucket
upload:
runs-on: ubuntu-latest
needs:
- win32
- macos
- linux
- android
steps:
- uses: actions/checkout@v4
name: Code checkout
- uses: actions/setup-node@v4
name: Setup node.js
with:
node-version: latest
- name: Install node depencies
run: npm install --no-save
- name: Download tarbals
uses: actions/download-artifact@v3
with:
path: ./phpOutput
- name: Rename files
run: |
cd phpOutput
OIFS="$IFS"
IFS=$'\n'
for file in $(find . -type f)
do
echo "${file} => $(basename "$file")"
mv -v "$file" "$(basename "$file")"
done
IFS="$OIFS"
- name: Upload to bucket
run: node .github/uploadToBucket.mjs phpOutput:php_bin
timeout-minutes: 25
env:
OCI_AUTHKEY: ${{ secrets.OCI_AUTHKEY }}