WordPress.org

Make WordPress Core

Changeset 49369


Ignore:
Timestamp:
10/29/2020 01:20:42 AM (13 months ago)
Author:
desrosj
Message:

Build/Test Tools: Use install-changed to install NPM dependencies in GitHub Action workflows.

The install-changed package records a hash of the package.json file locally in a text file and only runs npm install when there are changes to account for.

This builds on [47497], which only hashes the package.json file after a Grunt task is called. By using npx install-changed within the workflow files, the package is hashed before the first Grunt task is run.

Props ocean90.
See #50401, #49594.

Location:
trunk/.github/workflows
Files:
5 edited

Legend:

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

    r49227 r49369  
    8080  # - Sets up caching for NPM.
    8181  # - Logs updated debug information.
    82   # _ Installs NPM dependencies.
     82  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
    8383  # - Run the WordPress JSHint checks.
    8484  # - todo: Configure Slack notifications for failing tests.
     
    121121
    122122      - name: Install Dependencies
    123         run: npm ci
     123        run: npx install-changed --install-command="npm ci"
    124124
    125125      - name: Run JSHint
  • trunk/.github/workflows/end-to-end-tests.yml

    r49244 r49369  
    2323  # - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches)
    2424  # - Sets up caching for NPM.
    25   # _ Installs NPM dependencies.
     25  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
    2626  # - Builds WordPress to run from the `build` directory.
    2727  # - Starts the WordPress Docker container.
     
    7878
    7979      - name: Install Dependencies
    80         run: npm ci
     80        run: npx install-changed --install-command="npm ci"
    8181
    8282      - name: Build WordPress
  • trunk/.github/workflows/javascript-tests.yml

    r49244 r49369  
    1818  # - Sets up caching for NPM.
    1919  # - Logs updated debug information.
    20   # _ Installs NPM dependencies.
     20  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
    2121  # - Run the WordPress QUnit tests.
    2222  # - todo: Configure Slack notifications for failing tests.
     
    6363
    6464      - name: Install Dependencies
    65         run: npm ci
     65        run: npx install-changed --install-command="npm ci"
    6666
    6767      - name: Run QUnit tests
  • trunk/.github/workflows/phpunit-tests.yml

    r49244 r49369  
    2929  # - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches)
    3030  # - Sets up caching for NPM.
    31   # _ Installs NPM dependencies.
     31  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
    3232  # - Builds WordPress to run from the `build` directory.
    3333  # - Creates a ZIP file of compiled WordPress
     
    5252      - name: Log debug information
    5353        run: |
     54          echo "$GITHUB_REF"
     55          echo "$GITHUB_EVENT_NAME"
    5456          npm --version
    5557          node --version
     
    7880
    7981      - name: Install Dependencies
    80         run: npm ci
     82        run: npx install-changed --install-command="npm ci"
    8183
    8284      - name: Build WordPress
     
    8789        with:
    8890          filename: built-wp-${{ github.sha }}.zip
    89           exclusions: '/*node_modules/*'
     91          exclusions: '*.git* /*node_modules/* packagehash.txt'
    9092
    9193      - name: Upload build artifact
     
    105107  # - Installs NodeJS 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches)
    106108  # - Sets up caching for NPM.
    107   # _ Installs NPM dependencies.
     109  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
    108110  # - Configures caching for Composer.
    109111  # _ Installs Composer dependencies (if desired)
     
    173175
    174176      - name: Install Dependencies
    175         run: npm ci
     177        run: npx install-changed --install-command="npm ci"
    176178
    177179      - name: Get composer cache directory
  • trunk/.github/workflows/verify-npm-on-windows.yml

    r49244 r49369  
    2020  # - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches)
    2121  # - Sets up caching for NPM.
    22   # _ Installs NPM dependencies.
     22  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
    2323  # - Builds WordPress to run from the `build` directory.
    2424  test-npm:
     
    6363
    6464      - name: Install Dependencies
    65         run: npm ci
     65        run: npx install-changed --install-command="npm ci"
    6666
    6767      - name: Build WordPress
Note: See TracChangeset for help on using the changeset viewer.