Skip to content

Rust

Rust #4371

Workflow file for this run

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
jobs:
complete:
if: always()
# temporarily disabling publish-dry-run, it appears to be broken with recent
# changes to dependency specifications?
# needs: [fmt, cackle, cargo-deny, check-git-rev-deps, build-and-test, publish-dry-run]
needs: [fmt, cackle, cargo-deny, check-git-rev-deps, semver-checks, build-and-test]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup update
- run: cargo fmt --all --check
cackle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cackle-rs/cackle-action@997327f77e59d9cda7b0b6217f0fbdbd3f3ca904
- run: cargo acl -n run
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@b01e7a8cfb1f496c52d77361e84c1840d8246393
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
- uses: stellar/binaries@v33
with:
name: cargo-semver-checks
version: 0.37.0
- run: cargo semver-checks --exclude soroban-simulation
build-and-test:
strategy:
matrix:
rust: [msrv, latest]
test-protocol: [22]
sys:
- os: ubuntu-latest
target: wasm32-unknown-unknown
test: false
- os: ubuntu-latest-16-cores
target: x86_64-unknown-linux-gnu
test: true
# TODO: Re-enable these builds if we see value in doing so.
# - os: macos-latest
# target: x86_64-apple-darwin
# test: true
# - os: macos-latest
# target: aarch64-apple-darwin
# test: false
# - os: windows-latest
# target: x86_64-pc-windows-msvc
# test: true
runs-on: ${{ matrix.sys.os }}
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- name: Use the 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 --toolchain $msrv
- run: rustup update
- run: cargo version
- run: rustup target add ${{ matrix.sys.target }}
- uses: stellar/binaries@v18
with:
name: cargo-hack
version: 0.5.28
- run: cargo hack --each-feature clippy --locked --target ${{ matrix.sys.target }}
- if: matrix.sys.test
run: cargo hack --each-feature test --profile test-opt --locked --target ${{ matrix.sys.target }}
env:
TEST_PROTOCOL: ${{ matrix.test-protocol }}
publish-dry-run:
if: github.event_name == 'push' || startsWith(github.head_ref, 'release/')
strategy:
matrix:
sys:
- os: ubuntu-latest
target: wasm32-unknown-unknown
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
uses: stellar/actions/.github/workflows/rust-publish-dry-run.yml@main
with:
runs-on: ${{ matrix.sys.os }}
target: ${{ matrix.sys.target }}