Release: 2.0.1 #1072
Workflow file for this run
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: Linting | |
env: | |
COMPOSER_VERSION: "2" | |
COMPOSER_CACHE: "${{ github.workspace }}/.composer-cache" | |
on: | |
push: | |
branches: | |
- develop | |
- trunk | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
eslint: | |
name: eslint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use desired version of NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Cache Node | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
~/.cache | |
~/.npm | |
key: ${{ hashFiles('package-lock.json') }} | |
- name: Check versions | |
run: npm -v; node -v | |
- name: npm install | |
run: npm install | |
- name: Generate linting report | |
run: npm run lint:js -- --output-file eslint-report.json --format json | |
continue-on-error: true | |
- name: Annotate code linting results | |
uses: ataylorme/[email protected] | |
with: | |
repo-token: '${{ secrets.GITHUB_TOKEN }}' | |
report-json: 'eslint-report.json' | |
- name: Update summary | |
run: | | |
npm_config_yes=true npx github:10up/eslint-json-to-md --path ./eslint-report.json --output ./eslint-report.md | |
cat eslint-report.md >> $GITHUB_STEP_SUMMARY | |
if: ${{ failure() }} | |
phpcs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- id: changed-files | |
uses: tj-actions/changed-files@v36 | |
with: | |
files: | | |
**/*.php | |
- name: Set PHP version | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 7.4 | |
tools: composer:v2, cs2pr | |
coverage: none | |
- name: Install dependencies | |
run: composer install | |
- name: Test all files | |
if: ${{ github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/trunk' }} | |
run: ./vendor/bin/phpcs . --report-full --report-checkstyle=./.github/phpcs-report.xml | |
- name: Test changed files | |
if: ${{ steps.changed-files.outputs.any_changed == 'true' && github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/trunk' }} | |
run: ./vendor/bin/phpcs ${{ steps.changed-files.outputs.all_changed_files }} --report-full --report-checkstyle=./.github/phpcs-report.xml --runtime-set testVersion 7.4- | |
- name: Show PHPCS results in PR | |
if: ${{ always() }} | |
run: cs2pr ./.github/phpcs-report.xml |