From abc483d9d0c7f622410eb5513883ab65faa7ef7e Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Sat, 21 Nov 2026 19:12:53 +0000 Subject: [PATCH] ci: retry npm install once after a failure (#8280) --- .github/workflows/build.yml | 6 +++--- .github/workflows/web.yml | 4 ++++ scripts/ci/npm-install.sh | 8 ++++++++ scripts/ci/package-tests.sh | 5 +++-- 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100755 scripts/ci/npm-install.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0a4ec5a194..c39d960d90 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1925,8 +1925,8 @@ jobs: if: steps.plan.outputs.nodejs_version working-directory: packages/simplex-chat-nodejs run: | - (cd ../simplex-chat-client/types/typescript && npm install --no-audit --no-fund && npx tsc) - npm install --ignore-scripts --no-save --no-audit --no-fund ../simplex-chat-client/types/typescript + (cd ../simplex-chat-client/types/typescript && "$GITHUB_WORKSPACE/scripts/ci/npm-install.sh" && npx tsc) + "$GITHUB_WORKSPACE/scripts/ci/npm-install.sh" --ignore-scripts --no-save ../simplex-chat-client/types/typescript npx tsc && cp src/simplex.* dist npx jest tests/libs.test.ts tests/api.unit.test.ts @@ -1942,7 +1942,7 @@ jobs: VERSION: ${{ steps.plan.outputs.types_version }} DIST_TAG: ${{ steps.plan.outputs.types_dist_tag }} run: | - npm install --no-audit --no-fund + "$GITHUB_WORKSPACE/scripts/ci/npm-install.sh" npm publish --provenance --access public --tag "$DIST_TAG" echo "version=$VERSION" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 7628eb1f9a..192f1f7caa 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -28,6 +28,10 @@ jobs: with: node-version: ${{ matrix.node-version }} + - name: Install dependencies + working-directory: website + run: ../scripts/ci/npm-install.sh + - name: Install dependencies & build run: | ./website/web.sh diff --git a/scripts/ci/npm-install.sh b/scripts/ci/npm-install.sh new file mode 100755 index 0000000000..2031c5c663 --- /dev/null +++ b/scripts/ci/npm-install.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -euo pipefail + +npm install --no-audit --no-fund "$@" && exit +echo "npm install failed, retrying in 7 minutes" >&2 +sleep 420 +npm install --no-audit --no-fund "$@" diff --git a/scripts/ci/package-tests.sh b/scripts/ci/package-tests.sh index 48fa9a889c..f96931bfb4 100755 --- a/scripts/ci/package-tests.sh +++ b/scripts/ci/package-tests.sh @@ -7,6 +7,7 @@ nodejs=packages/simplex-chat-nodejs python_package=packages/simplex-chat-python python=$(command -v python3 || command -v python) temp=${RUNNER_TEMP:-$(mktemp -d)} +npm_install=$PWD/scripts/ci/npm-install.sh usage() { echo "usage: $0 build | test | addon | publish [nodejs] [python]" >&2 @@ -14,8 +15,8 @@ usage() { } build_package() { - (cd packages/simplex-chat-client/types/typescript && npm install --no-audit --no-fund && npx tsc) - (cd "$nodejs" && npm install --ignore-scripts --no-save --no-audit --no-fund ../simplex-chat-client/types/typescript) + (cd packages/simplex-chat-client/types/typescript && "$npm_install" && npx tsc) + (cd "$nodejs" && "$npm_install" --ignore-scripts --no-save ../simplex-chat-client/types/typescript ${1:+node-gyp}) if [ -n "${1:-}" ]; then (cd "$nodejs" && npx --yes node-gyp rebuild) fi