Skip to content

Commit

Permalink
Merge branch 'master' into phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparsd authored Sep 18, 2024
2 parents 9ac7c2d + 3437c77 commit 65ea7ad
Show file tree
Hide file tree
Showing 22 changed files with 15,076 additions and 15,477 deletions.
1 change: 0 additions & 1 deletion .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/node_modules/
/tests/
/vendor/
/wordpress/

# Files
.*
Expand Down
159 changes: 127 additions & 32 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,142 @@ name: Test

on: [push, pull_request]

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
lint-js-css:
name: Lint JS & CSS
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Install NPM dependencies
run: npm install

- name: Lint JS
run: npm run lint:js

- name: Lint CSS
run: npm run lint:css

lint-php-and-compatibility:
name: Lint PHP & PHP Compatibility checks.
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP and Composer
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

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

- name: Install NPM dependencies
run: npm install

- name: Lint PHP
run: npm run lint:php || true # Ignore for now.

- name: Lint PHP Compatibility
run: composer lint-compat

test-php:
name: Test PHP ${{ matrix.php }} ${{ matrix.wp != '' && format( ' (WP {0}) ', matrix.wp ) || '' }}
runs-on: ubuntu-latest
strategy:
matrix:
php:
- '8.3'
- '8.2'
- '8.1'
- '8.0'
- '7.4'
- '7.3'
- '7.2'
wp:
- latest
- trunk
- '6.3'
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wp == 'trunk' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wp ) }}

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

lint:
name: Lint and Test
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version-file: '.nvmrc'

- name: Setup Node
uses: actions/setup-node@v3
with:
cache: 'npm'
node-version-file: '.nvmrc'
- name: Install NPM dependencies
run: npm install

- name: Setup PHP and Composer
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer:v2
- name: Start the Docker testing environment
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: npm run env start

- name: Install NPM dependencies
run: npm install
- name: Composer install
run: |
rm composer.lock || true # We need to install fresh.
npm run composer install
- name: Lint JS
run: npm run lint:js
- name: Versions
run: |
npm run env run cli php -- -v
npm run env run cli wp core version
- name: Lint CSS
run: npm run lint:css
- name: Test
run: npm run test

- name: Lint PHP
run: npm run lint:php || true # Ignore for now.
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Lint PHP Compatibility
run: composer lint-compat
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

- name: Start the Docker testing environment
run: npm run env start --xdebug=coverage
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version-file: '.nvmrc'

- name: Test
run: npm run test
- name: Install NPM dependencies
run: npm install

- name: Build
run: npm run build
- name: Build
run: npm run build
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
/vendor/
/dist/
/tests/logs/
/wordpress/
.phpunit.result.cache
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
20
14 changes: 12 additions & 2 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"core": "./wordpress",
"phpVersion": "7.4",
"plugins": [ "." ]
"plugins": [ "." ],
"env": {
"tests": {
"config": {
"WP_DEBUG": true,
"WP_TESTS_EMAIL": "admin@example.org",
"WP_TESTS_DOMAIN": "example.org",
"WP_SITEURL": "https://example.org",
"WP_HOME": "https://example.org"
}
}
}
}
34 changes: 0 additions & 34 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ module.exports = function( grunt ) {
invert: true,
} );

/**
* Check if CLI input appears to indicate a truthy value.
*
* @param {string} input Value to check.
* @return {boolean} If value appears to be truthy.
*/
function isTruthy( input ) {
return ( '1' === input || 'true' === input );
}

grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),

Expand All @@ -47,23 +37,6 @@ module.exports = function( grunt ) {
],
},
},

wp_deploy: {
options: {
plugin_slug: 'two-factor',
build_dir: '<%= dist_dir %>',
assets_dir: 'assets',
},
wporg: {
options: {
skip_confirmation: isTruthy( process.env.DEPLOY_SKIP_CONFIRMATION ),
svn_user: process.env.DEPLOY_SVN_USERNAME,
deploy_tag: isTruthy( process.env.DEPLOY_TAG ),
deploy_trunk: isTruthy( process.env.DEPLOY_TRUNK ),
assets_dir: ( isTruthy( process.env.DEPLOY_TAG ) || isTruthy( process.env.DEPLOY_TRUNK ) ) ? 'assets' : null,
},
},
},
} );

grunt.registerTask(
Expand All @@ -72,11 +45,4 @@ module.exports = function( grunt ) {
'copy',
]
);

grunt.registerTask(
'deploy', [
'build',
'wp_deploy',
]
);
};
Loading

0 comments on commit 65ea7ad

Please sign in to comment.