Skip to content

[TASK] Update php to ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 #1828

[TASK] Update php to ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0

[TASK] Update php to ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 #1828

Workflow file for this run

name: Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
tests:
name: Tests (PHP ${{ matrix.php-version }} & ${{ matrix.dependencies }} dependencies)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ["8.1", "8.2", "8.3", "8.4"]
dependencies: ["locked", "highest", "lowest"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Prepare environment
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v2
coverage: none
# Install dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.dependencies }}
# Run tests
- name: Run tests
run: composer test
coverage:
name: Test coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Prepare environment
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
tools: composer:v2
coverage: pcov
# Install dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
# Run tests
- name: Build coverage directory
run: mkdir -p .build/coverage
- name: Run tests with coverage
run: composer test:coverage
# Upload artifact
- name: Fix coverage path
working-directory: .build/coverage
run: sed -i 's#/home/runner/work/frontend-asset-handler/frontend-asset-handler#${{ github.workspace }}#g' clover.xml
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage
path: .build/coverage/clover.xml
retention-days: 7
coverage-report:
name: Report test coverage
runs-on: ubuntu-latest
needs: coverage
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Download artifact
- name: Download coverage artifact
id: download
uses: actions/download-artifact@v4
with:
name: coverage
# CodeClimate
- name: CodeClimate report
uses: paambaati/[email protected]
if: env.CC_TEST_REPORTER_ID
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: |
${{ steps.download.outputs.download-path }}/clover.xml:clover
# Coveralls
- name: Coveralls report
uses: coverallsapp/github-action@v2
with:
file: ${{ steps.download.outputs.download-path }}/clover.xml
e2e:
name: Tests (E2E)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Prepare environment
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2, phive
# Compile PHAR
- name: Install box
# @todo Switch back to latest release of humbug/box once support for PHP 8.1 is dropped
run: phive install --trust-gpg-keys 2DF45277AEF09A2F humbug/[email protected]
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
with:
composer-options: "--no-dev"
- name: Compile PHAR
run: ./tools/box compile
# Run test with PHAR
- name: Test PHAR
run: |
.build/frontend-asset-handler.phar init \
--source-type=http \
--source-url=https://www.example.com \
--target-type=archive \
--target-path=.build/assets \
--handler-type=default