Merge branch 'refs/heads/update-ci' into migrate-to-openapi #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: ['8.1', '8.2', '8.3'] | |
composer: ['--prefer-lowest', ''] | |
steps: | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: curl, json, mbstring | |
coverage: xdebug | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Prepare Composer cache vars | |
id: composer | |
run: | | |
echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
echo "cache_key=composer-$(date +'%Y-%m-%d')-${{ matrix.php }}${{ matrix.composer }}-" >> $GITHUB_OUTPUT | |
- name: Cache Composer dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer.outputs.cache_dir }} | |
key: ${{ steps.composer.outputs.cache_key }}${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ steps.composer.outputs.cache_key }} | |
- name: Update Composer dependencies | |
run: composer update ${{ matrix.composer }} --prefer-dist --no-progress --no-suggest --no-interaction | |
- name: Run PHP Code Sniffer | |
run: composer run-script test:phpcs | |
if: success() | |
- name: Run PHPStan | |
run: composer run-script test:phpstan | |
if: success() || failure() | |
- name: Run PHPUnit with coverage | |
run: composer run-script test:phpunit | |
if: success() || failure() |