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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49369 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers
2020-10-29 01:20:42 +00:00
parent df716454a3
commit 886a9ddaa4
5 changed files with 15 additions and 13 deletions

View File

@@ -17,7 +17,7 @@ jobs:
# - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches)
# - Sets up caching for NPM.
# - Logs updated debug information.
# _ Installs NPM dependencies.
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
# - Run the WordPress QUnit tests.
# - todo: Configure Slack notifications for failing tests.
test-js:
@@ -62,7 +62,7 @@ jobs:
node --version
- name: Install Dependencies
run: npm ci
run: npx install-changed --install-command="npm ci"
- name: Run QUnit tests
run: npm run grunt qunit:compiled