Skip to content

Commit

Permalink
enhancement: improve php.yml GitHub test workflow
Browse files Browse the repository at this point in the history
- Add testing for multiple PHP versions: 8.1, 8.2, 8.3
- Add OS matrix: ubuntu-latest, windows-latest
- Validate `composer.json`
- Execute tests across configurations
  • Loading branch information
n4ss1m committed Oct 26, 2024
1 parent c7b68a9 commit 99ce01c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 70 deletions.
48 changes: 25 additions & 23 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
name: PHP Composer
name: Tests

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.1, 8.2, 8.3]

runs-on: ubuntu-latest
name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v4

- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Validate composer.json
run: composer validate

- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Install dependencies
run: composer install --prefer-dist --no-interaction

# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md
- name: List Installed Dependencies
run: composer show -D

# - name: Run test suite
# run: composer run-script test
- name: Execute tests
run: composer test
47 changes: 0 additions & 47 deletions .github/workflows/symfony.yml

This file was deleted.

0 comments on commit 99ce01c

Please sign in to comment.