Skip to content

Commit

Permalink
Merge pull request #11 from hans-thomas/php-matrix-workflow
Browse files Browse the repository at this point in the history
PHP matrix added to workflow to run tests on different environments.
  • Loading branch information
hans-thomas authored Oct 24, 2023
2 parents 7a41530 + 0248c26 commit 8e7d91b
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@
name: PHP Composer

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
on: [push, pull_request]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
php: [ 8.1, 8.2, 8.3 ]
dependency-version: [ prefer-stable ]

name: PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: ${{ matrix.php }}
extensions: xdebug
ini-values: xdebug.mode="coverage"
coverage: xdebug

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
- name: Get Composer cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer packages
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
path: ${{ steps.composer-cache.outputs.dir }}
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Install dependencies
run: composer install --prefer-dist --no-progress
Expand All @@ -48,6 +54,4 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
name: sphinx-codecov
fail_ci_if_error: true

0 comments on commit 8e7d91b

Please sign in to comment.