wip #40
Workflow file for this run
This file contains hidden or 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 | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| check-dev-version: | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/master' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check PHP_LIBARCHIVE_VERSION ends in -dev | |
| run: | | |
| HEADER_VERSION=$(grep -oP '(?<=#define PHP_LIBARCHIVE_VERSION ")[^"]+' php_libarchive.h) | |
| echo "Header version: $HEADER_VERSION" | |
| if [[ "$HEADER_VERSION" != *-dev ]]; then | |
| echo "ERROR: PHP_LIBARCHIVE_VERSION ($HEADER_VERSION) does not end in -dev on master" | |
| exit 1 | |
| fi | |
| generate-matrix: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: set-matrix | |
| run: | | |
| python3 <<'EOF' | |
| import yaml, json, os | |
| with open('.github/docker-image-shas.yml') as f: | |
| data = yaml.safe_load(f) | |
| image = 'ghcr.io/cataphract/php-minimal' | |
| includes = [] | |
| for tag, sha in data[image].items(): | |
| # tag: "8.0-debug" or "8.0-release-zts"; skip non-test variants | |
| ver, variant = tag.split('-', 1) | |
| if variant not in ('debug', 'release-zts'): | |
| continue | |
| includes.append({'php': ver, 'variant': variant, 'image_sha': sha, | |
| 'libarchive_version': 'system'}) | |
| # Extra jobs testing specific libarchive versions (use PHP 8.4 debug) | |
| sha_8_4_debug = data[image]['8.4-debug'] | |
| for la_ver in ['v3.5.0', 'v3.7.0', 'v3.8.6']: | |
| includes.append({'php': '8.4', 'variant': 'debug', 'image_sha': sha_8_4_debug, | |
| 'libarchive_version': la_ver}) | |
| with open(os.environ['GITHUB_OUTPUT'], 'a') as f: | |
| f.write('matrix=' + json.dumps({'include': includes}) + '\n') | |
| EOF | |
| linux: | |
| name: PHP ${{ matrix.php }} (${{ matrix.variant }}, libarchive ${{ matrix.libarchive_version }}) | |
| needs: generate-matrix | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/cataphract/php-minimal@${{ matrix.image_sha }} | |
| options: --user root | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Restore libarchive cache | |
| if: matrix.libarchive_version != 'system' | |
| uses: actions/cache@v4 | |
| with: | |
| path: .libarchive-cache | |
| key: libarchive-${{ matrix.libarchive_version }}-${{ runner.arch }} | |
| - name: Build and test | |
| env: | |
| LIBARCHIVE_VERSION: ${{ matrix.libarchive_version }} | |
| run: bash .github/scripts/build-and-test.sh | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-php${{ matrix.php }}-${{ matrix.variant }}-libarchive${{ matrix.libarchive_version }} | |
| path: report.xml | |
| ubuntu: | |
| name: ubuntu (PHP 8.3 release, ${{ matrix.arch }}) | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: x86_64 | |
| runner: ubuntu-latest | |
| - arch: aarch64 | |
| runner: ubuntu-24.04-arm | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install PHP 8.3 and libarchive | |
| run: | | |
| sudo apt-get update -q | |
| sudo apt-get install -y php8.3 php8.3-dev libarchive-dev | |
| - name: Build and test | |
| run: bash .github/scripts/build-and-test.sh | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-ubuntu-php8.3-release-${{ matrix.arch }} | |
| path: report.xml |