Skip to content

GH Actions: only run PHPCS once + update CS dependencies #156

GH Actions: only run PHPCS once + update CS dependencies

GH Actions: only run PHPCS once + update CS dependencies #156

Workflow file for this run

name: Build
on:
schedule:
- cron: '0 0 1 * 0'
push:
branches: [ main ]
pull_request:
branches: [ main ]
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@v2
- name: Install Composer dependencies & cache dependencies
uses: "ramsey/composer-install@v2"
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