Skip to content

Build PHP 8.3 & drop support for PHP 8.0 #71

Build PHP 8.3 & drop support for PHP 8.0

Build PHP 8.3 & drop support for PHP 8.0 #71

Workflow file for this run

name: Tests
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
test-all:
name: Test PHP ${{ matrix.php-version }}
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-version: ['8.1', '8.2', '8.3']
include:
- operating-system: 'ubuntu-latest'
php-version: '8.3'
run-sonarqube-analysis: true
services:
redis:
image: bitnami/redis:7.4-debian-12
ports:
- 6379:6379
env:
ALLOW_EMPTY_PASSWORD: 'yes'
options: >-
--health-cmd "redis-cli -p 6379 ping"
--health-start-period 5s
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis-sentinel:
image: bitnami/redis-sentinel:7.4-debian-12
ports:
- 26379:26379
env:
REDIS_MASTER_HOST: redis
REDIS_MASTER_SET: mymaster
REDIS_SENTINEL_QUORUM: 1
options: >-
--health-cmd "redis-cli -p 26379 ping"
--health-start-period 5s
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHPUnit
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: redis
coverage: pcov
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install composer dependencies
run: composer install --prefer-dist
- name: Run phpunit tests
run: composer test
env:
REDIS_SENTINEL_HOST: 127.0.0.1
REDIS_SENTINEL_PORT: 26379
REDIS_SENTINEL_SERVICE: mymaster
- name: Prepare paths for SonarQube analysis
if: ${{ matrix.run-sonarqube-analysis && !github.event.pull_request.head.repo.fork }}
run: |
sed -i "s|$GITHUB_WORKSPACE|/github/workspace|g" phpunit.coverage-clover.xml
sed -i "s|$GITHUB_WORKSPACE|/github/workspace|g" phpunit.report-junit.xml
- name: Run SonarQube analysis
uses: sonarsource/sonarcloud-github-action@master
if: ${{ matrix.run-sonarqube-analysis && !github.event.pull_request.head.repo.fork }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2