WordPress.org

Make WordPress Core

Changeset 51357


Ignore:
Timestamp:
07/06/2021 07:12:23 PM (3 months 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.

Merges [51355] to the 5.8 branch.

Fixes #53606

Location:
branches/5.8
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/.github/workflows/coding-standards.yml

    r50930 r51357  
    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  #
     
    107111  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
    108112  # - Run the WordPress JSHint checks.
     113  # - Ensures version-controlled files are not modified or deleted.
    109114  # - todo: Configure Slack notifications for failing tests.
    110115  jshint:
     
    150155      - name: Run JSHint
    151156        run: npm run grunt jshint
     157
     158      - name: Ensure version-controlled files are not modified or deleted
     159        run: git diff --exit-code
  • branches/5.8/.github/workflows/end-to-end-tests.yml

    r50930 r51357  
    4747  # - Install WordPress within the Docker container.
    4848  # - Run the E2E tests.
     49  # - Ensures version-controlled files are not modified or deleted.
    4950  # - todo: Configure Slack notifications for failing tests.
    5051  e2e-tests:
     
    123124      - name: Run E2E tests
    124125        run: npm run test:e2e
     126
     127      - name: Ensure version-controlled files are not modified or deleted
     128        run: git diff --exit-code
  • branches/5.8/.github/workflows/javascript-tests.yml

    r50930 r51357  
    5151  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
    5252  # - Run the WordPress QUnit tests.
     53  # - Ensures version-controlled files are not modified or deleted.
    5354  # - todo: Configure Slack notifications for failing tests.
    5455  test-js:
     
    9293      - name: Run QUnit tests
    9394        run: npm run grunt qunit:compiled
     95
     96      - name: Ensure version-controlled files are not modified or deleted
     97        run: git diff --exit-code
  • branches/5.8/.github/workflows/php-compatibility.yml

    r50930 r51357  
    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
  • branches/5.8/.github/workflows/phpunit-tests.yml

    r50930 r51357  
    5757  # - Install WordPress within the Docker container.
    5858  # - Run the PHPUnit tests.
     59  # - Ensures version-controlled files are not modified or deleted.
    5960  # - Checks out the WordPress Test reporter repository.
    6061  # - Reconnect the directory to the Git repository.
     
    231232        run: LOCAL_PHP_XDEBUG=true npm run test:${{ env.PHPUNIT_SCRIPT }} -- -v --group xdebug --exclude-group __fakegroup__
    232233
     234      - name: Ensure version-controlled files are not modified or deleted
     235        run: git diff --exit-code
     236
    233237      - name: Checkout the WordPress Test Reporter
    234238        if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
  • branches/5.8/.github/workflows/test-coverage.yml

    r50595 r51357  
    4545  # - Install WordPress within the Docker container.
    4646  # - Run the PHPUnit tests as a single site.
     47  # - Ensures version-controlled files are not modified or deleted.
    4748  # - Upload the single site code coverage report to Codecov.io.
    4849  # - Run the PHPUnit tests as a multisite.
     50  # - Ensures version-controlled files are not modified or deleted.
    4951  # - Upload the multisite code coverage report to Codecov.io.
    5052  test-coverage-report:
     
    131133        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --coverage-clover wp-code-coverage-single-clover-${{ github.sha }}.xml
    132134
     135      - name: Ensure version-controlled files are not modified during the tests
     136        run: git diff --exit-code
     137
    133138      - name: Upload single site report to Codecov
    134139        if: ${{ ! matrix.multisite }}
     
    142147        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --coverage-clover wp-code-coverage-multisite-clover-${{ github.sha }}.xml
    143148
     149      - name: Ensure version-controlled files are not modified during the tests
     150        run: git diff --exit-code
     151
    144152      - name: Upload multisite report to Codecov
    145153        if: ${{ matrix.multisite }}
  • branches/5.8/.github/workflows/test-npm.yml

    r50930 r51357  
    4747  # - Builds WordPress to run from the `build` directory.
    4848  # - Cleans up after building WordPress to the `build` directory.
     49  # - Ensures version-controlled files are not modified or deleted.
    4950  # - Builds WordPress to run from the `src` directory.
    5051  # - Cleans up after building WordPress to the `src` directory.
     52  # - Ensures version-controlled files are not modified or deleted.
    5153  test-npm:
    5254    name: Test NPM on ${{ matrix.os }}
     
    103105        run: npm run grunt clean
    104106
     107      - name: Ensure version-controlled files are not modified or deleted during building and cleaning
     108        run: git diff --exit-code
     109
    105110      - name: Build WordPress in /src
    106111        run: npm run build:dev
     
    108113      - name: Clean after building in /src
    109114        run: npm run grunt clean -- --dev
     115
     116      - name: Ensure version-controlled files are not modified or deleted during building and cleaning
     117        run: git diff --exit-code
    110118
    111119  # Verifies that installing NPM dependencies and building WordPress works as expected on MacOS.
     
    121129  # - Builds WordPress to run from the `build` directory.
    122130  # - Cleans up after building WordPress to the `build` directory.
     131  # - Ensures version-controlled files are not modified or deleted.
    123132  # - Builds WordPress to run from the `src` directory.
    124133  # - Cleans up after building WordPress to the `src` directory.
     134  # - Ensures version-controlled files are not modified or deleted.
    125135  test-npm-macos:
    126136    name: Test NPM on MacOS
     
    160170        run: npm run grunt clean
    161171
     172      - name: Ensure version-controlled files are not modified or deleted during building and cleaning
     173        run: git diff --exit-code
     174
    162175      - name: Build WordPress in /src
    163176        run: npm run build:dev
     
    165178      - name: Clean after building in /src
    166179        run: npm run grunt clean -- --dev
     180
     181      - name: Ensure version-controlled files are not modified or deleted during building and cleaning
     182        run: git diff --exit-code
  • branches/5.8/.github/workflows/test-old-branches.yml

    r50763 r51357  
    6868              ref: '${{ matrix.branch }}'
    6969            });
     70
     71      - name: Ensure version-controlled files are not modified during the tests
     72        run: git diff --exit-code
  • branches/5.8/Gruntfile.js

    r51268 r51357  
    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.