Merge pull request #13 from hofff/dependabot/github_actions/actions/c… #25
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: Code Quality Diagnostics | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: PHP ${{ matrix.php }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- php: '8.0' | |
phpcq_install: 'update' | |
phpcq_flags: '' | |
- php: '8.1' | |
phpcq_install: 'update' | |
phpcq_flags: '' | |
- php: '8.2' | |
phpcq_install: 'update' | |
phpcq_flags: '' | |
steps: | |
- name: Pull source | |
uses: actions/checkout@v4 | |
- name: Setup PHP with PECL extension | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: xdebug2 | |
- name: Cache composer cache directory | |
uses: actions/cache@v4 | |
env: | |
cache-name: composer-cache-dir-${{ matrix.php }} | |
with: | |
path: ~/.cache/composer | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
- name: Install composer dependencies | |
run: composer install | |
- name: Cache vendor directory of phpcq tool runner | |
uses: actions/cache@v4 | |
env: | |
cache-name: vendor-${{ matrix.php }} | |
with: | |
path: $GITHUB_WORKSPACE/vendor | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
- name: Update phpcq | |
run: $GITHUB_WORKSPACE/vendor/bin/phpcq self-update --unsigned | |
- name: Install phpcq toolchain | |
run: $GITHUB_WORKSPACE/vendor/bin/phpcq ${{ matrix.phpcq_install }} -v | |
- name: Run tests | |
run: $GITHUB_WORKSPACE/vendor/bin/phpcq run -o github-action -o default ${{ matrix.phpcq_flags }} -v | |
- name: Upload build directory to artifact | |
uses: actions/upload-artifact@v4 | |
if: ${{ success() }} || ${{ failure() }} | |
with: | |
name: phpcq-builds-php-${{ matrix.php }} | |
path: .phpcq/build/ |