Skip to content

Commit

Permalink
Merge branch 'pmmp:stable' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Josscoder authored Dec 25, 2024
2 parents c279646 + 9728fa5 commit b73b2e4
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 31 deletions.
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ updates:
directory: "/"
schedule:
interval: monthly
groups:
github-actions:
patterns: ["*"]
115 changes: 100 additions & 15 deletions .github/workflows/main-pm-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,94 @@ on:
required: true
type: boolean

env:
MUSL_CROSS_MAKE_VERSION: 7b9487e56efc83c419a397af7df7f119001dc51c

jobs:
android:
name: Android arm64
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: Fetch compiler cache
id: compiler-cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/compiler
key: musl-cross-make-${{ env.MUSL_CROSS_MAKE_VERSION }}
restore-keys: musl-cross-make-

- name: Checkout musl-cross-make
if: steps.compiler-cache.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: pmmp/musl-cross-make
path: musl-cross-make
ref: ${{ env.MUSL_CROSS_MAKE_VERSION }}

- name: Build compiler
if: steps.compiler-cache.outputs.cache-hit != 'true'
working-directory: musl-cross-make
run: |
echo "TARGET = aarch64-linux-musl" > config.mak
make -j$(nproc)
make install
mv ./output "${{ github.workspace }}/compiler"
- name: Compile PHP
run: |
export PATH="${{ github.workspace }}/compiler/bin:$PATH"
# Used "set -ex" instead of hashbang since script isn't executed with hashbang
set -ex
trap "exit 1" ERR
./compile.sh -t android-aarch64 -x -j 4 -g -P ${{ inputs.pm-version-major }} -c ./download_cache -D -z ${{ inputs.php-version-base }}
- name: Create tarball
run: |
tar -czf ./PHP-${{ inputs.php-version-base }}-Android-arm64-PM${{ inputs.pm-version-major }}.tar.gz bin
tar -czf ./Z-PHP-${{ inputs.php-version-base }}-Android-arm64-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 }}-Android-PM${{ inputs.pm-version-major }}
path: |
./*PHP-${{ inputs.php-version-base }}-Android-arm64-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 }}-Android-workspace-PM${{ inputs.pm-version-major }}
path: |
workspace.tar.gz
if-no-files-found: error

linux:
name: Linux
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -51,15 +138,15 @@ jobs:
- name: Create tarball
run: |
tar -czf ./PHP-${{ inputs.php-version-base }}-Linux-x86_64-PM${{ inputs.pm-version-major }}.tar.gz bin
tar -czf ./PHP-${{ inputs.php-version-base }}-Linux-x86_64-PM${{ inputs.pm-version-major }}-debugging-symbols.tar.gz bin-debug
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
./*PHP-${{ inputs.php-version-base }}-Linux-x86_64-PM${{ inputs.pm-version-major }}*.tar.gz
install.log
compile.sh
if-no-files-found: error
Expand All @@ -85,7 +172,7 @@ jobs:
include:
- target-name: mac-x86-64
artifact-name: x86_64
image: macos-12
image: macos-13
- target-name: mac-arm64
artifact-name: arm64
image: macos-14
Expand Down Expand Up @@ -117,15 +204,15 @@ jobs:
- 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 ./PHP-${{ inputs.php-version-base }}-MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}-debugging-symbols.tar.gz bin-debug
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
./*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
Expand Down Expand Up @@ -169,7 +256,7 @@ jobs:
run: |
mkdir temp
Compress-Archive -Path .\bin -DestinationPath "PHP-${{ inputs.php-version-base }}-Windows-x64-PM${{ inputs.pm-version-major }}.zip"
move php-debug-pack-*.zip temp/PHP-${{ inputs.php-version-base }}-Windows-x64-PM${{ inputs.pm-version-major }}-debugging-symbols.zip
move php-debug-pack-*.zip temp/Z-PHP-${{ inputs.php-version-base }}-Windows-x64-PM${{ inputs.pm-version-major }}-debugging-symbols.zip
move temp\*.zip .
- name: Upload artifacts
Expand All @@ -178,15 +265,15 @@ jobs:
with:
name: PHP-${{ inputs.php-version-base }}-Windows-PM${{ inputs.pm-version-major }}
path: |
PHP-${{ inputs.php-version-base }}-Windows-x64-PM${{ inputs.pm-version-major }}*.zip
*PHP-${{ inputs.php-version-base }}-Windows-x64-PM${{ inputs.pm-version-major }}*.zip
compile.log
windows-compile-vs.bat
if-no-files-found: error


publish:
name: Publish binaries
needs: [linux, macos, windows]
needs: [linux, macos, windows, android]
runs-on: ubuntu-20.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 }}
Expand All @@ -205,7 +292,7 @@ jobs:
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}
pattern: "PHP-${{ inputs.php-version-base }}-*-PM${{ inputs.pm-version-major }}"
pattern: "*PHP-${{ inputs.php-version-base }}-*-PM${{ inputs.pm-version-major }}"

- name: Generate release notes
run: |
Expand Down Expand Up @@ -237,9 +324,8 @@ jobs:
if: ${{ inputs.special-release != 'none' }}
with:
artifacts: |
${{ github.workspace }}/PHP-*-Linux-PM*/*.tar.gz
${{ github.workspace }}/PHP-*-MacOS-*-PM*/*.tar.gz
${{ github.workspace }}/PHP-*-Windows-PM*/*.zip
${{ github.workspace }}/*PHP-*-PM*/*.tar.gz
${{ github.workspace }}/*PHP-*-Windows-PM*/*.zip
name: PM ${{ inputs.pm-version-major }}.x (${{ steps.date.outputs.DATE }}) - Recommended
tag: pm${{ inputs.pm-version-major }}-latest
commit: ${{ github.sha }}
Expand All @@ -253,9 +339,8 @@ jobs:
uses: ncipollo/[email protected]
with:
artifacts: |
${{ github.workspace }}/PHP-*-Linux-PM*/*.tar.gz
${{ github.workspace }}/PHP-*-MacOS-*-PM*/*.tar.gz
${{ github.workspace }}/PHP-*-Windows-PM*/*.zip
${{ github.workspace }}/*PHP-*-PM*/*.tar.gz
${{ github.workspace }}/*PHP-*-Windows-PM*/*.zip
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 }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ jobs:
uses: ncipollo/[email protected]
with:
artifacts: |
${{ github.workspace }}/PHP-*-Linux-PM*/*.tar.gz
${{ github.workspace }}/PHP-*-MacOS-*-PM*/*.tar.gz
${{ github.workspace }}/PHP-*-Windows-PM*/*.zip
${{ github.workspace }}/*PHP-*-PM*/*.tar.gz
${{ github.workspace }}/*PHP-*-Windows-PM*/*.zip
name: PHP (Build ${{ github.run_number }}) - Archive
tag: php-build-${{ github.run_number }}
commit: ${{ github.sha }}
Expand Down
10 changes: 7 additions & 3 deletions compile.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
PHP_VERSIONS=("8.2.25" "8.3.13")
PHP_VERSIONS=("8.2.27" "8.3.15")

#### NOTE: Tags with "v" prefixes behave weirdly in the GitHub API. They'll be stripped in some places but not others.
#### Use commit hashes to avoid this.
Expand Down Expand Up @@ -130,6 +130,7 @@ fi
export CXX="g++"
#export AR="gcc-ar"
export RANLIB=ranlib
export STRIP="strip"
#fi

COMPILE_FOR_ANDROID=no
Expand Down Expand Up @@ -332,7 +333,9 @@ function download_file {
echo "Cache hit for URL: $url" >> "$DIR/install.log"
else
echo "Downloading file to cache: $url" >> "$DIR/install.log"
_download_file "$1" > "$DOWNLOAD_CACHE/$cached_filename" 2>> "$DIR/install.log"
#download to a tmpfile first, so that we don't leave borked cache entries for later runs
_download_file "$1" > "$DOWNLOAD_CACHE/.temp" 2>> "$DIR/install.log"
mv "$DOWNLOAD_CACHE/.temp" "$DOWNLOAD_CACHE/$cached_filename" >> "$DIR/install.log" 2>&1
fi
cat "$DOWNLOAD_CACHE/$cached_filename" 2>> "$DIR/install.log"
else
Expand Down Expand Up @@ -458,6 +461,7 @@ if [ "$TOOLCHAIN_PREFIX" != "" ]; then
export RANLIB="$TOOLCHAIN_PREFIX-ranlib"
export CPP="$TOOLCHAIN_PREFIX-cpp"
export LD="$TOOLCHAIN_PREFIX-ld"
export STRIP="$TOOLCHAIN_PREFIX-strip"
fi

echo "#include <stdio.h>" > test.c
Expand Down Expand Up @@ -1379,7 +1383,7 @@ function separate_symbols {
output_dirname="$SYMBOLS_DIR/$(dirname $libname)"
mkdir -p "$output_dirname" >> "$DIR/install.log" 2>&1
cp "$libname" "$SYMBOLS_DIR/$libname.debug" >> "$DIR/install.log" 2>&1
strip -S "$libname" >> "$DIR/install.log" 2>&1 || rm "$SYMBOLS_DIR/$libname.debug" #if this fails, this probably isn't an executable binary
"$STRIP" -S "$libname" >> "$DIR/install.log" 2>&1 || rm "$SYMBOLS_DIR/$libname.debug" #if this fails, this probably isn't an executable binary
}

if [ "$SEPARATE_SYMBOLS" != "no" ]; then
Expand Down
35 changes: 25 additions & 10 deletions windows-compile-vs.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
$ErrorActionPreference="Stop"
$ProgressPreference="SilentlyContinue"

$PHP_VERSIONS=@("8.2.25", "8.3.13")

Expand Down Expand Up @@ -228,7 +229,9 @@ function download-file {
echo "Cache hit for URL: $url" >> $log_file
} else {
echo "Downloading file from $url to $cached_path" >> $log_file
Invoke-WebRequest -Uri $url -OutFile $cached_path >> $log_file 2>&1
#download to a tmpfile first, so that we don't leave borked cache entries for later runs
Invoke-WebRequest -Uri $url -OutFile "$download_cache/.temp" >> $log_file 2>&1
Move-Item "$download_cache/.temp" $cached_path >> $log_file 2>&1
}
if (!(Test-Path $cached_path)) {
pm-fatal-error "Failed to download file from $url"
Expand All @@ -237,6 +240,18 @@ function download-file {
return $cached_path
}

function unzip-file {
param ([string] $file, [string] $destination)

#expand-archive doesn't respect script-local ProgressPreference
#https://github.com/PowerShell/Microsoft.PowerShell.Archive/issues/77
$oldProgressPref = $global:ProgressPreference
$global:ProgressPreference = "SilentlyContinue"
Expand-Archive -Path $file -DestinationPath $destination >> $log_file 2>&1
$global:ProgressPreference = $oldProgressPref
}


function append-file-utf8 {
param ([string] $line, [string] $file)

Expand All @@ -249,7 +264,7 @@ function download-sdk {
write-download
$file = download-file "https://github.com/php/php-sdk-binary-tools/archive/refs/tags/php-sdk-$PHP_SDK_VER.zip" "php-sdk"
write-extracting
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
unzip-file $file $pwd
Move-Item "php-sdk-binary-tools-php-sdk-$PHP_SDK_VER" $SOURCES_PATH
write-done
}
Expand Down Expand Up @@ -285,7 +300,7 @@ function build-yaml {
write-download
$file = download-file "https://github.com/yaml/libyaml/archive/$LIBYAML_VER.zip" "yaml"
write-extracting
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
unzip-file $file $pwd
Move-Item "libyaml-$LIBYAML_VER" libyaml >> $log_file 2>&1
Push-Location libyaml

Expand All @@ -309,7 +324,7 @@ function build-pthreads4w {
write-download
$file = download-file "https://github.com/pmmp/DependencyMirror/releases/download/mirror/pthreads4w-code-v$PTHREAD_W32_VER.zip" "pthreads4w"
write-extracting
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
unzip-file $file $pwd
Move-Item "pthreads4w-code-*" pthreads4w >> $log_file 2>&1
Push-Location pthreads4w

Expand All @@ -331,9 +346,9 @@ function build-pthreads4w {
function build-leveldb {
write-library "leveldb" $LEVELDB_MCPE_VER
write-download
$file = download-file "https://github.com/pmmp/leveldb/archive/$LEVELDB_MCPE_VER.zip"
$file = download-file "https://github.com/pmmp/leveldb/archive/$LEVELDB_MCPE_VER.zip" "leveldb"
write-extracting
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
unzip-file $file $pwd
Move-Item leveldb-* leveldb >> $log_file 2>&1
Push-Location leveldb

Expand All @@ -359,9 +374,9 @@ function build-leveldb {
function build-libdeflate {
write-library "libdeflate" $LIBDEFLATE_VER
write-download
$file = download-file "https://github.com/ebiggers/libdeflate/archive/$LIBDEFLATE_VER.zip"
$file = download-file "https://github.com/ebiggers/libdeflate/archive/$LIBDEFLATE_VER.zip" "libdeflate"
write-extracting
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
unzip-file $file $pwd
Move-Item libdeflate-* libdeflate >> $log_file 2>&1
Push-Location libdeflate

Expand Down Expand Up @@ -389,7 +404,7 @@ function download-php {

$file = download-file "https://github.com/php/php-src/archive/$PHP_GIT_REV.zip" "php"
write-extracting
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
unzip-file $file $pwd
Move-Item "php-src-$PHP_GIT_REV" php-src >> $log_file 2>&1
write-done
}
Expand All @@ -401,7 +416,7 @@ function get-extension-zip {
write-download
$file = download-file $url "php-ext-$name"
write-extracting
Expand-Archive -Path $file -DestinationPath $pwd >> $log_file 2>&1
unzip-file $file $pwd
write-done
}

Expand Down

0 comments on commit b73b2e4

Please sign in to comment.