Skip to content

Commit b1eaaa4

Browse files
committed
Build Android binaries in CI
Android support is still highly in demand for whatever reason. Since I did all the work to support this already anyway, we might as well just have it built here instead of getting people sending random issues attempting to build it themselves.
1 parent 8cb0722 commit b1eaaa4

File tree

1 file changed

+88
-5
lines changed

1 file changed

+88
-5
lines changed

.github/workflows/main-pm-matrix.yml

+88-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,92 @@ on:
2020
required: true
2121
type: boolean
2222

23+
env:
24+
MUSL_CROSS_MAKE_VERSION: 7b9487e56efc83c419a397af7df7f119001dc51c
25+
2326
jobs:
27+
android:
28+
name: Android arm64
29+
runs-on: ubuntu-20.04
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Install tools and dependencies
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install make autoconf automake libtool libtool-bin m4 wget libc-bin gzip bzip2 bison g++ git re2c
38+
39+
- name: Prepare compile.sh download cache
40+
id: download-cache
41+
uses: actions/cache@v4
42+
with:
43+
path: ./download_cache
44+
key: compile-sh-cache-ssl-https-${{ hashFiles('./compile.sh') }}
45+
restore-keys: compile-sh-cache-ssl-https-
46+
47+
- name: Fetch compiler cache
48+
id: compiler-cache
49+
uses: actions/cache@v4
50+
with:
51+
path: ${{ github.workspace }}/compiler
52+
key: musl-cross-make-${{ env.MUSL_CROSS_MAKE_VERSION }}
53+
restore-keys: musl-cross-make-
54+
55+
- name: Checkout musl-cross-make
56+
uses: actions/checkout@v4
57+
with:
58+
repository: pmmp/musl-cross-make
59+
path: musl-cross-make
60+
ref: ${{ env.MUSL_CROSS_MAKE_VERSION }}
61+
62+
- name: Build compiler
63+
working-directory: musl-cross-make
64+
run: |
65+
echo "TARGET = aarch64-linux-musl" > config.mak
66+
make -j$(nproc)
67+
make install
68+
mv ./output "${{ github.workspace }}/compiler"
69+
70+
- name: Compile PHP
71+
run: |
72+
export PATH="${{ github.workspace }}/compiler/bin:$PATH"
73+
74+
# Used "set -ex" instead of hashbang since script isn't executed with hashbang
75+
set -ex
76+
trap "exit 1" ERR
77+
./compile.sh -t android-aarch64 -x -j 4 -g -P ${{ inputs.pm-version-major }} -c ./download_cache -D -z ${{ inputs.php-version-base }}
78+
79+
80+
- name: Create tarball
81+
run: |
82+
tar -czf ./PHP-${{ inputs.php-version-base }}-Android-arm64-PM${{ inputs.pm-version-major }}.tar.gz bin
83+
tar -czf ./PHP-${{ inputs.php-version-base }}-Android-arm64-PM${{ inputs.pm-version-major }}-debugging-symbols.tar.gz bin-debug
84+
85+
- name: Upload artifacts
86+
uses: actions/upload-artifact@v4
87+
if: always()
88+
with:
89+
name: PHP-${{ inputs.php-version-base }}-Android-PM${{ inputs.pm-version-major }}
90+
path: |
91+
./PHP-${{ inputs.php-version-base }}-Android-arm64-PM${{ inputs.pm-version-major }}*.tar.gz
92+
install.log
93+
compile.sh
94+
if-no-files-found: error
95+
96+
- name: Prepare workspace for upload
97+
if: failure()
98+
run: tar -czf workspace.tar.gz install_data
99+
100+
- name: Upload workspace
101+
uses: actions/upload-artifact@v4
102+
if: failure()
103+
with:
104+
name: PHP-${{ inputs.php-version-base }}-Android-workspace-PM${{ inputs.pm-version-major }}
105+
path: |
106+
workspace.tar.gz
107+
if-no-files-found: error
108+
24109
linux:
25110
name: Linux
26111
runs-on: ubuntu-20.04
@@ -186,7 +271,7 @@ jobs:
186271

187272
publish:
188273
name: Publish binaries
189-
needs: [linux, macos, windows]
274+
needs: [linux, macos, windows, android]
190275
runs-on: ubuntu-20.04
191276
if: ${{ github.ref_name == 'stable' && github.ref_type == 'branch' && !contains(github.event.head_commit.message, '[no release]') }}
192277
concurrency: release-${{ inputs.php-version-base }}-pm${{ inputs.pm-version-major }}
@@ -237,8 +322,7 @@ jobs:
237322
if: ${{ inputs.special-release != 'none' }}
238323
with:
239324
artifacts: |
240-
${{ github.workspace }}/PHP-*-Linux-PM*/*.tar.gz
241-
${{ github.workspace }}/PHP-*-MacOS-*-PM*/*.tar.gz
325+
${{ github.workspace }}/PHP-*-PM*/*.tar.gz
242326
${{ github.workspace }}/PHP-*-Windows-PM*/*.zip
243327
name: PM ${{ inputs.pm-version-major }}.x (${{ steps.date.outputs.DATE }}) - Recommended
244328
tag: pm${{ inputs.pm-version-major }}-latest
@@ -253,8 +337,7 @@ jobs:
253337
uses: ncipollo/[email protected]
254338
with:
255339
artifacts: |
256-
${{ github.workspace }}/PHP-*-Linux-PM*/*.tar.gz
257-
${{ github.workspace }}/PHP-*-MacOS-*-PM*/*.tar.gz
340+
${{ github.workspace }}/PHP-*-PM*/*.tar.gz
258341
${{ github.workspace }}/PHP-*-Windows-PM*/*.zip
259342
name: PM ${{ inputs.pm-version-major }}.x (${{ steps.date.outputs.DATE }}) - PHP ${{ inputs.php-version-base }}
260343
tag: pm${{ inputs.pm-version-major }}-php-${{ inputs.php-version-base }}-latest

0 commit comments

Comments
 (0)