Skip to content

Add pre-built lib feature, and more bugfix for 2.3 #9

Add pre-built lib feature, and more bugfix for 2.3

Add pre-built lib feature, and more bugfix for 2.3 #9

Workflow file for this run

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
- 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"
;;
windows-latest)
echo "OS=windows" >> "$GITHUB_OUTPUT"
echo "ARCH=x86_64" >> "$GITHUB_OUTPUT"
;;
macos-13)
echo "OS=darwin" >> "$GITHUB_OUTPUT"
echo "ARCH=x86_64" >> "$GITHUB_OUTPUT"
;;
macos-14)
echo "OS=darwin" >> "$GITHUB_OUTPUT"
echo "ARCH=aarch64" >> "$GITHUB_OUTPUT"
;;
esac
- name: "Checkout"
uses: actions/checkout@v4
- name: "Setup PHP"
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"
run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- run: bin/spc doctor --auto-fix
- run: bin/spc 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: |
bin/spc download --for-libs="pkg-config" --debug --retry=5 --shallow-clone --prefer-pre-built
bin/spc build:libs pkg-config --debug
- if: matrix.runner != 'windows-latest' || matrix.lib != 'pkg-config'
run: bin/spc 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@v2
with:
path: dist/${{ matrix.lib }}-${{ env.ARCH }}-${{ env.OS }}.txz
name: ${{ matrix.lib }}-${{ steps.process-env.outputs.ARCH }}-${{ steps.process-env.outputs.OS }}