From f098532b094dfa9d803a2d013144d4883e7758a9 Mon Sep 17 00:00:00 2001 From: strawberry Date: Wed, 24 Jul 2024 22:45:27 -0400 Subject: [PATCH] ci: retry nix-build-and-cache 3 times before failing due to attic issues attic just sucks and every 5 CI runs guarantees at least 2 false gateway errors that i can't do anything about. Signed-off-by: strawberry --- .github/workflows/ci.yml | 93 +++++++++++++++++++++++++++-- .github/workflows/documentation.yml | 40 ++++++++++++- 2 files changed, 125 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d95147ae..2e01808e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -134,7 +134,23 @@ jobs: - name: Cache CI dependencies run: | - bin/nix-build-and-cache ci + # attic nix binary cache server is very, very terribly flakey. nothing i can do to fix it other than retry multiple times here + ATTEMPTS=3 + SUCCESS=false + while (( ATTEMPTS-- > 0 )) + do + bin/nix-build-and-cache ci + if [[ $? == 0 ]]; then + SUCCESS=true + break + else + sleep 3 + fi + done + + if [[ $SUCCESS == "false" ]]; then + exit 1 + fi # use sccache for Rust - name: Run sccache-cache @@ -271,7 +287,24 @@ jobs: CARGO_DEB_TARGET_TUPLE=$(echo ${{ matrix.target }} | grep -o -E '^([^-]*-){3}[^-]*') SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) - bin/nix-build-and-cache just .#static-${{ matrix.target }}-all-features + # attic nix binary cache server is very, very terribly flakey. nothing i can do to fix it other than retry multiple times here + ATTEMPTS=3 + SUCCESS=false + while (( ATTEMPTS-- > 0 )) + do + bin/nix-build-and-cache just .#static-${{ matrix.target }}-all-features + if [[ $? == 0 ]]; then + SUCCESS=true + break + else + sleep 3 + fi + done + + if [[ $SUCCESS == "false" ]]; then + exit 1 + fi + mkdir -v -p target/release/ mkdir -v -p target/$CARGO_DEB_TARGET_TUPLE/release/ cp -v -f result/bin/conduit target/release/conduwuit @@ -294,7 +327,23 @@ jobs: CARGO_DEB_TARGET_TUPLE=$(echo ${{ matrix.target }} | grep -o -E '^([^-]*-){3}[^-]*') SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) - bin/nix-build-and-cache just .#static-${{ matrix.target }}-all-features-debug + # attic nix binary cache server is very, very terribly flakey. nothing i can do to fix it other than retry multiple times here + ATTEMPTS=3 + SUCCESS=false + while (( ATTEMPTS-- > 0 )) + do + bin/nix-build-and-cache just .#static-${{ matrix.target }}-all-features-debug + if [[ $? == 0 ]]; then + SUCCESS=true + break + else + sleep 3 + fi + done + + if [[ $SUCCESS == "false" ]]; then + exit 1 + fi # > warning: dev profile is not supported and will be a hard error in the future. cargo-deb is for making releases, and it doesn't make sense to use it with dev profiles. # so we need to coerce cargo-deb into thinking this is a release binary @@ -357,12 +406,46 @@ jobs: - name: Build OCI image ${{ matrix.target }} run: | - bin/nix-build-and-cache just .#oci-image-${{ matrix.target }}-all-features + # attic nix binary cache server is very, very terribly flakey. nothing i can do to fix it other than retry multiple times here + ATTEMPTS=3 + SUCCESS=false + while (( ATTEMPTS-- > 0 )) + do + bin/nix-build-and-cache just .#oci-image-${{ matrix.target }}-all-features + if [[ $? == 0 ]]; then + SUCCESS=true + break + else + sleep 3 + fi + done + + if [[ $SUCCESS == "false" ]]; then + exit 1 + fi + cp -v -f result oci-image-${{ matrix.target }}.tar.gz - name: Build debug OCI image ${{ matrix.target }} run: | - bin/nix-build-and-cache just .#oci-image-${{ matrix.target }}-all-features-debug + # attic nix binary cache server is very, very terribly flakey. nothing i can do to fix it other than retry multiple times here + ATTEMPTS=3 + SUCCESS=false + while (( ATTEMPTS-- > 0 )) + do + bin/nix-build-and-cache just .#oci-image-${{ matrix.target }}-all-features-debug + if [[ $? == 0 ]]; then + SUCCESS=true + break + else + sleep 3 + fi + done + + if [[ $SUCCESS == "false" ]]; then + exit 1 + fi + cp -v -f result oci-image-${{ matrix.target }}-debug.tar.gz - name: Upload OCI image ${{ matrix.target }} diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index c6f9133a..f9e8000b 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -107,7 +107,23 @@ jobs: - name: Cache CI dependencies run: | - bin/nix-build-and-cache ci + # attic nix binary cache server is very, very terribly flakey. nothing i can do to fix it other than retry multiple times here + ATTEMPTS=3 + SUCCESS=false + while (( ATTEMPTS-- > 0 )) + do + bin/nix-build-and-cache ci + if [[ $? == 0 ]]; then + SUCCESS=true + break + else + sleep 3 + fi + done + + if [[ $SUCCESS == "false" ]]; then + exit 1 + fi - name: Run lychee and markdownlint run: | @@ -116,8 +132,26 @@ jobs: - name: Build documentation (book) run: | - ./bin/nix-build-and-cache just .#book - cp -r --dereference result public + # attic nix binary cache server is very, very terribly flakey. nothing i can do to fix it other than retry multiple times here + ATTEMPTS=3 + SUCCESS=false + while (( ATTEMPTS-- > 0 )) + do + bin/nix-build-and-cache just .#book + if [[ $? == 0 ]]; then + SUCCESS=true + break + else + sleep 3 + fi + done + + if [[ $SUCCESS == "false" ]]; then + exit 1 + fi + + cp -r --dereference result public + - name: Upload generated documentation (book) as normal artifact uses: actions/upload-artifact@v4 with: