Make WordPress Core

Changeset 51355


Ignore:
Timestamp:
07/06/2021 06:36:46 PM (4 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Add assertions to ensure version-controlled files are not modified during CI, and fix the grunt clean command.

Some tests and some commands that run during the build steps modify files that are under version control. This adds assertions to ensure that these files don't remain in a modified state after the test runs on CI.

This also fixes the grunt clean command which erroneously deletes script-loader-packages.php. This file is re-populated during the build, but deleting it during the clean is undesirable.

Fixes #53606

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/coding-standards.yml

    r51341 r51355  
    5656  # - Runs PHPCS on the full codebase with warnings suppressed.
    5757  # - Runs PHPCS on the `tests` directory without warnings suppressed.
     58  # - Ensures version-controlled files are not modified or deleted.
    5859  # - todo: Configure Slack notifications for failing scans.
    5960  phpcs:
     
    9596        run: phpcs tests -q --report=checkstyle | cs2pr
    9697
     98      - name: Ensure version-controlled files are not modified during the tests
     99        run: git diff --exit-code
     100
    97101  # Runs the JavaScript coding standards checks.
    98102  #
     
    106110  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
    107111  # - Run the WordPress JSHint checks.
     112  # - Ensures version-controlled files are not modified or deleted.
    108113  # - todo: Configure Slack notifications for failing tests.
    109114  jshint:
     
    141146      - name: Run JSHint
    142147        run: npm run grunt jshint
     148
     149      - name: Ensure version-controlled files are not modified or deleted
     150        run: git diff --exit-code
  • trunk/.github/workflows/end-to-end-tests.yml

    r51341 r51355  
    4646  # - Install WordPress within the Docker container.
    4747  # - Run the E2E tests.
     48  # - Ensures version-controlled files are not modified or deleted.
    4849  # - todo: Configure Slack notifications for failing tests.
    4950  e2e-tests:
     
    114115      - name: Run E2E tests
    115116        run: npm run test:e2e
     117
     118      - name: Ensure version-controlled files are not modified or deleted
     119        run: git diff --exit-code
  • trunk/.github/workflows/javascript-tests.yml

    r51341 r51355  
    5050  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
    5151  # - Run the WordPress QUnit tests.
     52  # - Ensures version-controlled files are not modified or deleted.
    5253  # - todo: Configure Slack notifications for failing tests.
    5354  test-js:
     
    8384      - name: Run QUnit tests
    8485        run: npm run grunt qunit:compiled
     86
     87      - name: Ensure version-controlled files are not modified or deleted
     88        run: git diff --exit-code
  • trunk/.github/workflows/php-compatibility.yml

    r50930 r51355  
    5050  # - Logs PHP_CodeSniffer debug information.
    5151  # - Runs the PHP compatibility tests.
     52  # - Ensures version-controlled files are not modified or deleted.
    5253  # - todo: Configure Slack notifications for failing scans.
    5354  php-comatibility:
     
    8586      - name: Run PHP compatibility tests
    8687        run: phpcs --standard=phpcompat.xml.dist -q --report=checkstyle | cs2pr
     88
     89      - name: Ensure version-controlled files are not modified or deleted
     90        run: git diff --exit-code
  • trunk/.github/workflows/phpunit-tests.yml

    r51341 r51355  
    5656  # - Install WordPress within the Docker container.
    5757  # - Run the PHPUnit tests.
     58  # - Ensures version-controlled files are not modified or deleted.
    5859  # - Checks out the WordPress Test reporter repository.
    5960  # - Reconnect the directory to the Git repository.
     
    222223        run: LOCAL_PHP_XDEBUG=true npm run test:${{ env.PHPUNIT_SCRIPT }} -- -v --group xdebug --exclude-group __fakegroup__
    223224
     225      - name: Ensure version-controlled files are not modified or deleted
     226        run: git diff --exit-code
     227
    224228      - name: Checkout the WordPress Test Reporter
    225229        if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
  • trunk/.github/workflows/test-coverage.yml

    r51341 r51355  
    4444  # - Install WordPress within the Docker container.
    4545  # - Run the PHPUnit tests as a single site.
     46  # - Ensures version-controlled files are not modified or deleted.
    4647  # - Upload the single site code coverage report to Codecov.io.
    4748  # - Run the PHPUnit tests as a multisite.
     49  # - Ensures version-controlled files are not modified or deleted.
    4850  # - Upload the multisite code coverage report to Codecov.io.
    4951  test-coverage-report:
     
    122124        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --coverage-clover wp-code-coverage-single-clover-${{ github.sha }}.xml
    123125
     126      - name: Ensure version-controlled files are not modified during the tests
     127        run: git diff --exit-code
     128
    124129      - name: Upload single site report to Codecov
    125130        if: ${{ ! matrix.multisite }}
     
    133138        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --coverage-clover wp-code-coverage-multisite-clover-${{ github.sha }}.xml
    134139
     140      - name: Ensure version-controlled files are not modified during the tests
     141        run: git diff --exit-code
     142
    135143      - name: Upload multisite report to Codecov
    136144        if: ${{ matrix.multisite }}
  • trunk/.github/workflows/test-npm.yml

    r51341 r51355  
    4646  # - Builds WordPress to run from the `build` directory.
    4747  # - Cleans up after building WordPress to the `build` directory.
     48  # - Ensures version-controlled files are not modified or deleted.
    4849  # - Builds WordPress to run from the `src` directory.
    4950  # - Cleans up after building WordPress to the `src` directory.
     51  # - Ensures version-controlled files are not modified or deleted.
    5052  test-npm:
    5153    name: Test NPM on ${{ matrix.os }}
     
    8486        run: npm run grunt clean
    8587
     88      - name: Ensure version-controlled files are not modified or deleted during building and cleaning
     89        run: git diff --exit-code
     90
    8691      - name: Build WordPress in /src
    8792        run: npm run build:dev
     
    8994      - name: Clean after building in /src
    9095        run: npm run grunt clean -- --dev
     96
     97      - name: Ensure version-controlled files are not modified or deleted during building and cleaning
     98        run: git diff --exit-code
    9199
    92100  # Verifies that installing NPM dependencies and building WordPress works as expected on MacOS.
     
    101109  # - Builds WordPress to run from the `build` directory.
    102110  # - Cleans up after building WordPress to the `build` directory.
     111  # - Ensures version-controlled files are not modified or deleted.
    103112  # - Builds WordPress to run from the `src` directory.
    104113  # - Cleans up after building WordPress to the `src` directory.
     114  # - Ensures version-controlled files are not modified or deleted.
    105115  test-npm-macos:
    106116    name: Test NPM on MacOS
     
    134144        run: npm run grunt clean
    135145
     146      - name: Ensure version-controlled files are not modified or deleted during building and cleaning
     147        run: git diff --exit-code
     148
    136149      - name: Build WordPress in /src
    137150        run: npm run build:dev
     
    139152      - name: Clean after building in /src
    140153        run: npm run grunt clean -- --dev
     154
     155      - name: Ensure version-controlled files are not modified or deleted during building and cleaning
     156        run: git diff --exit-code
  • trunk/.github/workflows/test-old-branches.yml

    r51273 r51355  
    7070              ref: '${{ matrix.branch }}'
    7171            });
     72
     73      - name: Ensure version-controlled files are not modified during the tests
     74        run: git diff --exit-code
  • trunk/Gruntfile.js

    r51268 r51355  
    123123            ],
    124124            'webpack-assets': [
    125                 WORKING_DIR + 'wp-includes/assets/'
     125                WORKING_DIR + 'wp-includes/assets/*',
     126                '!' + WORKING_DIR + 'wp-includes/assets/script-loader-packages.php'
    126127            ],
    127128            dynamic: {
Note: See TracChangeset for help on using the changeset viewer.