ci: add retries for the FreeBSD VM jobs (#1908)

* ci: add retries for the FreeBSD VM jobs

* hmmm it's running 3 times

* also apply to build + fix extra continue-on-error
This commit is contained in:
Clement Tsang
2025-12-20 19:27:18 -05:00
committed by GitHub
parent 8629468e45
commit d7966473ea
3 changed files with 93 additions and 44 deletions
+42 -20
View File
@@ -33,7 +33,6 @@ permissions:
contents: read
attestations: write
# TODO: Maybe add retry job in case of timeouts?
jobs:
build-binaries:
name: "Build binaries"
@@ -237,8 +236,8 @@ jobs:
name: "release-${{ matrix.info.target }}"
path: release
build-with-vm:
name: "Build binaries via VMs"
build-freebsd:
name: "Build FreeBSD binaries"
runs-on: "ubuntu-latest"
timeout-minutes: 12
strategy:
@@ -250,21 +249,9 @@ jobs:
# Alas, that's why we do it with VMs.
- {
type: "freebsd",
os_release: "15.0",
target: "x86_64-unknown-freebsd",
}
- {
type: "freebsd",
os_release: "14.3",
target: "x86_64-unknown-freebsd",
}
- {
type: "freebsd",
os_release: "13.5",
target: "x86_64-unknown-freebsd",
}
- { os_release: "15.0", target: "x86_64-unknown-freebsd" }
- { os_release: "14.3", target: "x86_64-unknown-freebsd" }
- { os_release: "13.5", target: "x86_64-unknown-freebsd" }
steps:
- name: Checkout repository
if: matrix.info.container == ''
@@ -272,8 +259,8 @@ jobs:
with:
fetch-depth: 1
- name: Build (FreeBSD)
if: ${{ matrix.info.type == 'freebsd' }}
# The VM jobs randomly fail, and since GHA can't retry, we retry manually.
- name: Build (Attempt 1)
uses: vmactions/freebsd-vm@487ce35b96fae3e60d45b521735f5aa436ecfade # v1.2.4
with:
release: "${{ matrix.info.os_release }}"
@@ -286,6 +273,41 @@ jobs:
run: |
. "$HOME/.cargo/env"
BTM_GENERATE=true BTM_BUILD_RELEASE_CALLER=${{ inputs.caller }} cargo build --release --locked --target=${{ matrix.info.target }} --features deploy
id: upload_attempt_1
continue-on-error: true
- name: Build (Attempt 2)
uses: vmactions/freebsd-vm@487ce35b96fae3e60d45b521735f5aa436ecfade # v1.2.4
with:
release: "${{ matrix.info.os_release }}"
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS COMPLETION_DIR MANPAGE_DIR"
usesh: true
prepare: |
pkg install -y curl bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs --output rustup.sh
sh rustup.sh --default-toolchain stable -y
run: |
. "$HOME/.cargo/env"
BTM_GENERATE=true BTM_BUILD_RELEASE_CALLER=${{ inputs.caller }} cargo build --release --locked --target=${{ matrix.info.target }} --features deploy
if: steps.upload_attempt_1.outcome == 'failure'
id: upload_attempt_2
continue-on-error: true
- name: Build (Attempt 3)
uses: vmactions/freebsd-vm@487ce35b96fae3e60d45b521735f5aa436ecfade # v1.2.4
with:
release: "${{ matrix.info.os_release }}"
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS COMPLETION_DIR MANPAGE_DIR"
usesh: true
prepare: |
pkg install -y curl bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs --output rustup.sh
sh rustup.sh --default-toolchain stable -y
run: |
. "$HOME/.cargo/env"
BTM_GENERATE=true BTM_BUILD_RELEASE_CALLER=${{ inputs.caller }} cargo build --release --locked --target=${{ matrix.info.target }} --features deploy
if: steps.upload_attempt_2.outcome == 'failure'
id: upload_attempt_3
- name: Move automatically generated completion/manpage
shell: bash
+44 -17
View File
@@ -281,21 +281,9 @@ jobs:
#
# Alas, that's why we do it with VMs.
- {
type: "freebsd",
os_release: "15.0",
target: "x86_64-unknown-freebsd",
}
- {
type: "freebsd",
os_release: "14.3",
target: "x86_64-unknown-freebsd",
}
- {
type: "freebsd",
os_release: "13.5",
target: "x86_64-unknown-freebsd",
}
- { os_release: "15.0", target: "x86_64-unknown-freebsd" }
- { os_release: "14.3", target: "x86_64-unknown-freebsd" }
- { os_release: "13.5", target: "x86_64-unknown-freebsd" }
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -309,8 +297,8 @@ jobs:
key: ${{ matrix.info.target }}-${{ matrix.info.os_release }}
cache-all-crates: true
- name: Tests + Clippy (FreeBSD)
if: ${{ matrix.info.type == 'freebsd' }}
# The VM jobs randomly fail, and since GHA clearly never fails and doesn't know how to retry, we retry manually.
- name: FreeBSD Tests + Clippy (Attempt 1)
uses: vmactions/freebsd-vm@487ce35b96fae3e60d45b521735f5aa436ecfade # v1.2.4
with:
release: "${{ matrix.info.os_release }}"
@@ -325,6 +313,45 @@ jobs:
# Note this only tests the default features, but I think that's fine.
cargo test --no-fail-fast --locked -- --nocapture --quiet
cargo clippy --all-targets --workspace -- -D warnings
id: upload_attempt_1
continue-on-error: true
- name: FreeBSD Tests + Clippy (Attempt 2)
uses: vmactions/freebsd-vm@487ce35b96fae3e60d45b521735f5aa436ecfade # v1.2.4
with:
release: "${{ matrix.info.os_release }}"
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
usesh: true
prepare: |
pkg install -y curl bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs --output rustup.sh
sh rustup.sh --default-toolchain stable -y
run: |
. "$HOME/.cargo/env"
# Note this only tests the default features, but I think that's fine.
cargo test --no-fail-fast --locked -- --nocapture --quiet
cargo clippy --all-targets --workspace -- -D warnings
if: steps.upload_attempt_1.outcome == 'failure'
id: upload_attempt_2
continue-on-error: true
- name: FreeBSD Tests + Clippy (Attempt 3)
uses: vmactions/freebsd-vm@487ce35b96fae3e60d45b521735f5aa436ecfade # v1.2.4
with:
release: "${{ matrix.info.os_release }}"
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
usesh: true
prepare: |
pkg install -y curl bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs --output rustup.sh
sh rustup.sh --default-toolchain stable -y
run: |
. "$HOME/.cargo/env"
# Note this only tests the default features, but I think that's fine.
cargo test --no-fail-fast --locked -- --nocapture --quiet
cargo clippy --all-targets --workspace -- -D warnings
if: steps.upload_attempt_2.outcome == 'failure'
id: upload_attempt_3
completion:
name: "CI Pass Check"
+7 -7
View File
@@ -77,35 +77,35 @@ jobs:
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info --locked --target=${{ matrix.info.target }}
# The token is generally not needed, but sometimes the default shared token hits limits.
# Yes this is ugly as hell. Why this is not a built-in feature of GHA, I have no idea.
# Yes this is ugly as hell. Why retrying is not a built-in feature of GHA, I have no idea.
- name: Upload to codecov.io (Attempt 1)
id: upload_attempt_1
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
files: lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ matrix.info.os }}
id: upload_attempt_1
continue-on-error: true
- name: Upload to codecov.io (Attempt 2)
id: upload_attempt_2
if: steps.upload_attempt_1.outcome == 'failure'
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
files: lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ matrix.info.os }}
if: steps.upload_attempt_1.outcome == 'failure'
id: upload_attempt_2
continue-on-error: true
- name: Upload to codecov.io (Attempt 3)
id: upload_attempt_3
if: steps.upload_attempt_2.outcome == 'failure'
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
files: lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ matrix.info.os }}
continue-on-error: true
if: steps.upload_attempt_2.outcome == 'failure'
id: upload_attempt_3