Fix remaining CI/CD issues
- Add yoast/phpunit-polyfills ^2.0 to composer.json for WordPress test suite compatibility - Define WP_TESTS_PHPUNIT_POLYFILLS_PATH in bootstrap.php before loading WP test framework - Update actions/cache to v4 (deprecated SHA references cause failures) - Update actions/setup-java to v4 - Update codacy/codacy-analysis-cli-action to v4 tag (SHA ref not found) - Update github/codeql-action/upload-sarif to v3
This commit is contained in:
8
.github/workflows/code-quality.yml
vendored
8
.github/workflows/code-quality.yml
vendored
@@ -97,13 +97,13 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Cache SonarCloud packages
|
||||
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v3.3.2
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.sonar/cache
|
||||
key: ${{ runner.os }}-sonar
|
||||
@@ -154,7 +154,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Run Codacy Analysis CLI
|
||||
uses: codacy/codacy-analysis-cli-action@5cc54a75f9ad8e86bb795a5d3d4f2f70c9baa1a7 # v4.3.0
|
||||
uses: codacy/codacy-analysis-cli-action@v4
|
||||
with:
|
||||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||
verbose: true
|
||||
@@ -169,7 +169,7 @@ jobs:
|
||||
|
||||
- name: Upload SARIF results file
|
||||
if: steps.check_codacy_token.outputs.skip_upload != 'true'
|
||||
uses: github/codeql-action/upload-sarif@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.2.7
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
continue-on-error: true
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.5.0",
|
||||
"yoast/phpunit-polyfills": "^2.0",
|
||||
"10up/wp_mock": "^1.0",
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
|
||||
"wp-coding-standards/wpcs": "^3.0",
|
||||
|
||||
@@ -10,6 +10,11 @@ require_once dirname( dirname( __DIR__ ) ) . '/vendor/autoload.php';
|
||||
|
||||
// Check if we're running the WordPress tests
|
||||
if ( getenv( 'WP_PHPUNIT__DIR' ) ) {
|
||||
// Define PHPUnit Polyfills path for WordPress test suite.
|
||||
if ( ! defined( 'WP_TESTS_PHPUNIT_POLYFILLS_PATH' ) ) {
|
||||
define( 'WP_TESTS_PHPUNIT_POLYFILLS_PATH', dirname( dirname( __DIR__ ) ) . '/vendor/yoast/phpunit-polyfills/' );
|
||||
}
|
||||
|
||||
// Give access to tests_add_filter() function.
|
||||
require_once getenv( 'WP_PHPUNIT__DIR' ) . '/includes/functions.php';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user