diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index bd260800ca..67c41200b5 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -55,6 +55,7 @@ jobs: # - Logs PHP_CodeSniffer debug information. # - Runs PHPCS on the full codebase with warnings suppressed. # - Runs PHPCS on the `tests` directory without warnings suppressed. + # - Ensures version-controlled files are not modified or deleted. # - todo: Configure Slack notifications for failing scans. phpcs: name: PHP coding standards @@ -94,6 +95,9 @@ jobs: - name: Check test suite files for warnings run: phpcs tests -q --report=checkstyle | cs2pr + - name: Ensure version-controlled files are not modified during the tests + run: git diff --exit-code + # Runs the JavaScript coding standards checks. # # JSHint violations are not currently reported inline with annotations. @@ -105,6 +109,7 @@ jobs: # - Logs updated debug information. # _ Installs NPM dependencies using install-changed to hash the `package.json` file. # - Run the WordPress JSHint checks. + # - Ensures version-controlled files are not modified or deleted. # - todo: Configure Slack notifications for failing tests. jshint: name: JavaScript coding standards @@ -140,3 +145,6 @@ jobs: - name: Run JSHint run: npm run grunt jshint + + - name: Ensure version-controlled files are not modified or deleted + run: git diff --exit-code diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index c3f1f09ecf..12b6355641 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -45,6 +45,7 @@ jobs: # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container). # - Install WordPress within the Docker container. # - Run the E2E tests. + # - Ensures version-controlled files are not modified or deleted. # - todo: Configure Slack notifications for failing tests. e2e-tests: name: E2E Tests @@ -113,3 +114,6 @@ jobs: - name: Run E2E tests run: npm run test:e2e + + - name: Ensure version-controlled files are not modified or deleted + run: git diff --exit-code diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index d5ad21c0e7..06eb81bd19 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -49,6 +49,7 @@ jobs: # - Logs updated debug information. # _ Installs NPM dependencies using install-changed to hash the `package.json` file. # - Run the WordPress QUnit tests. + # - Ensures version-controlled files are not modified or deleted. # - todo: Configure Slack notifications for failing tests. test-js: name: QUnit Tests @@ -82,3 +83,6 @@ jobs: - name: Run QUnit tests run: npm run grunt qunit:compiled + + - name: Ensure version-controlled files are not modified or deleted + run: git diff --exit-code diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml index b7c35fdd9f..cb6409d954 100644 --- a/.github/workflows/php-compatibility.yml +++ b/.github/workflows/php-compatibility.yml @@ -49,6 +49,7 @@ jobs: # - Make Composer packages available globally. # - Logs PHP_CodeSniffer debug information. # - Runs the PHP compatibility tests. + # - Ensures version-controlled files are not modified or deleted. # - todo: Configure Slack notifications for failing scans. php-comatibility: name: Check PHP compatibility @@ -84,3 +85,6 @@ jobs: - name: Run PHP compatibility tests run: phpcs --standard=phpcompat.xml.dist -q --report=checkstyle | cs2pr + + - name: Ensure version-controlled files are not modified or deleted + run: git diff --exit-code diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index f57316fcb9..2f29086f72 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -55,6 +55,7 @@ jobs: # - Logs debug information about what's installed within the WordPress Docker containers. # - Install WordPress within the Docker container. # - Run the PHPUnit tests. + # - Ensures version-controlled files are not modified or deleted. # - Checks out the WordPress Test reporter repository. # - Reconnect the directory to the Git repository. # - Submit the test results to the WordPress.org host test results. @@ -221,6 +222,9 @@ jobs: if: ${{ ! matrix.split_slow }} run: LOCAL_PHP_XDEBUG=true npm run test:${{ env.PHPUNIT_SCRIPT }} -- -v --group xdebug --exclude-group __fakegroup__ + - name: Ensure version-controlled files are not modified or deleted + run: git diff --exit-code + - name: Checkout the WordPress Test Reporter if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml index 67a53c4a0b..e82fa1e1e4 100644 --- a/.github/workflows/test-coverage.yml +++ b/.github/workflows/test-coverage.yml @@ -43,8 +43,10 @@ jobs: # - Logs debug information about what's installed within the WordPress Docker containers. # - Install WordPress within the Docker container. # - Run the PHPUnit tests as a single site. + # - Ensures version-controlled files are not modified or deleted. # - Upload the single site code coverage report to Codecov.io. # - Run the PHPUnit tests as a multisite. + # - Ensures version-controlled files are not modified or deleted. # - Upload the multisite code coverage report to Codecov.io. test-coverage-report: name: ${{ matrix.multisite && 'Multisite' || 'Single site' }} report @@ -121,6 +123,9 @@ jobs: if: ${{ ! matrix.multisite }} run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --coverage-clover wp-code-coverage-single-clover-${{ github.sha }}.xml + - name: Ensure version-controlled files are not modified during the tests + run: git diff --exit-code + - name: Upload single site report to Codecov if: ${{ ! matrix.multisite }} uses: codecov/codecov-action@e156083f13aff6830c92fc5faa23505779fbf649 # v1.2.1 @@ -132,6 +137,9 @@ jobs: if: ${{ matrix.multisite }} run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --coverage-clover wp-code-coverage-multisite-clover-${{ github.sha }}.xml + - name: Ensure version-controlled files are not modified during the tests + run: git diff --exit-code + - name: Upload multisite report to Codecov if: ${{ matrix.multisite }} uses: codecov/codecov-action@e156083f13aff6830c92fc5faa23505779fbf649 # v1.2.1 diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml index c806e13c55..3774ee2851 100644 --- a/.github/workflows/test-npm.yml +++ b/.github/workflows/test-npm.yml @@ -45,8 +45,10 @@ jobs: # _ Installs NPM dependencies using install-changed to hash the `package.json` file. # - Builds WordPress to run from the `build` directory. # - Cleans up after building WordPress to the `build` directory. + # - Ensures version-controlled files are not modified or deleted. # - Builds WordPress to run from the `src` directory. # - Cleans up after building WordPress to the `src` directory. + # - Ensures version-controlled files are not modified or deleted. test-npm: name: Test NPM on ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -83,12 +85,18 @@ jobs: - name: Clean after building run: npm run grunt clean + - name: Ensure version-controlled files are not modified or deleted during building and cleaning + run: git diff --exit-code + - name: Build WordPress in /src run: npm run build:dev - name: Clean after building in /src run: npm run grunt clean -- --dev + - name: Ensure version-controlled files are not modified or deleted during building and cleaning + run: git diff --exit-code + # Verifies that installing NPM dependencies and building WordPress works as expected on MacOS. # # This is a separate job in order to that more strict conditions can be used. @@ -100,8 +108,10 @@ jobs: # _ Installs NPM dependencies using install-changed to hash the `package.json` file. # - Builds WordPress to run from the `build` directory. # - Cleans up after building WordPress to the `build` directory. + # - Ensures version-controlled files are not modified or deleted. # - Builds WordPress to run from the `src` directory. # - Cleans up after building WordPress to the `src` directory. + # - Ensures version-controlled files are not modified or deleted. test-npm-macos: name: Test NPM on MacOS runs-on: macos-latest @@ -133,8 +143,14 @@ jobs: - name: Clean after building run: npm run grunt clean + - name: Ensure version-controlled files are not modified or deleted during building and cleaning + run: git diff --exit-code + - name: Build WordPress in /src run: npm run build:dev - name: Clean after building in /src run: npm run grunt clean -- --dev + + - name: Ensure version-controlled files are not modified or deleted during building and cleaning + run: git diff --exit-code diff --git a/.github/workflows/test-old-branches.yml b/.github/workflows/test-old-branches.yml index 2bb5664a98..3478439a42 100644 --- a/.github/workflows/test-old-branches.yml +++ b/.github/workflows/test-old-branches.yml @@ -69,3 +69,6 @@ jobs: workflow_id: '${{ matrix.workflow }}', ref: '${{ matrix.branch }}' }); + + - name: Ensure version-controlled files are not modified during the tests + run: git diff --exit-code diff --git a/Gruntfile.js b/Gruntfile.js index a24e701e06..349328d145 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -122,7 +122,8 @@ module.exports = function(grunt) { WORKING_DIR + 'wp-includes/js/' ], 'webpack-assets': [ - WORKING_DIR + 'wp-includes/assets/' + WORKING_DIR + 'wp-includes/assets/*', + '!' + WORKING_DIR + 'wp-includes/assets/script-loader-packages.php' ], dynamic: { dot: true,