Add pre-built lib feature, and more bugfix for 2.3 #11
Workflow file for this run
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: Tests for PHP Pack Lib | |
on: | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- 'src/**' | |
- 'config/**' | |
- '.github/workflows/tests.yml' | |
- 'bin/**' | |
- 'composer.json' | |
- 'box.json' | |
- '.php-cs-fixer.php' | |
permissions: | |
contents: read | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build: | |
name: "Pack Lib Test (${{ matrix.lib }} for ${{ matrix.runner }})" | |
runs-on: ${{ matrix.runner }} | |
timeout-minutes: 120 | |
strategy: | |
matrix: | |
runner: | |
- ubuntu-latest | |
- ubuntu-20.04 | |
- macos-13 | |
- windows-latest | |
- macos-14 | |
lib: | |
- zlib | |
- pkg-config | |
- bzip2 | |
- gmp | |
exclude: | |
- { runner: "windows-latest", lib: "pkg-config" } | |
- { runner: "windows-latest", lib: "gmp" } | |
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" >> "$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-latest) | |
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" | |
uses: actions/checkout@v4 | |
- 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-latest' && 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-latest' || 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 }} |