Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 42 additions & 20 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,27 +89,38 @@ jobs:
runs-on: ${{ matrix.sys.os }}
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- name: Use the minimum supported Rust version
- name: Install minimum supported rust version
if: matrix.rust == 'msrv'
run: |
msrv="$(cargo metadata --format-version 1 --no-deps | jq -r '.packages | map(.rust_version) | map(values) | min')"
rustup override set $msrv
rustup component add clippy rustfmt
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: rustup update
- run: cargo version
- run: rustup target add ${{ matrix.sys.target }}
- run: rustup target add wasm32v1-none
- 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=
- run: make build-test-wasms TEST_CRATES_RUSTUP_TOOLCHAIN=$RUSTUP_TOOLCHAIN
- name: Upload test wasms
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -137,20 +148,30 @@ jobs:
runs-on: ${{ matrix.sys.os }}
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- name: Use the minimum supported Rust version
- name: Install minimum supported rust version
if: matrix.rust == 'msrv'
run: |
msrv="$(cargo metadata --format-version 1 --no-deps | jq -r '.packages | map(.rust_version) | map(values) | min')"
rustup override set $msrv
rustup component add clippy rustfmt
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: rustup update
- run: cargo version
- run: rustup target add ${{ matrix.sys.target }}
- run: rustup target add wasm32v1-none
- run: echo CARGO_BUILD_TARGET='${{ matrix.sys.target }}' >> $GITHUB_ENV
- uses: stellar/binaries@v45
with:
Expand All @@ -163,7 +184,8 @@ jobs:
path: target/wasm32v1-none/release/
- name: Clear test snapshots for checking no diffs exists after test run
run: rm -fr **/test_snapshots
- run: make test
- run: cargo version
- run: make test-only
- name: Check no diffs exist
run: git add -N . && git diff HEAD --exit-code

Expand Down
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ TEST_CRATES = $(shell cargo metadata --no-deps --format-version 1 | jq -r '.pack
MSRV = $(shell cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "soroban-sdk") | .rust_version')
TEST_CRATES_RUSTUP_TOOLCHAIN?=$(MSRV)

all: check test

export RUSTFLAGS=-Dwarnings

CARGO_DOC_ARGS?=--open

default: test

doc: fmt
cargo test --doc $(foreach c,$(LIB_CRATES),--package $(c)) --features testutils,alloc,hazmat
cargo +nightly doc --no-deps $(foreach c,$(LIB_CRATES),--package $(c)) --all-features $(CARGO_DOC_ARGS)

test: fmt build-test-wasms
test: fmt build-test-wasms test-only

test-only:
cargo hack --feature-powerset --ignore-unknown-features --features testutils --exclude-features docs test

build: build-libs build-test-wasms
Expand Down Expand Up @@ -48,3 +48,6 @@ fmt:

clean:
cargo clean

msrv:
@echo $(MSRV)