Skip to content

Commit

Permalink
perf(npm): only install cypress when needed
Browse files Browse the repository at this point in the history
We run `npm ci` in a number of places
and usually we do not need cypress to be installed.

In text a sample run of `npm ci` without cypress took 26 sec. instead of 46 sec.

This also prevents run failures due to network issues connecting to cypress.

Documentation for the environment variable used:
https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation

Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Aug 30, 2023
1 parent 43a75ee commit 31b9209
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions workflow-templates/appstore-build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ jobs:
- name: Build ${{ env.APP_NAME }}
# Skip if no package.json
if: ${{ steps.versions.outputs.nodeVersion }}
env:
CYPRESS_INSTALL_BINARY: 0
run: |
cd ${{ env.APP_NAME }}
npm ci
Expand Down
2 changes: 2 additions & 0 deletions workflow-templates/command-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ jobs:
run: npm i -g npm@"${{ steps.package-engines-versions.outputs.npmVersion }}"

- name: Install dependencies & build
env:
CYPRESS_INSTALL_BINARY: 0
run: |
npm ci
npm run build --if-present
Expand Down
2 changes: 2 additions & 0 deletions workflow-templates/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Install dependencies & build
env:
CYPRESS_INSTALL_BINARY: 0
run: |
npm ci
npm run build --if-present
Expand Down
2 changes: 2 additions & 0 deletions workflow-templates/lint-eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jobs:
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Install dependencies
env:
CYPRESS_INSTALL_BINARY: 0
run: npm ci

- name: Lint
Expand Down
2 changes: 2 additions & 0 deletions workflow-templates/lint-stylelint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Install dependencies
env:
CYPRESS_INSTALL_BINARY: 0
run: npm ci

- name: Lint
Expand Down
2 changes: 2 additions & 0 deletions workflow-templates/node-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Install dependencies & build
env:
CYPRESS_INSTALL_BINARY: 0
run: |
npm ci
npm run build --if-present
Expand Down
2 changes: 2 additions & 0 deletions workflow-templates/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ jobs:
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Install dependencies & build
env:
CYPRESS_INSTALL_BINARY: 0
run: |
npm ci
npm run build --if-present
Expand Down
2 changes: 2 additions & 0 deletions workflow-templates/npm-audit-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
- name: Run npm ci and npm run build
if: always()
env:
CYPRESS_INSTALL_BINARY: 0
run: |
npm ci
npm run build --if-present
Expand Down
2 changes: 2 additions & 0 deletions workflow-templates/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Install dependencies & build
env:
CYPRESS_INSTALL_BINARY: 0
run: |
npm ci
npm run build --if-present
Expand Down

0 comments on commit 31b9209

Please sign in to comment.