Skip to content

sdk/rs: retry JSON-RPC response errors that carry a transient status #9930

sdk/rs: retry JSON-RPC response errors that carry a transient status

sdk/rs: retry JSON-RPC response errors that carry a transient status #9930

Workflow file for this run

name: rust
on:
push:
branches: [ main, 'hotfix/**' ]
pull_request:
jobs:
rust-build:
runs-on: ubuntu-24.04-16c-64gb
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.97.1
- uses: Swatinem/rust-cache@v2
- name: Install agave solana tools
run: |
sh -c "$(curl -sSfL https://release.anza.xyz/v3.0.4/install)"
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- run: make rust-build
rust-lint:
runs-on: ubuntu-24.04-16c-64gb
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.97.1
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- run: make rust-lint
rust-test:
runs-on: ubuntu-24.04-16c-64gb
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.97.1
- uses: Swatinem/rust-cache@v2
- name: Install agave solana tools
run: |
sh -c "$(curl -sSfL https://release.anza.xyz/v3.0.4/install)"
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- run: make rust-test
rust-validator-test:
runs-on: ubuntu-24.04-16c-64gb
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.97.1
- uses: Swatinem/rust-cache@v2
- name: Install agave solana tools
run: |
sh -c "$(curl -sSfL https://release.anza.xyz/v3.0.4/install)"
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- run: make rust-validator-test
# Every released CLI ships as a static musl binary so it loads on any Linux
# regardless of the host glibc version. Build each package on its own, the way
# goreleaser does so feature unification matches the release, and assert the
# result is fully static.
rust-cli-static:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.97.1
with:
targets: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2
- name: Install musl toolchain
run: sudo apt-get update && sudo apt-get install -y musl-tools cmake
- name: Build the release CLIs for musl and assert they are statically linked
env:
CC_x86_64_unknown_linux_musl: musl-gcc
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: musl-gcc
run: |
for entry in \
doublezero:doublezero \
doublezero-solana-cli:doublezero-solana \
doublezero-contributor-rewards:doublezero-contributor-rewards \
doublezero-ledger-sentinel:doublezero-sentinel \
doublezero-solana-validator-debt:doublezero-solana-validator-debt
do
package="${entry%%:*}"
bin="target/x86_64-unknown-linux-musl/release/${entry##*:}"
cargo build --release --package "$package" --target x86_64-unknown-linux-musl
file "$bin"
if ! file "$bin" | grep -qE "statically linked|static-pie linked"; then
echo "::error::$bin is not statically linked"
exit 1
fi
echo "OK: $bin is statically linked"
done
# The release bump runs `cargo update --workspace`, which can silently rebind
# members onto a different locked minor.
release-bump-dry-run:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.97.1
- name: Dry-run the release version bump
run: |
set -euo pipefail
PREV=$(grep -m1 '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
NEXT=$(echo "$PREV" | awk -F. '{print $1"."$2+1".0"}')
echo "Dry-running the release bump $PREV -> $NEXT; the result is discarded."
if ! ./scripts/release/bump-version.sh "$NEXT"; then
echo "Fix, if the failure lists Cargo.lock lines: either cargo update --workspace rebound a workspace dependency onto a different version, so pin the offending requirement in [workspace.dependencies] to its locked minor (0.13, not a bare 0); or a Cargo.toml dependency change landed without its regenerated lock, so run cargo update --workspace and commit the Cargo.lock. The guard lives in scripts/release/bump-version.sh."
echo "If neither looks related to your changes, check this job on main: a loose requirement plus a PR merged since your base can rebind the tree without either PR failing on its own."
echo "::error::The release version bump fails on this tree, so the next release would fail the same way. The cause and the fix are in this job's log."
exit 1
fi