Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update our GitHub Action Workflows #810

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ hookdoc-conf.json export-ignore
LICENSE.md export-ignore
package-lock.json export-ignore
package.json export-ignore
phpcs-compat.xml.dist export-ignore
phpcs.xml.dist export-ignore
phpstan.neon.dist export-ignore
phpunit.xml.dist export-ignore
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -53,7 +53,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -67,4 +67,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3
1 change: 1 addition & 0 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- {name: 'WP latest', version: 'latest'}
- {name: 'WP minimum', version: 'WordPress/WordPress#6.1'}
- {name: 'WP trunk', version: 'WordPress/WordPress#master'}

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4

- name: Dependency Review
uses: actions/dependency-review-action@v4
with:
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: JS Linting

on:
push:
branches:
- develop
- trunk
paths:
- '**.js'
- '**.json'
pull_request:
branches:
- develop
paths:
- '**.js'
- '**.json'

jobs:
eslint:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node and npm cache
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm

- name: Install Node dependencies
run: npm ci --omit=optional

- name: Get updated JS files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
**/*.js
**/*.json

- name: Run JS linting
run: |
if [[ "${{ steps.changed-files.outputs.any_changed }}" == 'true' && "${{ github.event_name }}" == "pull_request" ]]; then
npx wp-scripts lint-js ${{ steps.changed-files.outputs.all_changed_files }}
elif [[ "${{ github.event_name }}" == "push" ]]; then
npm run lint:js
fi
107 changes: 0 additions & 107 deletions .github/workflows/lint.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/php-compat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: PHP Compatibility

on:
push:
branches:
- develop
- trunk
paths:
- "**.php"
pull_request:
branches:
- develop
paths:
- "**.php"

jobs:
php-compatibility:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup proper PHP version
uses: shivammathur/setup-php@v2
with:
php-version: 7.4

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}

- name: Install dependencies
run: composer install --prefer-dist

- name: Run PHP Compatibility
run: ./vendor/bin/phpcs --standard=./phpcs-compat.xml.dist -p .
68 changes: 68 additions & 0 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: PHP Linting

on:
push:
branches:
- develop
- trunk
paths:
- "**.php"
pull_request:
branches:
- develop
paths:
- "**.php"

jobs:
phpcs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup proper PHP version
uses: shivammathur/setup-php@v2
with:
php-version: 7.4

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
**/*.php

- name: Install dependencies
run: composer install --prefer-dist

- name: Run PHP_CodeSniffer
run: |
HEAD_REF=$(git rev-parse HEAD)
git checkout $HEAD_REF
./vendor/bin/phpcs-changed -s --git --git-base origin/${{ github.base_ref }} ${{ steps.changed-files.outputs.all_changed_files }}

vipcs:
name: vipcs
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: VIPCS check
uses: 10up/wpcs-action@stable
with:
enable_warnings: true
standard: 'WordPress-VIP-Go'
excludes: 'tests'
18 changes: 17 additions & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ on:
branches:
- develop
- trunk
paths:
- "**.php"
pull_request:
branches:
- develop
paths:
- "**.php"

jobs:

phpstan:
name: PHPStan
runs-on: ubuntu-latest
Expand All @@ -26,6 +29,19 @@ jobs:
coverage: none
tools: composer:v2

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
id: cache-composer
uses: actions/cache@v4
env:
cache-name: cache-composer
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }}

- name: Install dependencies
run: composer install

Expand Down
Loading
Loading