From 6d4dc8bd85e4dced84d9f943fb0c4150aa662de2 Mon Sep 17 00:00:00 2001 From: Saber Haj Rabiee Date: Wed, 27 May 2026 05:55:41 -0700 Subject: [PATCH] fix(CI): do not fail fast (#4740) --- .github/workflows/run-cargo-make-task.yml | 317 ++++++++++++++-------- 1 file changed, 211 insertions(+), 106 deletions(-) diff --git a/.github/workflows/run-cargo-make-task.yml b/.github/workflows/run-cargo-make-task.yml index 2829dddfd..b41472c65 100644 --- a/.github/workflows/run-cargo-make-task.yml +++ b/.github/workflows/run-cargo-make-task.yml @@ -17,92 +17,174 @@ jobs: name: "Run (${{ matrix.toolchain }}) (erased_mode: ${{ matrix.erased_mode && 'enabled' || 'disabled' }})" runs-on: ubuntu-latest strategy: + fail-fast: false matrix: toolchain: [stable, nightly-2026-02-24] erased_mode: [true, false] steps: - name: Free Disk Space - run: | - echo "Disk space before cleanup:" - df -h - sudo rm -rf /usr/local/.ghcup - sudo rm -rf /opt/hostedtoolcache/CodeQL - sudo rm -rf /usr/local/lib/android - sudo rm -rf /usr/share/dotnet - sudo rm -rf /opt/ghc - sudo rm -rf /usr/local/share/boost - sudo rm -rf /usr/local/lib/node_modules + uses: nick-fields/retry@v4 + with: + max_attempts: 3 + timeout_minutes: 15 + retry_wait_seconds: 15 + command: | + echo "Disk space before cleanup:" + df -h + sudo rm -rf /usr/local/.ghcup + sudo rm -rf /opt/hostedtoolcache/CodeQL + sudo rm -rf /usr/local/lib/android + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/share/boost + sudo rm -rf /usr/local/lib/node_modules - # following lines currenly not needed as it takes too much time - # the new isolated CI doesn't need much space to test libraries - # - # uncommet only if nneded - # - # sudo apt-get clean - # sudo apt-get purge -y '^ghc-.*' '^dotnet-.*' '^llvm-.*' '^mono-.*' '^php.*' '^ruby.*' - # sudo apt-get autoremove -y - # sudo apt-get clean - # sudo rm -rf "$AGENT_TOOLSDIRECTORY" - # docker system prune -af - # docker image prune -af - # docker volume prune -f - echo "Disk space after cleanup:" - df -h + # following lines currenly not needed as it takes too much time + # the new isolated CI doesn't need much space to test libraries + # + # uncommet only if nneded + # + # sudo apt-get clean + # sudo apt-get purge -y '^ghc-.*' '^dotnet-.*' '^llvm-.*' '^mono-.*' '^php.*' '^ruby.*' + # sudo apt-get autoremove -y + # sudo apt-get clean + # sudo rm -rf "$AGENT_TOOLSDIRECTORY" + # docker system prune -af + # docker image prune -af + # docker volume prune -f + echo "Disk space after cleanup:" + df -h # Setup environment - name: Install Glib - run: | - sudo apt-get update - sudo apt-get install -y libglib2.0-dev - - uses: actions/checkout@v6 - - name: Setup Rust - uses: dtolnay/rust-toolchain@master + uses: nick-fields/retry@v4 with: - toolchain: ${{ matrix.toolchain }} - targets: wasm32-unknown-unknown - components: clippy,rustfmt + max_attempts: 3 + timeout_minutes: 15 + retry_wait_seconds: 15 + command: | + sudo apt-get update + sudo apt-get install -y libglib2.0-dev + - uses: Wandalen/wretry.action@v3.8.0 + with: + action: actions/checkout@v6 + attempt_limit: 3 + attempt_delay: 15000 + - name: Setup Rust + uses: Wandalen/wretry.action@v3.8.0 + with: + action: dtolnay/rust-toolchain@master + with: | + toolchain: ${{ matrix.toolchain }} + targets: wasm32-unknown-unknown + components: clippy,rustfmt + attempt_limit: 3 + attempt_delay: 15000 - name: Install binstall - uses: cargo-bins/cargo-binstall@main + uses: Wandalen/wretry.action@v3.8.0 + with: + action: cargo-bins/cargo-binstall@main + attempt_limit: 3 + attempt_delay: 15000 - name: Install wasm-bindgen - run: cargo binstall wasm-bindgen-cli --no-confirm + uses: nick-fields/retry@v4 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 15 + command: cargo binstall wasm-bindgen-cli --no-confirm - name: Install cargo-leptos - run: cargo binstall cargo-leptos --locked --no-confirm + uses: nick-fields/retry@v4 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 15 + command: cargo binstall cargo-leptos --locked --no-confirm - name: Install cargo-make - run: cargo binstall cargo-make --no-confirm + uses: nick-fields/retry@v4 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 15 + command: cargo binstall cargo-make --no-confirm - name: Install nextest - run: cargo binstall cargo-nextest --locked --no-confirm + uses: nick-fields/retry@v4 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 15 + command: cargo binstall cargo-nextest --locked --no-confirm - name: Install cargo-all-features - run: cargo install cargo-all-features + uses: nick-fields/retry@v4 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 15 + command: cargo install cargo-all-features # Part of direct-minimal-versions check - name: Install cargo-hack if: contains(matrix.toolchain, 'nightly') - uses: taiki-e/install-action@cargo-hack + uses: Wandalen/wretry.action@v3.8.0 + with: + action: taiki-e/install-action@cargo-hack + attempt_limit: 3 + attempt_delay: 15000 # Part of direct-minimal-versions check - name: Install cargo-minimal-versions if: contains(matrix.toolchain, 'nightly') - uses: taiki-e/install-action@cargo-minimal-versions + uses: Wandalen/wretry.action@v3.8.0 + with: + action: taiki-e/install-action@cargo-minimal-versions + attempt_limit: 3 + attempt_delay: 15000 - name: Install Trunk if: contains(inputs.directory, 'examples') - run: cargo binstall trunk --no-confirm + uses: nick-fields/retry@v4 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 15 + command: cargo binstall trunk --no-confirm - name: Print Trunk Version if: contains(inputs.directory, 'examples') - run: trunk --version + uses: nick-fields/retry@v4 + with: + max_attempts: 3 + timeout_minutes: 15 + retry_wait_seconds: 15 + command: trunk --version - name: Install Node.js if: contains(inputs.directory, 'examples') - uses: actions/setup-node@v6 + uses: Wandalen/wretry.action@v3.8.0 with: - node-version: 20 - - uses: pnpm/action-setup@v6 - name: Install pnpm + action: actions/setup-node@v6 + with: | + node-version: 20 + attempt_limit: 3 + attempt_delay: 15000 + - name: Install pnpm if: contains(inputs.directory, 'examples') id: pnpm-install + uses: Wandalen/wretry.action@v3.8.0 with: - version: 8 - run_install: false + action: pnpm/action-setup@v6 + with: | + version: 8 + run_install: false + attempt_limit: 3 + attempt_delay: 15000 - name: Get pnpm store directory if: contains(inputs.directory, 'examples') id: pnpm-cache - run: | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + uses: nick-fields/retry@v4 + with: + max_attempts: 3 + timeout_minutes: 15 + retry_wait_seconds: 15 + command: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + # NOTE: actions/cache is intentionally NOT wrapped in a retry action. + # wretry.action cannot run a wrapped action's `post` step, which is where + # actions/cache saves the cache - wrapping it would silently disable caching. - uses: actions/cache@v5 if: contains(inputs.directory, 'examples') name: Setup pnpm cache @@ -113,76 +195,99 @@ jobs: ${{ runner.os }}-pnpm-store- - name: Maybe install chromedriver if: contains(inputs.directory, 'examples') - run: | - project_makefile='${{inputs.directory}}/Makefile.toml' - webdriver_count=$(cat $project_makefile | grep "cargo-make/webdriver.toml" | wc -l) - if [ $webdriver_count -eq 1 ]; then - if ! command -v chromedriver &>/dev/null; then - echo chromedriver required - sudo apt-get update - sudo apt-get install chromium-chromedriver - else - echo chromedriver is already installed - fi - else - echo chromedriver is not required - fi + uses: nick-fields/retry@v4 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 15 + command: | + project_makefile='${{inputs.directory}}/Makefile.toml' + webdriver_count=$(cat $project_makefile | grep "cargo-make/webdriver.toml" | wc -l) + if [ $webdriver_count -eq 1 ]; then + if ! command -v chromedriver &>/dev/null; then + echo chromedriver required + sudo apt-get update + sudo apt-get install chromium-chromedriver + else + echo chromedriver is already installed + fi + else + echo chromedriver is not required + fi - name: Maybe install playwright browser dependencies if: contains(inputs.directory, 'examples') - run: | - for pw_path in $(find '${{inputs.directory}}' -name playwright.config.ts) - do - pw_dir=$(dirname $pw_path) - if [ ! -v $pw_dir ]; then - echo "Playwright required in $pw_dir" - cd $pw_dir - pnpm dlx playwright install --with-deps - else - echo Playwright is not required - fi - done + uses: nick-fields/retry@v4 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 15 + command: | + for pw_path in $(find '${{inputs.directory}}' -name playwright.config.ts) + do + pw_dir=$(dirname $pw_path) + if [ ! -v $pw_dir ]; then + echo "Playwright required in $pw_dir" + cd $pw_dir + pnpm dlx playwright install --with-deps + else + echo Playwright is not required + fi + done - name: Install Deno if: contains(inputs.directory, 'examples') - uses: denoland/setup-deno@v2 + uses: Wandalen/wretry.action@v3.8.0 with: - deno-version: v1.x + action: denoland/setup-deno@v2 + with: | + deno-version: v1.x + attempt_limit: 3 + attempt_delay: 15000 - name: Maybe install gtk-rs dependencies if: contains(inputs.directory, 'gtk') - run: | - sudo apt-get install -y libglib2.0-dev libgio2.0-cil-dev libgraphene-1.0-dev libcairo2-dev libpango1.0-dev libgtk-4-dev + uses: nick-fields/retry@v4 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 15 + command: | + sudo apt-get install -y libglib2.0-dev libgio2.0-cil-dev libgraphene-1.0-dev libcairo2-dev libpango1.0-dev libgtk-4-dev - name: Install Tailwind and Sass dependencies if: contains(inputs.directory, 'examples') - run: | - cd '${{ inputs.directory }}' - tailwindcss_version=$(echo "$LEPTOS_TAILWIND_VERSION" | sed 's/^v//') - sass_version="$LEPTOS_SASS_VERSION" - pnpm add "tailwindcss@$tailwindcss_version" "@tailwindcss/cli@$tailwindcss_version" "sass@$sass_version" + uses: nick-fields/retry@v4 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 15 + command: | + cd '${{ inputs.directory }}' + tailwindcss_version=$(echo "$LEPTOS_TAILWIND_VERSION" | sed 's/^v//') + sass_version="$LEPTOS_SASS_VERSION" + pnpm add "tailwindcss@$tailwindcss_version" "@tailwindcss/cli@$tailwindcss_version" "sass@$sass_version" - echo "Tailwind CSS version:" - ./node_modules/.bin/tailwindcss --version + echo "Tailwind CSS version:" + ./node_modules/.bin/tailwindcss --version - echo "Sass version:" - ./node_modules/.bin/sass --version + echo "Sass version:" + ./node_modules/.bin/sass --version # Run Cargo Make Task - name: ${{ inputs.cargo_make_task }} - run: | - cd '${{ inputs.directory }}' - cargo make --no-workspace --profile=github-actions ci - # check the direct-minimal-versions on release - COMMIT_MSG=$(git log -1 --pretty=format:'%s') - # Supports: v1.2.3, v1.2.3-alpha, v1.2.3-beta1, v1.2.3-rc.1, etc. - if [[ "$COMMIT_MSG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+(\.?[0-9]+)?)?$ ]]; then - cargo make --no-workspace --profile=github-actions check-minimal-versions --direct - fi + uses: nick-fields/retry@v4 + with: + max_attempts: 3 + timeout_minutes: 60 + retry_wait_seconds: 15 + command: | + cd '${{ inputs.directory }}' + cargo make --no-workspace --profile=github-actions ci + # check the direct-minimal-versions on release + COMMIT_MSG=$(git log -1 --pretty=format:'%s') + # Supports: v1.2.3, v1.2.3-alpha, v1.2.3-beta1, v1.2.3-rc.1, etc. + if [[ "$COMMIT_MSG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+(\.?[0-9]+)?)?$ ]]; then + cargo make --no-workspace --profile=github-actions check-minimal-versions --direct + fi # Check if the counter_isomorphic can be built with leptos_debuginfo cfg flag in release mode - name: ${{ inputs.cargo_make_task }} with --cfg=leptos_debuginfo if: contains(inputs.directory, 'counter_isomorphic') run: | cd '${{ inputs.directory }}' RUSTFLAGS="$RUSTFLAGS --cfg leptos_debuginfo" cargo leptos build --release - - name: Clean up ${{ inputs.directory }} - if: always() - run: | - cd '${{ inputs.directory }}' - cargo clean || true - rm -rf node_modules || true