From 5c995d6c2aab3832ef07cd58238b0bdd82ab579b Mon Sep 17 00:00:00 2001 From: "hubert.lenoir" Date: Wed, 6 Mar 2024 18:43:59 +0100 Subject: [PATCH] fix: CI --- .github/workflows/ci.yaml | 121 ++++++++++++++++------------ .github/workflows/scheduled_ci.yaml | 45 +++++++++++ phpunit.xml | 4 + 3 files changed, 117 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/scheduled_ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 347c557..1a908eb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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' diff --git a/.github/workflows/scheduled_ci.yaml b/.github/workflows/scheduled_ci.yaml new file mode 100644 index 0000000..a01bfe8 --- /dev/null +++ b/.github/workflows/scheduled_ci.yaml @@ -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' diff --git a/phpunit.xml b/phpunit.xml index 04d743b..43c9b19 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -9,6 +9,10 @@ beStrictAboutOutputDuringTests="true" failOnRisky="true" failOnWarning="true"> + + + + tests