Run CI for the msrv and latest rust version #1175
Workflow file for this run
This file contains 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] | |
pull_request: | |
merge_group: | |
env: | |
RUSTFLAGS: -Dwarnings -Dclippy::all -Dclippy::pedantic | |
CARGO_HACK_ARGS: --feature-powerset --exclude-features default --group-features base64,serde,arbitrary,hex | |
jobs: | |
complete: | |
if: always() | |
needs: [generate, fmt, build, test, publish-dry-run] | |
runs-on: ubuntu-latest | |
steps: | |
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | |
run: exit 1 | |
generate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- run: rustup update | |
- run: make clean generate | |
- shell: 'script --return --quiet --command "bash {0}"' | |
run: git diff --exit-code || (echo "Generated Rust code is out-of-date with the XDR .x files.\nRegenerate and test them by running 'make clean generate build test'." && exit 1) | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: rustup update | |
- run: cargo fmt --all --check | |
build: | |
strategy: | |
matrix: | |
rust: [msrv, latest] | |
sys: | |
- os: ubuntu-latest | |
target: wasm32-unknown-unknown | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
# TODO: Address GitHub Actions concurrency limits and re-enable. | |
# - os: macos-latest | |
# target: x86_64-apple-darwin | |
# - os: macos-latest | |
# target: aarch64-apple-darwin | |
# TODO: Address disk space usage problems and re-enable. | |
# - os: windows-latest | |
# target: x86_64-pc-windows-msvc | |
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 | |
- name: Disable warnings and clippy checks on latest | |
if: matrix.rust == 'latest' | |
run: echo RUSTFLAGS= >> $GITHUB_ENV | |
- run: rustup update | |
- run: rustup target add ${{ matrix.sys.target }} | |
- run: cargo version | |
- uses: stellar/binaries@v12 | |
with: | |
name: cargo-hack | |
version: 0.5.16 | |
- run: cargo hack clippy $CARGO_HACK_ARGS --target ${{ matrix.sys.target }} --all-targets | |
test: | |
strategy: | |
matrix: | |
rust: [msrv, latest] | |
sys: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
# TODO: Address GitHub Actions concurrency limits and re-enable. | |
# - os: macos-latest | |
# target: x86_64-apple-darwin | |
# TODO: Address disk space usage problems and re-enable. | |
# - os: windows-latest | |
# target: x86_64-pc-windows-msvc | |
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 | |
- name: Disable warnings and clippy checks on latest | |
if: matrix.rust == 'latest' | |
run: echo RUSTFLAGS= >> $GITHUB_ENV | |
- run: rustup update | |
- run: rustup target add ${{ matrix.sys.target }} | |
- run: cargo version | |
- uses: stellar/binaries@v12 | |
with: | |
name: cargo-hack | |
version: 0.5.16 | |
- run: cargo hack test $CARGO_HACK_ARGS | |
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 }} | |
cargo-hack-feature-options: --feature-powerset --exclude-features default --group-features base64,serde,arbitrary,hex |