From 9c5fc02e4bf0ccccd93e245440eb76c6e483d686 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Tue, 30 Aug 2022 14:50:25 +0200 Subject: [PATCH] meta: improve CI npm install time (#4058) --- .github/workflows/ci.yml | 15 +++++++++++---- .github/workflows/companion.yml | 2 +- .github/workflows/e2e.yml | 13 +++++++++++++ .github/workflows/manual-cdn.yml | 3 +++ .github/workflows/release-candidate.yml | 3 +++ .github/workflows/release.yml | 3 +++ .github/workflows/website.yml | 3 +++ 7 files changed, 37 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bd8cf5c77..c3420d05a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,10 @@ jobs: with: node-version: ${{matrix.node-version}} - name: Install dependencies - run: corepack yarn install --immutable + run: corepack yarn workspaces focus $(corepack yarn workspaces list --json | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io") print $0 }') + env: + # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation + CYPRESS_INSTALL_BINARY: 0 - name: Run tests run: corepack yarn run test:unit @@ -59,7 +62,8 @@ jobs: with: node-version: lts/* - name: Install dependencies - run: corepack yarn install --immutable + # List all projects that use a custom ESLint config: + run: corepack yarn workspaces focus @uppy/angular @uppy-example/angular @uppy-example/react-native-expo @uppy/react-native @uppy-dev/build - name: Run linter run: corepack yarn run lint @@ -85,7 +89,7 @@ jobs: with: node-version: lts/* - name: Install dependencies - run: corepack yarn install --immutable + run: corepack yarn workspaces focus @uppy-dev/build - name: Run linter run: corepack yarn run lint:markdown @@ -111,7 +115,10 @@ jobs: with: node-version: lts/* - name: Install dependencies - run: corepack yarn install --immutable + run: corepack yarn workspaces focus $(corepack yarn workspaces list --json | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io") print $0 }') + env: + # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation + CYPRESS_INSTALL_BINARY: 0 # Need to do a bunch of work to generate the locale typings 🙃 - name: Prepare type declarations run: | diff --git a/.github/workflows/companion.yml b/.github/workflows/companion.yml index 391ec96b5c..c0ce24bb83 100644 --- a/.github/workflows/companion.yml +++ b/.github/workflows/companion.yml @@ -32,7 +32,7 @@ jobs: with: node-version: ${{matrix.node-version}} - name: Install dependencies - run: corepack yarn install --immutable + run: corepack yarn workspaces focus @uppy/companion - name: Run tests run: corepack yarn run test:companion diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 4f60669130..431bb08177 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -32,12 +32,23 @@ jobs: key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- + + - name: create cache folder for Cypress + id: cypress-cache-dir-path + run: echo "::set-output name=dir::$(mktemp -d)" + - uses: actions/cache@v3 + with: + path: ${{ steps.cypress-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-cypress - name: Install Node.js uses: actions/setup-node@v3 with: node-version: lts/* - name: Install dependencies run: corepack yarn install --immutable + env: + # https://docs.cypress.io/guides/references/advanced-installation#Binary-cache + CYPRESS_CACHE_FOLDER: ${{ steps.cypress-cache-dir-path.outputs.dir }} - name: Build Uppy packages run: corepack yarn build - name: Run end-to-end browser tests @@ -55,6 +66,8 @@ jobs: COMPANION_AWS_BUCKET: ${{secrets.COMPANION_AWS_BUCKET}} COMPANION_AWS_REGION: ${{secrets.COMPANION_AWS_REGION}} COMPANION_AWS_DISABLE_ACL: 'true' + # https://docs.cypress.io/guides/references/advanced-installation#Binary-cache + CYPRESS_CACHE_FOLDER: ${{ steps.cypress-cache-dir-path.outputs.dir }} - name: Upload videos in case of failure uses: actions/upload-artifact@v3 if: failure() diff --git a/.github/workflows/manual-cdn.yml b/.github/workflows/manual-cdn.yml index 1cf3be53ab..a1584e4b59 100644 --- a/.github/workflows/manual-cdn.yml +++ b/.github/workflows/manual-cdn.yml @@ -30,6 +30,9 @@ jobs: node-version: lts/* - name: Install dependencies run: corepack yarn install --immutable + env: + # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation + CYPRESS_INSTALL_BINARY: 0 - name: Build before publishing run: corepack yarn run build - name: Upload `${{ github.event.inputs.name }}` to CDN diff --git a/.github/workflows/release-candidate.yml b/.github/workflows/release-candidate.yml index d2e7fdb713..ff05958b78 100644 --- a/.github/workflows/release-candidate.yml +++ b/.github/workflows/release-candidate.yml @@ -35,6 +35,9 @@ jobs: node-version: lts/* - name: Install dependencies run: corepack yarn install --immutable + env: + # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation + CYPRESS_INSTALL_BINARY: 0 - name: Bump candidate packages version run: corepack yarn version apply --all --json | jq -s > releases.json - name: Prepare changelog diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 874fd4f70a..a902140cad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,6 +30,9 @@ jobs: node-version: lts/* - name: Install dependencies run: corepack yarn install --immutable + env: + # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation + CYPRESS_INSTALL_BINARY: 0 - name: Get CHANGELOG diff run: git --no-pager diff HEAD^ -- CHANGELOG.md | awk '{ if( substr($0,0,1) == "+" && $1 != "+##" && $1 != "+Released:" && $1 != "+++" ) { print substr($0,2) } }' > CHANGELOG.diff.md - name: Copy README for `uppy` package diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 5b2ae7b1fd..bba43d3675 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -28,6 +28,9 @@ jobs: node-version: lts/* - name: Install dependencies run: corepack yarn install --immutable + env: + # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation + CYPRESS_INSTALL_BINARY: 0 - name: Build Uppy run: corepack yarn run build - name: Build website