Merge pull request #262 from jrfnl/feature/phpunit-gitignore-cache #167
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: | |
schedule: | |
- cron: '0 0 1 * 0' | |
push: | |
branches: [ main ] | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
phpcs: | |
name: 'PHPCS' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up PHP environment | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 'latest' | |
coverage: none | |
tools: cs2pr | |
- name: Install Composer dependencies & cache dependencies | |
uses: "ramsey/composer-install@v3" | |
with: | |
composer-options: "--prefer-dist" | |
env: | |
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }} | |
- name: Run Code Sniffer | |
id: phpcs | |
run: ./vendor/bin/phpcs -ps --report-full --report-checkstyle=./phpcs-report.xml | |
- name: Show PHPCS results in PR | |
if: ${{ always() && steps.phpcs.outcome == 'failure' }} | |
run: cs2pr ./phpcs-report.xml | |
build: | |
strategy: | |
matrix: | |
php: ['5.6', '7.3', '7.4', '8.0', '8.1'] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up PHP environment | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '${{ matrix.php }}' | |
tools: composer | |
extensions: 'xdebug' | |
- uses: actions/checkout@v4 | |
- name: Install Composer dependencies & cache dependencies | |
uses: "ramsey/composer-install@v3" | |
with: | |
composer-options: "--prefer-dist" | |
custom-cache-key: "{{ runner.os }}-composer-${{ matrix.php }}" | |
env: | |
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }} | |
- name: Validate composer.json and composer.lock | |
#run: composer validate --strict # Currently we’re installing mf2/tests from a commit ref. | |
run: composer validate | |
- name: Run Test Suite | |
run: XDEBUG_MODE=coverage ./vendor/bin/phpunit tests --coverage-text | |
#- name: Run Static Analysis | |
# run: ./vendor/bin/psalm |