Skip to content

Feature/rsvp block variation #2255

Feature/rsvp block variation

Feature/rsvp block variation #2255

name: Coding Standards
on:
push:
branches:
- main
pull_request:
paths:
- '.github/workflows/coding-standards.yml'
- 'includes/**'
- 'src/**'
- 'test/**'
- 'package.*'
- '*.js'
- '*.php'
jobs:
phpcs:
name: PHP Coding Standards
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Set up Composer caching
uses: actions/cache@v4
env:
cache-name: cache-composer-dependencies
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr
- name: Install Composer dependencies
run: |
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
echo "vendor/bin" >> $GITHUB_PATH
- name: Log PHPCS debug information
run: phpcs -i
- name: Run PHPCS on all Core files
run: vendor/bin/phpcs --standard=phpcs.ruleset.xml --extensions=php --colors -s -p -v .
- name: Check test suite files for warnings
run: vendor/bin/phpcs test --standard=phpcs.ruleset.xml --extensions=php --colors -s -p -v .
jshint:
name: JavaScript Coding Standards
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log debug information
run: |
npm --version
node --version
git --version
php --version
composer --version
- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
# Enable built-in functionality for caching and restoring dependencies, which is disabled by default.
# The actions/setup-node uses actions/cache under the hood.
# https://github.com/actions/setup-node#caching-global-packages-data
cache: 'npm'
# Restoring the short lived node_modules cache
# to be used across all workflows running on the last commit.
# https://github.com/actions/cache/blob/main/caching-strategies.md#creating-a-short-lived-cache
- uses: actions/cache/restore@v4
id: node_modules-cache
with:
path: |
./node_modules
key: ${{ runner.os }}-node_modules-${{ github.sha }}-${{ hashFiles('package-lock.json') }}
- name: NPM install
if: steps.node_modules-cache.outputs.cache-hit != 'true'
run: npm ci --legacy-peer-deps
# Creating a short lived node_modules cache
- uses: actions/cache/save@v4
if: steps.node_modules-cache.outputs.cache-hit != 'true'
with:
path: |
./node_modules
key: ${{ steps.node_modules-cache.outputs.cache-primary-key }}
- name: Run JSHint
run: npm run lint:js
if: ${{ success() || failure() }}
stylelint:
name: CSS Coding Standards
needs: jshint # Wait for jshint job, to make use of node_modules caching.
if: always() # Run always, even when the jshint job didn't ran.
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log debug information
run: |
npm --version
node --version
git --version
php --version
composer --version
- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
# Enable built-in functionality for caching and restoring dependencies, which is disabled by default.
# The actions/setup-node uses actions/cache under the hood.
# https://github.com/actions/setup-node#caching-global-packages-data
cache: 'npm'
# Restoring the short lived node_modules cache
# to be used across all workflows running on the last commit.
# https://github.com/actions/cache/blob/main/caching-strategies.md#creating-a-short-lived-cache
- uses: actions/cache/restore@v4
id: node_modules-cache
with:
path: |
./node_modules
key: ${{ runner.os }}-node_modules-${{ github.sha }}-${{ hashFiles('package-lock.json') }}
- name: NPM install
if: steps.node_modules-cache.outputs.cache-hit != 'true'
run: npm ci --legacy-peer-deps
# Creating a short lived node_modules cache
- uses: actions/cache/save@v4
if: steps.node_modules-cache.outputs.cache-hit != 'true'
with:
path: |
./node_modules
key: ${{ steps.node_modules-cache.outputs.cache-primary-key }}
- name: Run StyleLint
run: npm run lint:css
if: ${{ success() || failure() }}