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

Upgrade tooling for WPCS 3.0 and PHP 8.0+ #60

Merged
merged 13 commits into from
Dec 10, 2023
Merged
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
8 changes: 4 additions & 4 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Ruby
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
with:
Expand All @@ -31,7 +31,7 @@ jobs:
bundler-cache: true
- name: Setup Pages
id: pages
uses: actions/configure-pages@v2
uses: actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d # v4.0.0
- name: Bundle install
run: |
cd docs
Expand All @@ -43,7 +43,7 @@ jobs:
env:
JEKYLL_ENV: production
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@a753861a5debcf57bf8b404356158c8e1e33150c # v2.0.0
with:
path: ./docs/_site

Expand All @@ -58,4 +58,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@13b55b33dd8996121833dbc1db458c793a334630 # v3.0.1
67 changes: 67 additions & 0 deletions .github/workflows/php-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: PHP Standards
on:
push:
branches:
- 'main'
paths:
- '**.php'
- '**.json'
pull_request:
branches:
- '**'
paths:
- '**.php'
- '**.json'

jobs:
build:
name: PHP Coding Standards
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Install PHP
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2.28.0
with:
php-version: '8.1'
tomjn marked this conversation as resolved.
Show resolved Hide resolved
coverage: none

- name: Echo PHP & Composer versions
run: |
php --version
php -m
composer --version

- name: Get Composer Cache Directory
id: composer-cache-dir
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache PHP Dependencies
id: composer-cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ${{ steps.composer-cache-dir.outputs.dir }}
key: ${{ runner.os }}-composer-7.2-${{ hashFiles('composer.lock') }}

- name: Install PHP Dependencies
run: |
composer install --prefer-dist --no-progress --no-suggest --no-interaction

- name: PHPCS cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: tests/cache
key: ${{ runner.os }}-phpcs-7.2-${{ hashFiles('plugin.php') }}

- name: Check the code for style issues
run: |
composer lint

- name: Run the tests
run: |
composer test
env:
MYSQL_DATABASE: wordpress
WP_TESTS_DB_PASS: root
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vendor/
docs/_site/
.bundle
.phpunit.result.cache
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Travis CI Configuration File
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need Travis if we have a php linting action?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit tests! 😁

dist: jammy

branches:
only:
Expand All @@ -8,9 +9,8 @@ branches:
language: php

php:
- 7.2
- 7.3
- 7.4
- 8.1
- 8.2

install: composer install

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Next

- Fix bug where passing an empty manifest to `enqueue_asset` or `register_asset` would fail with a TypeError.
- **Breaking**: Minimum supported PHP version is now PHP 8.1.
- Plugin should continue to work on 7.4 but there is no support guarantee, and the plugin's development tooling now requires at least 8.0.

## v0.6.4

- Point to specific commit for 3rd-party Github action
Expand Down
13 changes: 10 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@
"composer/installers": "^1.0 || ^2.0"
},
"require-dev": {
"humanmade/coding-standards": "^1.1.0",
"10up/wp_mock": "^0.4.2",
"phpunit/phpunit": "^7.5"
"10up/wp_mock": "^1.0.0",
"automattic/vipwpcs": "^3.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"phpcompatibility/php-compatibility": "dev-develop as 9.99.99",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"phpcsstandards/php_codesniffer": "^3.5",
"phpunit/phpunit": "^9.5",
"staabm/annotate-pull-request-from-checkstyle": "^1.8",
"wp-coding-standards/wpcs": "^3.0"
},
"scripts": {
"lint": "phpcs .",
"lint:fix": "phpcbf .",
"test": "phpunit"
},
"config": {
Expand Down
Loading
Loading