PHP Pack Lib #58
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PHP Pack Lib | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * 5" | |
release: | |
types: | |
- published | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- 'src/**' | |
- 'config/**' | |
- '.github/workflows/test-pack-lib.yml' | |
- 'bin/**' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build: | |
name: "Pack ${{ matrix.lib }} for ${{ matrix.runner }}" | |
runs-on: ${{ matrix.runner }} | |
timeout-minutes: 240 | |
strategy: | |
matrix: | |
runner: | |
- ubuntu-latest | |
- ubuntu-20.04 | |
- macos-13 | |
- windows-2019 | |
- macos-14 | |
lib: | |
- zlib | |
- pkg-config | |
- bzip2 | |
- gmp | |
- sqlite | |
- liblz4 | |
- openssl | |
- brotli | |
- libargon2 | |
- libiconv | |
- libavif | |
- libpng | |
- libtiff | |
- icu | |
- libcares | |
- libevent | |
- libsodium | |
- libwebp | |
- libyaml | |
- ncurses | |
- onig | |
- readline | |
- unixodbc | |
- xz | |
- grpc | |
- libaom | |
- libde265 | |
- libheif | |
exclude: | |
- { runner: "windows-2019", lib: "pkg-config" } | |
- { runner: "windows-2019", lib: "gmp" } | |
- { runner: "windows-2019", lib: "liblz4" } | |
- { runner: "windows-2019", lib: "brotli" } | |
- { runner: "windows-2019", lib: "libargon2" } | |
- { runner: "windows-2019", lib: "libiconv" } | |
- { runner: "windows-2019", lib: "libtiff" } | |
- { runner: "windows-2019", lib: "icu" } | |
- { runner: "windows-2019", lib: "libcares" } | |
- { runner: "windows-2019", lib: "libevent" } | |
- { runner: "windows-2019", lib: "libsodium" } | |
- { runner: "windows-2019", lib: "ncurses" } | |
- { runner: "windows-2019", lib: "readline" } | |
- { runner: "windows-2019", lib: "unixodbc" } | |
- { runner: "windows-2019", lib: "grpc" } | |
- { runner: "windows-2019", lib: "libaom" } | |
- { runner: "windows-2019", lib: "libde265" } | |
- { runner: "windows-2019", lib: "libheif" } | |
fail-fast: false | |
steps: | |
- name: "Process env string" | |
id: process-env | |
shell: bash | |
run: | | |
case "${{ matrix.runner }}" in | |
ubuntu-latest) | |
echo "OS=linux" >> "$GITHUB_OUTPUT" | |
echo "ARCH=x86_64" >> "$GITHUB_OUTPUT" | |
echo "CMD=bin/spc-alpine-docker" >> "$GITHUB_OUTPUT" | |
;; | |
ubuntu-20.04) | |
echo "OS=linux" >> "$GITHUB_OUTPUT" | |
echo "ARCH=aarch64" >> "$GITHUB_OUTPUT" | |
echo CMD="SPC_USE_ARCH=aarch64 bin/spc-alpine-docker" >> "$GITHUB_OUTPUT" | |
;; | |
windows-2019) | |
echo "OS=windows" >> "$GITHUB_OUTPUT" | |
echo "ARCH=x86_64" >> "$GITHUB_OUTPUT" | |
echo "CMD=bin/spc" >> "$GITHUB_OUTPUT" | |
;; | |
macos-13) | |
echo "OS=darwin" >> "$GITHUB_OUTPUT" | |
echo "ARCH=x86_64" >> "$GITHUB_OUTPUT" | |
echo "CMD=bin/spc" >> "$GITHUB_OUTPUT" | |
;; | |
macos-14) | |
echo "OS=darwin" >> "$GITHUB_OUTPUT" | |
echo "ARCH=aarch64" >> "$GITHUB_OUTPUT" | |
echo "CMD=bin/spc" >> "$GITHUB_OUTPUT" | |
;; | |
esac | |
- name: "Checkout remote" | |
if: github.repository != 'crazywhalecc/static-php-cli' | |
uses: actions/checkout@v4 | |
with: | |
repository: crazywhalecc/static-php-cli | |
ref: main | |
- name: "Setup PHP" | |
if: matrix.runner != 'ubuntu-20.04' | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
tools: pecl, composer | |
extensions: curl, openssl, mbstring | |
ini-values: memory_limit=-1 | |
- name: "Cache composer packages" | |
id: composer-cache | |
uses: actions/cache@v4 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php | |
# Cache downloaded source | |
- id: cache-download | |
uses: actions/cache@v4 | |
with: | |
path: downloads | |
key: pack-lib-dependencies | |
- name: "Install Dependencies" | |
if: matrix.runner != 'ubuntu-20.04' | |
run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- run: ${{ steps.process-env.outputs.CMD }} doctor --auto-fix | |
- run: ${{ steps.process-env.outputs.CMD }} download --for-libs="${{ matrix.lib }}" --debug --retry=5 --shallow-clone | |
- name: "Download pre-built pkg-config for ${{ matrix.runner }}" | |
if: matrix.runner != 'windows-2019' && matrix.lib != 'pkg-config' | |
run: | | |
${{ steps.process-env.outputs.CMD }} download --for-libs="pkg-config" --debug --retry=5 --shallow-clone --prefer-pre-built | |
${{ steps.process-env.outputs.CMD }} build:libs pkg-config --debug | |
- if: matrix.runner != 'windows-2019' || matrix.lib != 'pkg-config' | |
run: ${{ steps.process-env.outputs.CMD }} dev:pack-lib --debug ${{ matrix.lib }} | |
- name: "Upload packed lib (${{ matrix.lib }} for ${{ steps.process-env.outputs.ARCH }}-${{ steps.process-env.outputs.OS }})" | |
uses: actions/upload-artifact@v4 | |
with: | |
path: dist/${{ matrix.lib }}-${{ steps.process-env.outputs.ARCH }}-${{ steps.process-env.outputs.OS }}.txz | |
name: ${{ matrix.lib }}-${{ steps.process-env.outputs.ARCH }}-${{ steps.process-env.outputs.OS }} | |
- name: "Upload to current release event" | |
if: github.repository == 'static-php/static-php-cli-hosted' && startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: dist/${{ matrix.lib }}-${{ steps.process-env.outputs.ARCH }}-${{ steps.process-env.outputs.OS }}.txz | |
- name: "Update latest release of hosted repo" | |
if: github.repository == 'static-php/static-php-cli-hosted' && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') | |
shell: bash | |
run: | | |
ref="$(gh release view --repo static-php/static-php-cli-hosted --json tagName --jq '.tagName')" | |
gh release upload "$ref" "dist/${{ matrix.lib }}-${{ steps.process-env.outputs.ARCH }}-${{ steps.process-env.outputs.OS }}.txz" --repo static-php/static-php-cli-hosted --clobber |