diff --git a/.changeset/tough-countries-kiss.md b/.changeset/tough-countries-kiss.md new file mode 100644 index 000000000000..621d915e4ef2 --- /dev/null +++ b/.changeset/tough-countries-kiss.md @@ -0,0 +1,15 @@ +--- +"wrangler": patch +--- + +ci: use `npm ci` and do not cache workspace packages in node_modules + +Previously we were caching all the `node_modules` files in the CI jobs and then running `npm install`. While this resulted in slightly improved install times on Ubuntu, it breaks on Windows because the npm workspace setup adds symlinks into node_modules, which the Github cache action cannot cope with. + +This change removes the `node_modules` caches (saving some time by not needing to restore them) and replaces `npm install` with `npm ci`. + +The `npm ci` command is actually designed to be used in CI jobs as it only installs the exact versions specified in the `package-lock.json` file, guaranteeing that for any commit we always have exactly the same CI job run, deterministically. + +It turns out that, on Ubuntu, using `npm ci` makes very little difference to the installation time (~30 secs), especially if there is no `node_modules` there in the first place. + +Unfortunately, MacOS is slower (~1 min), and Windows even worse (~2 mins)! But it is worth this longer CI run to be sure we have things working on all OSes. diff --git a/.github/workflows/pullrequests.yml b/.github/workflows/pullrequests.yml index 4c681e781816..214410b22be7 100644 --- a/.github/workflows/pullrequests.yml +++ b/.github/workflows/pullrequests.yml @@ -21,14 +21,6 @@ jobs: node-version: 16.7 cache: "npm" - - uses: actions/cache@v2 - id: node-modules-cache - with: - path: | - node_modules - */*/node_modules - key: ${{ matrix.os }}-node-${{ hashFiles('**/package-lock.json') }} - - uses: actions/cache@v2 id: eslint-cache with: @@ -38,7 +30,7 @@ jobs: key: ${{ matrix.os }}-eslint-tsbuildinfo-${{ hashFiles('**/*.ts','**/*.js', 'package.json', 'tsconfig.json') }} - name: Install NPM Dependencies - run: npm install + run: npm ci - name: Check for errors run: npm run check @@ -61,16 +53,8 @@ jobs: node-version: 16.7 cache: "npm" - - uses: actions/cache@v2 - id: node-modules-cache - with: - path: | - node_modules - */*/node_modules - key: ${{ matrix.os }}-node-${{ hashFiles('**/package-lock.json') }} - - name: Install NPM Dependencies - run: npm install + run: npm ci - name: Run build and test run: npm run build-and-test