Преглед изворни кода

meta: improve CI npm install time (#4058)

Antoine du Hamel пре 2 година
родитељ
комит
9c5fc02e4b

+ 11 - 4
.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: |

+ 1 - 1
.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
 

+ 13 - 0
.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()

+ 3 - 0
.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

+ 3 - 0
.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

+ 3 - 0
.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

+ 3 - 0
.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