Skip to content

Commit

Permalink
meta: improve CI npm install time (#4058)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9c5fc02)
  • Loading branch information
aduh95 committed Aug 31, 2022
1 parent b11d405 commit 02df45d
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 8 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -37,7 +37,10 @@ jobs:
# More recent versions of Corepack are not compatible with Node.js 12.x.
run: npm install -f -g corepack@0.10.0
- 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

Expand All @@ -63,7 +66,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 angular-example @uppy-example/react-native-expo @uppy/react-native @uppy-dev/build
- name: Run linter
run: corepack yarn run lint

Expand All @@ -89,7 +93,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

Expand All @@ -115,7 +119,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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/companion.yml
Expand Up @@ -70,7 +70,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

19 changes: 16 additions & 3 deletions .github/workflows/e2e.yml
@@ -1,11 +1,11 @@
name: End-to-end tests
on:
push:
branches: [ main, 2.x ]
branches: [main, 2.x]
pull_request_target:
types: [ opened, synchronize, reopened, labeled ]
types: [opened, synchronize, reopened, labeled]
pull_request:
types: [ opened, synchronize, reopened ]
types: [opened, synchronize, reopened]
paths:
- .github/workflows/e2e.yml

Expand All @@ -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
Expand All @@ -50,6 +61,8 @@ jobs:
VITE_TRANSLOADIT_TEMPLATE: ${{secrets.TRANSLOADIT_TEMPLATE}}
VITE_TRANSLOADIT_SERVICE_URL: ${{secrets.TRANSLOADIT_SERVICE_URL}}
CYPRESS_RECORD_KEY: ${{secrets.CYPRESS_RECORD_KEY}}
# https://docs.cypress.io/guides/references/advanced-installation#Binary-cache
CYPRESS_CACHE_FOLDER: ${{ steps.cypress-cache-dir-path.outputs.dir }}
- name: Remove 'pending end-to-end tests' label
# Remove the 'pending end-to-end tests' label if tests ran successfully
if: github.event.pull_request && contains(github.event.pull_request.labels.*.name, 'pending end-to-end tests')
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/manual-cdn.yml
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release-candidate.yml
Expand Up @@ -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: Bump candidate packages version
run: corepack yarn version apply --all --json | jq -s > releases.json
- name: Prepare changelog
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/website.yml
Expand Up @@ -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
Expand Down

0 comments on commit 02df45d

Please sign in to comment.