Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

PHP build

PHP build #87

Workflow file for this run

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/[email protected]
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 }}