Introduce retry mechanism for npm install in CI/CD
This commit addresses occasional pipeline failures caused by transient network errors during dependency installation with `npm ci`. It centralizes the logic for installing npm dependencies and introduces a retry mechanism. The new approach will attempt `npm ci` up to 5 times with a 5-second interval between each attempt, thereby increasing the resilience of CI/CD pipelines. This commit adds a new script `npm-install.js` with `npm run install-deps` command to centralize npm dependency installation process throughout the project. Separate testing of scripts to a separate workflow. It removes unused `install` dependency from `package.json`.
This commit is contained in:
11
.github/actions/npm-install-dependencies/action.yml
vendored
Normal file
11
.github/actions/npm-install-dependencies/action.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
inputs:
|
||||
working-directory:
|
||||
required: false
|
||||
default: '.'
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
-
|
||||
name: Run `npm ci` with retries
|
||||
shell: bash
|
||||
run: npm run install-deps -- --ci --root-directory "${{ inputs.working-directory }}"
|
||||
24
.github/workflows/checks.build.yaml
vendored
24
.github/workflows/checks.build.yaml
vendored
@@ -27,7 +27,7 @@ jobs:
|
||||
uses: ./.github/actions/setup-node
|
||||
-
|
||||
name: Install dependencies
|
||||
run: npm ci
|
||||
uses: ./.github/actions/npm-install-dependencies
|
||||
-
|
||||
name: Build web
|
||||
run: npm run build -- --mode ${{ matrix.mode }}
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
uses: ./.github/actions/setup-node
|
||||
-
|
||||
name: Install dependencies
|
||||
run: npm ci
|
||||
uses: ./.github/actions/npm-install-dependencies
|
||||
-
|
||||
name: Prebuild desktop
|
||||
run: npm run electron:prebuild -- --mode ${{ matrix.mode }}
|
||||
@@ -68,23 +68,3 @@ jobs:
|
||||
-
|
||||
name: Verify bundled desktop build artifacts
|
||||
run: npm run check:verify-build-artifacts -- --electron-bundled
|
||||
|
||||
create-icons:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ macos, ubuntu, windows ]
|
||||
fail-fast: false # Allows to see results from other combinations
|
||||
runs-on: ${{ matrix.os }}-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Setup node
|
||||
uses: ./.github/actions/setup-node
|
||||
-
|
||||
name: Install dependencies
|
||||
run: npm ci
|
||||
-
|
||||
name: Create icons
|
||||
run: npm run icons:build
|
||||
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
uses: ./.github/actions/setup-node
|
||||
-
|
||||
name: Install dependencies
|
||||
run: npm ci
|
||||
uses: ./.github/actions/npm-install-dependencies
|
||||
-
|
||||
name: Configure Ubuntu
|
||||
if: matrix.os == 'ubuntu'
|
||||
|
||||
14
.github/workflows/checks.external-urls.yaml
vendored
14
.github/workflows/checks.external-urls.yaml
vendored
@@ -8,11 +8,15 @@ jobs:
|
||||
run-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
-
|
||||
name: Setup node
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Test
|
||||
-
|
||||
name: Install dependencies
|
||||
uses: ./.github/actions/npm-install-dependencies
|
||||
-
|
||||
name: Test
|
||||
run: npm run check:external-urls
|
||||
|
||||
14
.github/workflows/checks.quality.yaml
vendored
14
.github/workflows/checks.quality.yaml
vendored
@@ -16,11 +16,15 @@ jobs:
|
||||
os: [ macos, ubuntu, windows ]
|
||||
fail-fast: false # Still interested to see results from other combinations
|
||||
steps:
|
||||
- name: Checkout
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
-
|
||||
name: Setup node
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Lint
|
||||
-
|
||||
name: Install dependencies
|
||||
uses: ./.github/actions/npm-install-dependencies
|
||||
-
|
||||
name: Lint
|
||||
run: ${{ matrix.lint-command }}
|
||||
|
||||
55
.github/workflows/checks.scripts.yaml
vendored
Normal file
55
.github/workflows/checks.scripts.yaml
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
name: checks.scripts
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
icons-build:
|
||||
runs-on: ${{ matrix.os }}-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ macos, ubuntu, windows ]
|
||||
fail-fast: false # Still interested to see results from other combinations
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Setup node
|
||||
uses: ./.github/actions/setup-node
|
||||
-
|
||||
name: Install dependencies
|
||||
uses: ./.github/actions/npm-install-dependencies
|
||||
-
|
||||
name: Create icons
|
||||
run: npm run icons:build
|
||||
|
||||
install-deps:
|
||||
runs-on: ${{ matrix.os }}-latest
|
||||
strategy:
|
||||
matrix:
|
||||
install-deps-before: [true, false]
|
||||
install-command:
|
||||
- npm run install-deps
|
||||
- npm run install-deps -- --no-errors
|
||||
- npm run install-deps -- --ci
|
||||
- npm run install-deps -- --fresh --non-deterministic
|
||||
- npm run install-deps -- --fresh
|
||||
- npm run install-deps -- --non-deterministic
|
||||
os: [ macos, ubuntu, windows ]
|
||||
fail-fast: false # Still interested to see results from other combinations
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Setup node
|
||||
uses: ./.github/actions/setup-node
|
||||
-
|
||||
name: Install dependencies
|
||||
if: matrix.install-deps-before == true
|
||||
uses: ./.github/actions/npm-install-dependencies
|
||||
-
|
||||
name: Run install-deps
|
||||
run: ${{ matrix.install-command }}
|
||||
2
.github/workflows/release.desktop.yaml
vendored
2
.github/workflows/release.desktop.yaml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
uses: ./.github/actions/setup-node
|
||||
-
|
||||
name: Install dependencies
|
||||
run: npm ci
|
||||
uses: ./.github/actions/npm-install-dependencies
|
||||
-
|
||||
name: Run unit tests
|
||||
run: npm run test:unit
|
||||
|
||||
5
.github/workflows/release.site.yaml
vendored
5
.github/workflows/release.site.yaml
vendored
@@ -84,8 +84,9 @@ jobs:
|
||||
uses: ./app/.github/actions/setup-node
|
||||
-
|
||||
name: "App: Install dependencies"
|
||||
run: npm ci
|
||||
working-directory: app
|
||||
uses: ./.github/actions/npm-install-dependencies
|
||||
with:
|
||||
working-directory: app
|
||||
-
|
||||
name: "App: Run unit tests"
|
||||
run: npm run test:unit
|
||||
|
||||
2
.github/workflows/tests.e2e.yaml
vendored
2
.github/workflows/tests.e2e.yaml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
uses: ./.github/actions/setup-node
|
||||
-
|
||||
name: Install dependencies
|
||||
run: npm ci
|
||||
uses: ./.github/actions/npm-install-dependencies
|
||||
-
|
||||
name: Run e2e tests
|
||||
run: npm run test:cy:run
|
||||
|
||||
2
.github/workflows/tests.integration.yaml
vendored
2
.github/workflows/tests.integration.yaml
vendored
@@ -22,7 +22,7 @@ jobs:
|
||||
uses: ./.github/actions/setup-node
|
||||
-
|
||||
name: Install dependencies
|
||||
run: npm ci
|
||||
uses: ./.github/actions/npm-install-dependencies
|
||||
-
|
||||
name: Run integration tests
|
||||
run: npm run test:integration
|
||||
|
||||
2
.github/workflows/tests.unit.yaml
vendored
2
.github/workflows/tests.unit.yaml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
uses: ./.github/actions/setup-node
|
||||
-
|
||||
name: Install dependencies
|
||||
run: npm ci
|
||||
uses: ./.github/actions/npm-install-dependencies
|
||||
-
|
||||
name: Run unit tests
|
||||
run: npm run test:unit
|
||||
|
||||
Reference in New Issue
Block a user