diff --git a/.github/workflows/reusable-check-built-files.yml b/.github/workflows/reusable-check-built-files.yml index 033b2a46ac3e9..5a673bf496ace 100644 --- a/.github/workflows/reusable-check-built-files.yml +++ b/.github/workflows/reusable-check-built-files.yml @@ -24,9 +24,10 @@ jobs: # - Builds Emoji files. # - Builds bundled Root Certificate files. # - Builds WordPress. - # - Checks for changes to versioned files. - # - Displays the result of git diff for debugging purposes. - # - Saves the diff to a patch file. + # - Checks for uncommitted changes. + # - Stages all uncommitted changes and adds any unversioned files. + # - Displays a diff of all staged changes. + # - Saves staged changes to a .diff file. # - Uploads the patch file as an artifact. update-built-files: name: Check and update built files @@ -78,22 +79,26 @@ jobs: - name: Build WordPress run: npm run build:dev - - name: Check for changes to versioned files + - name: Check for uncommitted changes id: built-file-check run: | - if git diff --quiet; then + if [ -z "$(git status --porcelain)" ]; then echo "uncommitted_changes=false" >> "$GITHUB_OUTPUT" else echo "uncommitted_changes=true" >> "$GITHUB_OUTPUT" fi - - name: Display changes to versioned files + - name: Stage all changes for diff generation if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }} - run: git diff + run: git add -A + + - name: Display all uncommitted changes + if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }} + run: git diff --cached - name: Save diff to a file if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }} - run: git diff > ./changes.diff + run: git diff --cached --binary > ./changes.diff # Uploads the diff file as an artifact. - name: Upload diff file as artifact diff --git a/.github/workflows/reusable-coding-standards-javascript.yml b/.github/workflows/reusable-coding-standards-javascript.yml index eac5bbdc352f2..b15a5bacf6d46 100644 --- a/.github/workflows/reusable-coding-standards-javascript.yml +++ b/.github/workflows/reusable-coding-standards-javascript.yml @@ -24,7 +24,7 @@ jobs: # - Logs debug information about the GitHub Action runner. # - Installs npm dependencies. # - Run the WordPress JSHint checks. - # - Ensures version-controlled files are not modified or deleted. + # - Checks for any uncommitted changes. jshint: name: JavaScript checks runs-on: ubuntu-24.04 @@ -57,5 +57,10 @@ jobs: - name: Run JSHint run: npm run grunt jshint - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code + - name: Check for uncommitted changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected:" + git status --porcelain + exit 1 + fi diff --git a/.github/workflows/reusable-coding-standards-php.yml b/.github/workflows/reusable-coding-standards-php.yml index fab8bffb31e11..980d20b75f4b6 100644 --- a/.github/workflows/reusable-coding-standards-php.yml +++ b/.github/workflows/reusable-coding-standards-php.yml @@ -37,7 +37,7 @@ jobs: # - Generate a report for displaying issues as pull request annotations. # - Runs PHPCS on the `tests` directory without (warnings included). # - Generate a report for displaying `test` directory issues as pull request annotations. - # - Ensures version-controlled files are not modified or deleted. + # - Checks for any uncommitted changes. phpcs: name: PHP checks runs-on: ubuntu-24.04 @@ -105,5 +105,10 @@ jobs: if: ${{ inputs.old-branch }} run: phpcbf - - name: Ensure version-controlled files are not modified during the tests - run: git diff --exit-code + - name: Check for uncommitted changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected:" + git status --porcelain + exit 1 + fi diff --git a/.github/workflows/reusable-end-to-end-tests.yml b/.github/workflows/reusable-end-to-end-tests.yml index 87f90f1b53039..c39e03a6c0ab0 100644 --- a/.github/workflows/reusable-end-to-end-tests.yml +++ b/.github/workflows/reusable-end-to-end-tests.yml @@ -61,7 +61,7 @@ jobs: # - Install additional languages. # - Run the E2E tests. # - Uploads screenshots and HTML snapshots as an artifact. - # - Ensures version-controlled files are not modified or deleted. + # - Checks for any uncommitted changes. e2e-tests: name: SCRIPT_DEBUG ${{ inputs.LOCAL_SCRIPT_DEBUG && 'enabled' || 'disabled' }} runs-on: ubuntu-24.04 @@ -153,5 +153,10 @@ jobs: if-no-files-found: ignore include-hidden-files: true - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code + - name: Check for uncommitted changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected:" + git status --porcelain + exit 1 + fi diff --git a/.github/workflows/reusable-javascript-tests.yml b/.github/workflows/reusable-javascript-tests.yml index 3988ec9d6b055..d260dd71c4c11 100644 --- a/.github/workflows/reusable-javascript-tests.yml +++ b/.github/workflows/reusable-javascript-tests.yml @@ -25,7 +25,7 @@ jobs: # - Logs debug information about the GitHub Action runner. # - Installs npm dependencies. # - Run the WordPress QUnit tests. - # - Ensures version-controlled files are not modified or deleted. + # - Checks for any uncommitted changes. test-js: name: Run QUnit tests runs-on: ubuntu-24.04 @@ -67,5 +67,10 @@ 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 + - name: Check for uncommitted changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected:" + git status --porcelain + exit 1 + fi diff --git a/.github/workflows/reusable-javascript-type-checking-v1.yml b/.github/workflows/reusable-javascript-type-checking-v1.yml index 9dabd01e27fa0..d1f484c39c36c 100644 --- a/.github/workflows/reusable-javascript-type-checking-v1.yml +++ b/.github/workflows/reusable-javascript-type-checking-v1.yml @@ -23,7 +23,7 @@ jobs: # - Configures caching for TypeScript build info. # - Runs JavaScript type checking. # - Saves the TypeScript build info. - # - Ensures version-controlled files are not modified or deleted. + # - Checks for any uncommitted changes. typecheck: name: Run JavaScript type checking runs-on: ubuntu-24.04 @@ -72,5 +72,10 @@ jobs: *.tsbuildinfo key: "ts-build-info-${{ github.run_id }}" - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code + - name: Check for uncommitted changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected:" + git status --porcelain + exit 1 + fi diff --git a/.github/workflows/reusable-performance-test-v2.yml b/.github/workflows/reusable-performance-test-v2.yml index c0279c37fe64b..7bafb8fff4894 100644 --- a/.github/workflows/reusable-performance-test-v2.yml +++ b/.github/workflows/reusable-performance-test-v2.yml @@ -102,7 +102,7 @@ jobs: # - Install MU plugin. # - Run performance tests. # - Archive artifacts. - # - Ensure version-controlled files are not modified or deleted. + # - Checks for any uncommitted changes. performance: name: Test ${{ inputs.subject == 'base' && inputs.BASE_TAG || inputs.subject }} runs-on: ubuntu-24.04 @@ -272,5 +272,10 @@ jobs: if-no-files-found: error include-hidden-files: true - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code + - name: Check for uncommitted changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected:" + git status --porcelain + exit 1 + fi diff --git a/.github/workflows/reusable-php-compatibility.yml b/.github/workflows/reusable-php-compatibility.yml index 7756330282e6f..ed7cf3abbfae2 100644 --- a/.github/workflows/reusable-php-compatibility.yml +++ b/.github/workflows/reusable-php-compatibility.yml @@ -30,7 +30,7 @@ jobs: # - Make Composer packages available globally. # - Runs the PHP compatibility tests. # - Generate a report for displaying issues as pull request annotations. - # - Ensures version-controlled files are not modified or deleted. + # - Checks for any uncommitted changes. php-compatibility: name: Run compatibility checks runs-on: ubuntu-24.04 @@ -86,5 +86,10 @@ jobs: if: ${{ always() && steps.phpcs.outcome == 'failure' }} run: cs2pr ./.cache/phpcs-compat-report.xml - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code + - name: Check for uncommitted changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected:" + git status --porcelain + exit 1 + fi diff --git a/.github/workflows/reusable-phpstan-static-analysis-v1.yml b/.github/workflows/reusable-phpstan-static-analysis-v1.yml index c73c1e5e692fe..e2976df943817 100644 --- a/.github/workflows/reusable-phpstan-static-analysis-v1.yml +++ b/.github/workflows/reusable-phpstan-static-analysis-v1.yml @@ -33,7 +33,7 @@ jobs: # - Configures caching for PHPStan static analysis scans. # - Runs PHPStan static analysis (with Pull Request annotations). # - Saves the PHPStan result cache. - # - Ensures version-controlled files are not modified or deleted. + # - Checks for any uncommitted changes. phpstan: name: Run PHP static analysis runs-on: ubuntu-24.04 @@ -102,5 +102,10 @@ jobs: path: .cache key: "phpstan-result-cache-${{ github.run_id }}" - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code + - name: Check for uncommitted changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected:" + git status --porcelain + exit 1 + fi diff --git a/.github/workflows/reusable-phpunit-tests-v2.yml b/.github/workflows/reusable-phpunit-tests-v2.yml index 5e078b6ef0c2e..21f71546bdb2d 100644 --- a/.github/workflows/reusable-phpunit-tests-v2.yml +++ b/.github/workflows/reusable-phpunit-tests-v2.yml @@ -84,7 +84,7 @@ jobs: # - Logs debug information from inside the WordPress Docker container. # - Install WordPress within the Docker container. # - Run the PHPUnit tests. - # - Ensures version-controlled files are not modified or deleted. + # - Checks for any uncommitted changes. test-php: name: PHP ${{ inputs.php }} / ${{ inputs.multisite && ' Multisite' || 'Single Site' }}${{ inputs.split_slow && ' slow tests' || '' }}${{ inputs.memcached && ' with memcached' || '' }} runs-on: ${{ inputs.os }} @@ -208,5 +208,10 @@ jobs: if: ${{ ! inputs.split_slow }} run: LOCAL_PHP_XDEBUG=true npm run "test:${PHPUNIT_SCRIPT}" -- -v --group xdebug --exclude-group __fakegroup__ - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code + - name: Check for uncommitted changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected:" + git status --porcelain + exit 1 + fi diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index 64507323a617b..e08ef2d3c6824 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -113,7 +113,7 @@ jobs: # - Install WordPress within the Docker container. # - Run the PHPUnit tests. # - Upload the code coverage report to Codecov.io. - # - Ensures version-controlled files are not modified or deleted. + # - Checks for any uncommitted changes. # - Checks out the WordPress Test reporter repository. # - Submit the test results to the WordPress.org host test results. phpunit-tests: @@ -268,8 +268,13 @@ jobs: flags: ${{ inputs.multisite && 'multisite' || 'single' }},php fail_ci_if_error: true - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code + - name: Check for uncommitted changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected:" + git status --porcelain + exit 1 + fi - name: Checkout the WordPress Test Reporter if: ${{ github.ref == 'refs/heads/trunk' && inputs.report }} diff --git a/.github/workflows/reusable-test-core-build-process.yml b/.github/workflows/reusable-test-core-build-process.yml index 1566d1583a807..e931f43145050 100644 --- a/.github/workflows/reusable-test-core-build-process.yml +++ b/.github/workflows/reusable-test-core-build-process.yml @@ -49,15 +49,16 @@ jobs: # Verifies that installing npm dependencies and building WordPress works as expected. # # Performs the following steps: + # - Prevent line ending conversions (Windows only). # - Checks out the repository. # - Sets up Node.js. # - Logs debug information about the GitHub Action runner. # - Installs npm dependencies. # - Builds WordPress to run from the desired location (src or build). - # - Ensures version-controlled files are not modified or deleted. + # - Checks for any uncommitted changes after building. # - Creates a ZIP of the built WordPress files (when building to the build directory). # - Cleans up after building WordPress. - # - Ensures version-controlled files are not modified or deleted. + # - Checks for any uncommitted changes after cleaning. # - Uploads the ZIP as a GitHub Actions artifact (when building to the build directory). # - Saves the pull request number to a text file. # - Uploads the pull request number as an artifact. @@ -69,6 +70,13 @@ jobs: timeout-minutes: 20 steps: + # Windows can convert LF to CRLF on checkout, which can make built/generated files appear as modified. + - name: Prevent line ending conversions on Windows + if: ${{ contains( inputs.os, 'windows-' ) }} + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -119,8 +127,14 @@ jobs: - name: Build WordPress to run from ${{ inputs.directory }} run: npm run ${{ inputs.directory == 'src' && 'build:dev' || 'build' }} - - name: Ensure version-controlled files are not modified or deleted during building - run: git diff --exit-code + - name: Check for uncommitted changes after building + shell: bash + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected:" + git status --porcelain + exit 1 + fi - name: Create ZIP of built files if: ${{ inputs.directory == 'build' && contains( inputs.os, 'ubuntu-' ) }} @@ -129,8 +143,14 @@ jobs: - name: Clean after building to run from ${{ inputs.directory }} run: npm run grunt ${{ inputs.directory == 'src' && 'clean -- --dev' || 'clean' }} - - name: Ensure version-controlled files are not modified or deleted during cleaning - run: git diff --exit-code + - name: Check for uncommitted changes after cleaning + shell: bash + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected:" + git status --porcelain + exit 1 + fi - name: Upload ZIP as a GitHub Actions artifact uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 diff --git a/.github/workflows/reusable-test-gutenberg-build-process.yml b/.github/workflows/reusable-test-gutenberg-build-process.yml index 4a780d08ee07f..ae5e4cd74d298 100644 --- a/.github/workflows/reusable-test-gutenberg-build-process.yml +++ b/.github/workflows/reusable-test-gutenberg-build-process.yml @@ -39,7 +39,7 @@ jobs: # - Installs Core npm dependencies. # - Builds WordPress to run from the relevant location (src or build). # - Builds Gutenberg. - # - Ensures version-controlled files are not modified or deleted. + # - Checks for any uncommitted changes after building. build-process-tests: name: ${{ contains( inputs.os, 'macos-' ) && 'MacOS' || contains( inputs.os, 'windows-' ) && 'Windows' || 'Linux' }} permissions: @@ -96,5 +96,11 @@ jobs: run: npm run build working-directory: ${{ env.GUTENBERG_DIRECTORY }} - - name: Ensure version-controlled files are not modified or deleted during building - run: git diff --exit-code + - name: Check for uncommitted changes after building + shell: bash + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected:" + git status --porcelain + exit 1 + fi diff --git a/.github/workflows/reusable-test-local-docker-environment-v1.yml b/.github/workflows/reusable-test-local-docker-environment-v1.yml index 8f1a556afa2b4..50118d45045ee 100644 --- a/.github/workflows/reusable-test-local-docker-environment-v1.yml +++ b/.github/workflows/reusable-test-local-docker-environment-v1.yml @@ -71,7 +71,7 @@ jobs: # - Runs a WP CLI command. # - Tests the logs command. # - Tests the reset command. - # - Ensures version-controlled files are not modified or deleted. + # - Checks for any uncommitted changes. local-docker-environment-tests: name: ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.memcached && ' with memcached' || '' }}${{ 'example.org' != inputs.tests-domain && format( ' {0}', inputs.tests-domain ) || '' }} permissions: @@ -166,5 +166,10 @@ jobs: - name: Reset the Docker environment run: npm run env:reset - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code + - name: Check for uncommitted changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected:" + git status --porcelain + exit 1 + fi diff --git a/.github/workflows/test-and-zip-default-themes.yml b/.github/workflows/test-and-zip-default-themes.yml index 1a44a8ff12e3a..604f531462a67 100644 --- a/.github/workflows/test-and-zip-default-themes.yml +++ b/.github/workflows/test-and-zip-default-themes.yml @@ -112,7 +112,12 @@ jobs: # - Sets up Node.js. # - Installs npm dependencies. # - Runs the theme build script. - # - Ensures version-controlled files are not modified or deleted. + # - Checks for uncommitted changes. + # - Stages all uncommitted changes and adds any unversioned files. + # - Displays a diff of all staged changes. + # - Saves staged changes to a .diff file. + # - Uploads the diff file as an artifact. + # - Fails the job when uncommitted changes are detected. test-build-scripts: name: Test ${{ matrix.theme }} build script runs-on: ubuntu-24.04 @@ -156,23 +161,27 @@ jobs: - name: Build theme run: npm run build - - name: Check for changes to versioned files + - name: Check for uncommitted changes id: built-file-check if: ${{ github.event_name == 'pull_request' }} run: | - if git diff --quiet; then + if [ -z "$(git status --porcelain)" ]; then echo "uncommitted_changes=false" >> "$GITHUB_OUTPUT" else echo "uncommitted_changes=true" >> "$GITHUB_OUTPUT" fi - - name: Display changes to versioned files + - name: Stage all changes for diff generation if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }} - run: git diff + run: git add -A + + - name: Display all uncommitted changes + if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }} + run: git diff --cached - name: Save diff to a file if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }} - run: git diff > ./changes.diff + run: git diff --cached --binary > ./changes.diff # Uploads the diff file as an artifact. - name: Upload diff file as artifact @@ -182,13 +191,21 @@ jobs: name: pr-built-file-changes path: src/wp-content/themes/${{ matrix.theme }}/changes.diff - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code + - name: Check for uncommitted changes after building + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Uncommitted changes detected after build:" + git status --porcelain + exit 1 + fi # Prepares bundled themes for release. # # Performs the following steps: # - Checks out the repository. + # - Sets up Node.js. + # - Installs npm dependencies. + # - Runs the theme build script. # - Uploads the theme files as a workflow artifact (files uploaded as an artifact are automatically zipped). bundle-theme: name: Create ${{ matrix.theme }} ZIP file diff --git a/.gitignore b/.gitignore index 15876fa47fee8..5a7f9b5aef66e 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,11 @@ wp-tests-config.php /artifacts /setup.log /coverage +/codecov +codecov.* +before.zip +wordpress.zip +wp-code-coverage-*.xml # Files and folders that get created in wp-content /src/wp-content/blogs.dir