Skip to content

Commit

Permalink
Simplify CI
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed May 15, 2024
1 parent 090d75e commit 05afad3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 70 deletions.
70 changes: 2 additions & 68 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ master ]

jobs:
lint:
tests:
runs-on: ubuntu-latest
name: 'Lint'
steps:
Expand All @@ -28,7 +28,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.3'
coverage: pcov

- name: Install dependencies
Expand All @@ -40,76 +40,10 @@ jobs:
- name: PHP-CS-Fixer
run: ./vendor/bin/php-cs-fixer fix --dry-run

- name: test coverage
run: |
./vendor/bin/phpunit --coverage-clover=coverage.xml
bash <(curl -s https://codecov.io/bash)
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Infection
run: ./vendor/bin/infection --min-msi=100
env:
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}

- name: PHPStan
run: ./vendor/bin/phpstan

tests:
runs-on: ubuntu-latest
name: 'PHP: ${{ matrix.php }}; Laravel: ${{ matrix.laravel }}; Prefer: ${{ matrix.prefer }}'
strategy:
matrix:
php: ['8.1', '8.2', '8.3']
laravel: ['^10.0', '^11.0']
prefer: ['prefer-lowest', 'prefer-stable']
include:
- laravel: '^10.0'
testbench: '^8.0'
- laravel: '^11.0'
testbench: '^9.0'
exclude:
- php: '8.3'
laravel: '^10.0'
- php: '8.1'
laravel: '^11.0'

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

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.prefer }}-php-${{ matrix.php }}-phpunit-${{ matrix.phpunit }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.prefer }}-php-${{ matrix.php }}-phpunit-${{ matrix.phpunit }}-

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Support prefer-lowest in PHP 8.1
if: ${{ matrix.php == 8.1 && matrix.prefer == 'prefer-lowest' }}
run: composer require --no-update --no-scripts phpunit/phpunit:">=9.0" symfony/http-foundation:">=5.3.7" illuminate/http:">=8.62.0" nesbot/carbon:">=2.51.0"

- name: Setup PHPUnit configuration
if: matrix.phpunit == '^9.0'
run: cp --force phpunit.9.xml.dist phpunit.xml.dist

- name: Install dependencies
run: |
composer require --no-update 'illuminate/support:${{ matrix.laravel }}' 'orchestra/testbench:${{ matrix.testbench }}'
composer update --${{ matrix.prefer }} --no-scripts
- name: Check platform requirements
run: composer check-platform-reqs

- name: Run tests
run: ./vendor/bin/phpunit
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
/.phpunit.result.cache
/.phpunit.cache
/.php_cs.cache
/coverage
/infection.log
/.php-cs-fixer.cache
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Read more about the why in my blog post [Rethinking Laravel's middleware argumen

## Version support

- **PHP**: 8.2, 8.3
- **PHP**: 8.1, 8.2, 8.3
- **Laravel**: 10.0, 11.0

## Installation
Expand Down

0 comments on commit 05afad3

Please sign in to comment.