From 04cdfd20ae676c09603f238f17c35d99ef002699 Mon Sep 17 00:00:00 2001 From: Grantmartin2002 <69131375+Grantmartin2002@users.noreply.github.com> Date: Wed, 26 Aug 2026 13:20:52 -0500 Subject: [PATCH] fix(ci): retry template scaffolding on transient network failures Each Test Templates leg scaffolds a fresh module and a fresh node_modules, so every dependency is re-resolved from the Go checksum DB and the npm registry. A single transient error there fails the whole matrix. Retry the generate + build step up to three times, but only when the output matches a known transient signature, so genuine template breakage still fails on the first attempt. --- .github/workflows/build-and-test-v3.yml | 41 ++++++++++++++++++++----- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-and-test-v3.yml b/.github/workflows/build-and-test-v3.yml index 3a8b58119f2..e4beda26e9f 100644 --- a/.github/workflows/build-and-test-v3.yml +++ b/.github/workflows/build-and-test-v3.yml @@ -262,14 +262,39 @@ jobs: else RUNTIME_TGZ="$(cd wails-runtime-temp && pwd)/$(ls wails-runtime-temp/*.tgz | xargs basename)" fi - mkdir -p ./test-${{ matrix.template }} - cd ./test-${{ matrix.template }} - wails3 init -n ${{ matrix.template }} -t ${{ matrix.template }} - cd ${{ matrix.template }}/frontend - # Replace @wailsio/runtime version with local tarball - npm pkg set dependencies.@wailsio/runtime="file://$RUNTIME_TGZ" - cd .. - wails3 build + generate_and_build() ( + set -e + rm -rf ./test-${{ matrix.template }} + mkdir -p ./test-${{ matrix.template }} + cd ./test-${{ matrix.template }} + wails3 init -n ${{ matrix.template }} -t ${{ matrix.template }} + cd ${{ matrix.template }}/frontend + # Replace @wailsio/runtime version with local tarball + npm pkg set dependencies.@wailsio/runtime="file://$RUNTIME_TGZ" + cd .. + wails3 build + ) + + # Each leg resolves a brand new module graph and node_modules, so one blip + # from the Go checksum DB or the npm registry reds the whole matrix. + transient='INTERNAL_ERROR|stream error|TLS handshake timeout|i/o timeout|connection reset' + transient="$transient|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ENOTFOUND|Bad Gateway|Service Unavailable" + transient="$transient|Cannot find native binding" + + for attempt in 1 2 3; do + set +e + generate_and_build 2>&1 | tee attempt.log + status=${PIPESTATUS[0]} + set -e + if [[ $status -eq 0 ]]; then + exit 0 + fi + if [[ $attempt -eq 3 ]] || ! grep -qE "$transient" attempt.log; then + exit "$status" + fi + echo "::warning::Transient failure generating '${{ matrix.template }}' (attempt $attempt), retrying" + sleep $((attempt * 15)) + done # GTK3 legacy template builds are covered by the Go example compilation tests above.