Skip to content

Commit

Permalink
Merge branch 'php/8.2' into php/8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed Apr 2, 2024
2 parents f70c63e + f9601e5 commit 986ac80
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 171 deletions.
164 changes: 164 additions & 0 deletions .github/workflows/main-pm-matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: Build PHP binaries

on:
workflow_call:
inputs:
pm-version-major:
description: 'PocketMine-MP major version'
required: true
type: number

jobs:
linux:
name: Linux
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4

- name: Install tools and dependencies
run: |
sudo apt-get update
sudo apt-get install make 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 -D
- name: Create tarball
run: |
tar -czf ./PHP-Linux-x86_64-PM${{ inputs.pm-version-major }}.tar.gz bin
tar -czf ./PHP-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: Linux-PM${{ inputs.pm-version-major }}
path: |
./PHP-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: 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-12
- target-name: mac-arm64
artifact-name: arm64
image: macos-14

steps:
- uses: actions/checkout@v4

- name: Install tools and dependencies
run: brew install libtool 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 -D
- name: Create tarball
run: |
tar -czf ./PHP-MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}.tar.gz bin
tar -czf ./PHP-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: MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}
path: |
./PHP-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: MacOS-${{ matrix.artifact-name }}-workspace-PM${{ inputs.pm-version-major }}
path: |
workspace.tar.gz
if-no-files-found: error

windows:
name: Windows
runs-on: windows-2019

steps:
- uses: actions/checkout@v4

- name: Install tools and dependencies
run: choco install wget --no-progress

- name: Compile PHP
run: .\windows-compile-vs.bat
env:
VS_EDITION: Enterprise
SOURCES_PATH: ${{ github.workspace }}\pocketmine-php-sdk
PM_VERSION_MAJOR: ${{ inputs.pm-version-major }}

- name: Rename artifacts
run: |
mkdir temp
move php-debug-pack-*.zip temp/PHP-Windows-x64-PM${{ inputs.pm-version-major }}-debugging-symbols.zip
move php-*.zip temp/PHP-Windows-x64-PM${{ inputs.pm-version-major }}.zip
move temp\*.zip .
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: Windows-PM${{ inputs.pm-version-major }}
path: |
PHP-Windows-x64*.zip
compile.log
windows-compile-vs.bat
if-no-files-found: error
169 changes: 13 additions & 156 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build PHP binaries
name: Build and publish PHP binaries

on:
push:
Expand All @@ -12,163 +12,20 @@ concurrency:
cancel-in-progress: true

jobs:
linux:
name: Linux (PM ${{ matrix.pm-version-major }})
runs-on: ubuntu-20.04
all-builds:
name: PM${{ matrix.pm-version-major }}
strategy:
matrix:
pm-version-major: [4, 5]

steps:
- uses: actions/checkout@v4

- name: Install tools and dependencies
run: |
sudo apt-get update
sudo apt-get install make 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@v3
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 ${{ matrix.pm-version-major }} -c ./download_cache -D
- name: Create tarball
run: |
tar -czf ./PHP-Linux-x86_64-PM${{ matrix.pm-version-major }}.tar.gz bin
tar -czf ./PHP-Linux-x86_64-PM${{ matrix.pm-version-major }}-debugging-symbols.tar.gz bin-debug
- name: Upload artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: Linux-PM${{ matrix.pm-version-major }}
path: |
./PHP-Linux-x86_64-PM${{ matrix.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@v3
if: failure()
with:
name: Linux-workspace-PM${{ matrix.pm-version-major }}
path: |
workspace.tar.gz
if-no-files-found: error

macos:
name: MacOS (PM ${{ matrix.pm-version-major }})
runs-on: macos-11.0
strategy:
matrix:
pm-version-major: [ 4, 5 ]

steps:
- uses: actions/checkout@v4

- name: Install tools and dependencies
run: brew install libtool autoconf automake pkg-config bison re2c

- name: Prepare compile.sh download cache
id: download-cache
uses: actions/cache@v3
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 mac-x86-64 -j4 -g -P ${{ matrix.pm-version-major }} -c ./download_cache -D
- name: Create tarball
run: |
tar -czf ./PHP-MacOS-x86_64-PM${{ matrix.pm-version-major }}.tar.gz bin
tar -czf ./PHP-MacOS-x86_64-PM${{ matrix.pm-version-major }}-debugging-symbols.tar.gz bin-debug
- name: Upload artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: MacOS-PM${{ matrix.pm-version-major }}
path: |
./PHP-MacOS-x86_64-PM${{ matrix.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@v3
if: failure()
with:
name: MacOS-workspace-PM${{ matrix.pm-version-major }}
path: |
workspace.tar.gz
if-no-files-found: error

windows:
name: Windows (PM ${{ matrix.pm-version-major }})
runs-on: windows-2019
strategy:
matrix:
pm-version-major: [ 4, 5 ]

steps:
- uses: actions/checkout@v4

- name: Install tools and dependencies
run: choco install wget --no-progress

- name: Compile PHP
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 artifacts
run: |
mkdir temp
move php-debug-pack-*.zip temp/PHP-Windows-x64-PM${{ matrix.pm-version-major }}-debugging-symbols.zip
move php-*.zip temp/PHP-Windows-x64-PM${{ matrix.pm-version-major }}.zip
move temp\*.zip .
- name: Upload artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: Windows-PM${{ matrix.pm-version-major }}
path: |
PHP-Windows-x64*.zip
compile.log
windows-compile-vs.bat
if-no-files-found: error
uses: ./.github/workflows/main-pm-matrix.yml
with:
pm-version-major: ${{ matrix.pm-version-major }}
secrets: inherit

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

Expand All @@ -186,7 +43,7 @@ jobs:
git push -f origin php-${{ steps.version.outputs.PHP_VERSION }}-latest
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}

Expand All @@ -213,11 +70,11 @@ jobs:
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
- name: Update latest branch release
uses: ncipollo/release-action@v1.13.0
uses: ncipollo/release-action@v1.14.0
with:
artifacts: |
${{ github.workspace }}/Linux-PM*/*.tar.gz
${{ github.workspace }}/MacOS-PM*/*.tar.gz
${{ github.workspace }}/MacOS-*-PM*/*.tar.gz
${{ github.workspace }}/Windows-PM*/*.zip
makeLatest: ${{ github.ref_name == github.event.repository.default_branch }}
name: PHP ${{ steps.version.outputs.PHP_VERSION }} - Latest (Build ${{ github.run_number }})
Expand All @@ -229,11 +86,11 @@ jobs:
prerelease: ${{ endsWith(github.ref_name, '-preview') }}

- name: Publish unique release
uses: ncipollo/release-action@v1.13.0
uses: ncipollo/release-action@v1.14.0
with:
artifacts: |
${{ github.workspace }}/Linux-PM*/*.tar.gz
${{ github.workspace }}/MacOS-PM*/*.tar.gz
${{ github.workspace }}/MacOS-*-PM*/*.tar.gz
${{ github.workspace }}/Windows-PM*/*.zip
makeLatest: false
name: PHP ${{ steps.version.outputs.PHP_VERSION }} (Build ${{ github.run_number }})
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Bash script used to compile PHP on MacOS and Linux platforms. Make sure you have

### Common pitfalls
- 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.
- Avoid directory trees containing special (non-English) symbols. For example, `Développement` might cause issues.

### Additional notes
#### Mac OSX (native compile)
Expand Down

0 comments on commit 986ac80

Please sign in to comment.