WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.49k stars 4.19k forks source link

GitHub actions workflows that use trunk branch fail when using npm version 7.6.0 #29528

Open fluiddot opened 3 years ago

fluiddot commented 3 years ago

Description

When using npm version 7.6.0 in the workflows Compressed Size / Check (pull_request) and Performances Tests / Run performance tests (pull_request), we checkout trunk but due to the recent changes limiting the version of npm to v6, the processes fails.

Step-by-step reproduction instructions

  1. Create a test branch
  2. Install npm version 7.6.0
  3. Remove <7 condition from the npm engine section of package.json file (example)
  4. Run npm install
  5. Add the following code to a GitHub actions workflow that uses trunk branch (like Compressed Size):

    - name: Use Node.js 14.x
      uses: actions/setup-node@v1
      with:
        node-version: 14.x
    
    - name: Install latest NPM version
      run: npm install -g npm@7.6.0

    The code has to be placed after the checkout and npm cache restore, here is an example.

  6. Push the changes
  7. Create a test PR
  8. Observe that the modified workflow is failing

Expected behaviour

GitHub actions workflows that use trunk branch should succeed.

Actual behaviour

GitHub actions workflows that use trunk branch fail.

Screenshots or screen recording (optional)

N/A

Code snippet (optional)

WordPress information

Device information

ockham commented 3 years ago

This one can be simply fixed by

diff --git a/package.json b/package.json
index 3c75522414..f3c07a917c 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,7 @@
        },
        "engines": {
                "node": ">=10.0.0",
-               "npm": ">=6.9.0 <7"
+               "npm": ">=6.9.0"
        },
        "config": {
                "GUTENBERG_PHASE": 2,

or, if we prefer,

diff --git a/package.json b/package.json
index 3c75522414..dcbe81d1c2 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,7 @@
        },
        "engines": {
                "node": ">=10.0.0",
-               "npm": ">=6.9.0 <7"
+               "npm": ">=7.6.0"
        },
        "config": {
                "GUTENBERG_PHASE": 2,

, right?

It's just that we can't do that yet because of #29524 and #29527, right?

fluiddot commented 3 years ago

Yeah, this could be easily fixed just by changing the npm engine value as you commented.

The only thing to keep in mind is that we would need to merge this change into trunk branch first so the PR checks of "Update lock file format version to version 2 (NPM 7)" PR pass.

Mamaduka commented 3 years ago

Engines update would be nice.

Currently can't install dependencies on Apple Silicon machines because of this restriction.