Skip to content

Commit

Permalink
fix: CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Beru committed Mar 6, 2024
1 parent 662f097 commit 5c995d6
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 53 deletions.
121 changes: 68 additions & 53 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,76 +1,91 @@
name: CI
name: 'CI'

on:
push:
branches: [ 'main' ]
pull_request: ~
branches: ['main']
pull_request:
branches: ['main']

permissions:
contents: read
contents: 'read'

jobs:
test:
name: "Build and Test - PHP ${{ matrix.php }} Symfony:${{ matrix.symfony-version }} ${{ matrix.deps }}"
runs-on: ubuntu-latest
env:
SYMFONY_DEPRECATIONS_HELPER: max[direct]=0
strategy:
matrix:
include:
- symfony-version: 6.4
php: 8.2
deps: low
- symfony-version: 7.0
php: 8.2
deps: high
- symfony-version: 7.0
php: 8.3
deps: high

php-cs-fixer:
name: 'PHP CS Fixer'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- uses: 'actions/checkout@v4'

- name: Setup PHP
uses: shivammathur/setup-php@v2
- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '8.2'
coverage: 'none'

- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: 'Install dependencies'
uses: 'ramsey/composer-install@v3'

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: 'Run PHP CS Fixer'
run: 'php vendor/bin/php-cs-fixer fix -v --dry-run'

- name: Install dependencies
if: matrix.deps == 'high'
run: composer install
phpstan:
name: 'PHPStan'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v4'

- name: Install dependencies (min)
if: matrix.deps == 'low'
run: composer update --prefer-lowest --prefer-stable
- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '8.2'
coverage: 'none'

- name: Run test suite
run: php vendor/bin/phpunit
- name: 'Install dependencies'
uses: 'ramsey/composer-install@v3'

php-cs-fixer:
name: PHP CS Fixer
runs-on: ubuntu-latest
- name: 'Run PHPStan'
run: 'php vendor/bin/phpstan'

test:
name: 'Build and Test - PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony-version }} ${{ matrix.deps }}'
runs-on: 'ubuntu-latest'
strategy:
matrix:
symfony-version:
- '^7.0'
php:
- '8.2'
- '8.3'
deps:
- 'lowest'
- 'highest'
include:
# LTS
- symfony-version: '^5.4'
php: '8.2'
deps: 'highest'
- symfony-version: '^6.4'
php: '8.2'
deps: 'highest'
env:
SYMFONY_REQUIRE: '${{ matrix.symfony-version }}'
steps:
- uses: actions/checkout@v4
- uses: 'actions/checkout@v4'

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

- name: Install dependencies
run: composer install
- name: 'Validate composer.json and composer.lock'
run: 'composer validate --strict'

- name: Run PHP CS Fixer
run: php vendor/bin/php-cs-fixer fix -v --dry-run --stop-on-violation
- name: 'Install dependencies'
uses: 'ramsey/composer-install@v3'
with:
dependency-versions: '${{ matrix.deps }}'

- name: Run test suite
run: php vendor/bin/phpstan
- name: 'Run test suite'
run: 'php vendor/bin/phpunit'
45 changes: 45 additions & 0 deletions .github/workflows/scheduled_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 'Scheduled CI'

on:
schedule:
- cron: '0 0 * * *'

permissions:
contents: 'read'

jobs:

test:
name: 'Build and Test - PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony-version }} ${{ matrix.deps }}'
runs-on: 'ubuntu-latest'
strategy:
matrix:
symfony-version:
- '^7.0'
php:
- '8.2'
- '8.3'
deps:
- 'lowest'
- 'highest'
env:
SYMFONY_REQUIRE: '${{ matrix.symfony-version }}'
steps:
- uses: 'actions/checkout@v4'

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

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

- name: 'Install dependencies'
uses: 'ramsey/composer-install@v3'
with:
dependency-versions: 'highest'

- name: 'Run test suite'
run: 'php vendor/bin/phpunit'
4 changes: 4 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
failOnWarning="true">
<php>
<ini name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=0"/>
</php>

<testsuites>
<testsuite name="default">
<directory>tests</directory>
Expand Down

0 comments on commit 5c995d6

Please sign in to comment.