Add min_value and max_value helpers to 256-bit numbers
#6393
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Rust | |
| on: | |
| push: | |
| branches: [main, release/**] | |
| pull_request: | |
| merge_group: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }}-{{ github.event_name }} | |
| cancel-in-progress: true | |
| env: | |
| ARTIFACT_RETENTION_DAYS_FOR_TEST_WASMS: 7 | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| complete: | |
| if: always() | |
| needs: [fmt, check-git-rev-deps, semver-checks, build, test, expand-test-wasms, build-fuzz, docs, readme, migration-docs] | |
| runs-on: ubuntu-slim | |
| steps: | |
| - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | |
| run: exit 1 | |
| setup: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| sys: ${{ steps.sys.outputs.sys }} | |
| steps: | |
| - id: sys | |
| run: | | |
| if [ "${{ github.event_name }}" == "pull_request" ]; then | |
| sys='[ | |
| { | |
| "os": "ubuntu-latest", | |
| "target": "x86_64-unknown-linux-gnu" | |
| } | |
| ]' | |
| else | |
| sys='[ | |
| { | |
| "os": "ubuntu-latest", | |
| "target": "x86_64-unknown-linux-gnu" | |
| }, | |
| { | |
| "os": "ubuntu-24.04-arm", | |
| "target": "aarch64-unknown-linux-gnu" | |
| }, | |
| { | |
| "os": "macos-15-intel", | |
| "target": "x86_64-apple-darwin" | |
| }, | |
| { | |
| "os": "macos-latest", | |
| "target": "aarch64-apple-darwin" | |
| }, | |
| { | |
| "os": "windows-latest", | |
| "target": "x86_64-pc-windows-msvc" | |
| } | |
| ]' | |
| fi | |
| echo "sys=$(<<< $sys jq -c)" >> $GITHUB_OUTPUT | |
| fmt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - run: rustup update | |
| - run: cargo fmt --all --check | |
| cargo-deny: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| checks: | |
| - advisories | |
| - bans licenses sources | |
| # Prevent sudden announcement of a new advisory from failing ci: | |
| continue-on-error: ${{ matrix.checks == 'advisories' }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: EmbarkStudios/cargo-deny-action@3fd3802e88374d3fe9159b834c7714ec57d6c979 | |
| with: | |
| command: check ${{ matrix.checks }} | |
| check-git-rev-deps: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: stellar/actions/rust-check-git-rev-deps@main | |
| semver-checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - run: rustup update stable | |
| - name: Determine Rust n-2 version since cargo-semver-checks is rarely available for the latest version | |
| id: rust-version | |
| run: | | |
| current_version=$(rustc +stable --version | grep -oE '[0-9]+\.[0-9]+' | head -1) | |
| major=$(echo $current_version | cut -d. -f1) | |
| minor=$(echo $current_version | cut -d. -f2) | |
| prev_minor=$((minor - 2)) | |
| prev_version="${major}.${prev_minor}" | |
| echo "Latest stable: $current_version, using n-2: $prev_version" | |
| echo "version=$prev_version" >> $GITHUB_OUTPUT | |
| - name: Install Rust ${{ steps.rust-version.outputs.version }} | |
| run: | | |
| rustup install ${{ steps.rust-version.outputs.version }} | |
| rustup override set ${{ steps.rust-version.outputs.version }} | |
| - name: Verify Rust version | |
| run: | | |
| rustc --version | |
| cargo --version | |
| - uses: stellar/binaries@v51 | |
| with: | |
| name: cargo-semver-checks | |
| version: 0.45.0 | |
| - run: > | |
| cargo semver-checks | |
| --exclude soroban-meta | |
| --exclude soroban-token-spec | |
| --exclude stellar-asset-spec | |
| build: | |
| needs: setup | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rust: [msrv, latest] | |
| sys: ${{ fromJSON(needs.setup.outputs.sys) }} | |
| runs-on: ${{ matrix.sys.os }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install minimum supported rust version | |
| if: matrix.rust == 'msrv' | |
| run: | | |
| msrv="$(make msrv)" | |
| rustup install $msrv | |
| rustup component add --toolchain $msrv clippy rustfmt | |
| rustup target add --toolchain $msrv ${{ matrix.sys.target }} | |
| rustup target add --toolchain $msrv wasm32v1-none | |
| - name: Install latest rust version | |
| if: matrix.rust == 'latest' | |
| run: | | |
| rustup update | |
| rustup target add ${{ matrix.sys.target }} | |
| rustup target add wasm32v1-none | |
| - name: Use the minimum supported rust version | |
| if: matrix.rust == 'msrv' | |
| run: echo RUSTUP_TOOLCHAIN="$(make msrv)" >> $GITHUB_ENV | |
| - name: Set latest toolchain | |
| if: matrix.rust == 'latest' | |
| run: echo RUSTUP_TOOLCHAIN="$(rustup show active-toolchain | cut -d' ' -f1)" >> $GITHUB_ENV | |
| - uses: stellar/actions/rust-cache@main | |
| - name: Error on warnings only for msrv | |
| if: matrix.rust == 'msrv' | |
| run: echo RUSTFLAGS='-Dwarnings' >> $GITHUB_ENV | |
| - run: echo CARGO_BUILD_TARGET='${{ matrix.sys.target }}' >> $GITHUB_ENV | |
| - uses: stellar/binaries@v45 | |
| with: | |
| name: cargo-hack | |
| version: 0.5.28 | |
| - run: cargo version | |
| - run: make build-libs | |
| - run: make build-test-wasms TEST_CRATES_RUSTUP_TOOLCHAIN=$RUSTUP_TOOLCHAIN | |
| - name: Upload test wasms | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-wasms-${{ matrix.rust }}-${{ matrix.sys.target }} | |
| path: target/wasm32v1-none/release/test_*.wasm | |
| retention-days: ${{ env.ARTIFACT_RETENTION_DAYS_FOR_TEST_WASMS }} | |
| test: | |
| needs: [setup, build] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rust: [msrv, latest] | |
| sys: ${{ fromJSON(needs.setup.outputs.sys) }} | |
| runs-on: ${{ matrix.sys.os }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install minimum supported rust version | |
| if: matrix.rust == 'msrv' | |
| run: | | |
| msrv="$(make msrv)" | |
| rustup install $msrv | |
| rustup component add --toolchain $msrv clippy rustfmt | |
| rustup target add --toolchain $msrv ${{ matrix.sys.target }} | |
| rustup target add --toolchain $msrv wasm32v1-none | |
| - name: Install latest rust version | |
| if: matrix.rust == 'latest' | |
| run: | | |
| rustup update | |
| rustup target add ${{ matrix.sys.target }} | |
| rustup target add wasm32v1-none | |
| - name: Use the minimum supported rust version | |
| if: matrix.rust == 'msrv' | |
| run: echo RUSTUP_TOOLCHAIN="$(make msrv)" >> $GITHUB_ENV | |
| - name: Set latest toolchain | |
| if: matrix.rust == 'latest' | |
| run: echo RUSTUP_TOOLCHAIN="$(rustup show active-toolchain | cut -d' ' -f1)" >> $GITHUB_ENV | |
| - uses: stellar/actions/rust-cache@main | |
| - name: Error on warnings only for msrv | |
| if: matrix.rust == 'msrv' | |
| run: echo RUSTFLAGS='-Dwarnings' >> $GITHUB_ENV | |
| - run: echo CARGO_BUILD_TARGET='${{ matrix.sys.target }}' >> $GITHUB_ENV | |
| - uses: stellar/binaries@v45 | |
| with: | |
| name: cargo-hack | |
| version: 0.5.28 | |
| - name: Restore test wasms for tests from one of the msrv builds | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: test-wasms-msrv-x86_64-unknown-linux-gnu | |
| path: target/wasm32v1-none/release/ | |
| - name: Clear test snapshots for checking no diffs exists after test run | |
| run: rm -fr **/test_snapshots | |
| - run: cargo version | |
| - run: make test-only | |
| - name: Check no diffs exist | |
| run: git add -N . && git diff HEAD --exit-code | |
| build-fuzz: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: stellar/actions/rust-cache@main | |
| - run: rustup install nightly | |
| - uses: stellar/binaries@v45 | |
| with: | |
| name: cargo-fuzz | |
| version: 0.13.1 | |
| - run: make build-fuzz | |
| - name: Check no diffs exist | |
| run: git add -N . && git diff HEAD --exit-code | |
| docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: stellar/actions/rust-cache@main | |
| - run: rustup install nightly | |
| - run: make doc | |
| - name: Check no diffs exist | |
| run: git add -N . && git diff HEAD --exit-code | |
| readme: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: stellar/actions/rust-cache@main | |
| - run: rustup install nightly | |
| - run: make readme | |
| - run: git add -N . && git diff HEAD --exit-code | |
| migration-docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: stellar/actions/rust-cache@main | |
| - run: rustup update | |
| - run: | | |
| version="$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "soroban-sdk") | .version | split("\\.";"")[0] | "v"+.')" | |
| git grep "${version}" -- soroban-sdk/src/_migrating.rs \ | |
| || (echo "The _migrating ${version} section is missing." && exit 1) | |
| expand-test-wasms: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: stellar/actions/rust-cache@main | |
| - name: Install minimum supported rust version | |
| run: | | |
| msrv="$(make msrv)" | |
| rustup install $msrv | |
| rustup target add --toolchain $msrv wasm32v1-none | |
| rustup component add rustfmt | |
| - uses: stellar/binaries@v45 | |
| with: | |
| name: cargo-hack | |
| version: 0.5.28 | |
| - uses: stellar/binaries@v45 | |
| with: | |
| name: cargo-expand | |
| version: 1.0.116 | |
| - run: make expand-tests | |
| - name: Check no diffs exist | |
| run: git add -N . && git diff HEAD --exit-code | |
| publish-dry-run: | |
| if: github.event_name == 'push' || startsWith(github.head_ref, 'release/') | |
| strategy: | |
| matrix: | |
| sys: | |
| - os: ubuntu-latest | |
| target: wasm32v1-none | |
| cargo-hack-feature-options: --manifest-path Cargo.toml --exclude soroban-meta --exclude soroban-spec --exclude soroban-spec-rust --exclude soroban-ledger-snapshot --exclude-features testutils,docs,default,std,experimental_spec_shaking_v2 --feature-powerset | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| cargo-hack-feature-options: '--feature-powerset --exclude-features docs' | |
| uses: stellar/actions/.github/workflows/rust-publish-dry-run.yml@main | |
| with: | |
| runs-on: ${{ matrix.sys.os }} | |
| target: ${{ matrix.sys.target }} | |
| cargo-hack-feature-options: ${{ matrix.sys.cargo-hack-feature-options }} |