Skip to content

Merge pull request #137 from satyamz/ubuntu-upgrade #11

Merge pull request #137 from satyamz/ubuntu-upgrade

Merge pull request #137 from satyamz/ubuntu-upgrade #11

Workflow file for this run

name: Rust
on:
push:
branches: [main]
pull_request:
jobs:
# complete:
# if: always()
# needs: [fmt, 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
build-and-test:
strategy:
matrix:
rust: [msrv, latest]
sys:
- os: ubuntu-latest
target: wasm32-unknown-unknown
test: false
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
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
- name: Error on warnings and clippy checks
# Only error on warnings and checks for the msrv, because new versions of
# Rust will frequently add new warnings and checks.
if: matrix.rust == 'msrv'
run: echo RUSTFLAGS='-Wclippy::all -Wclippy::pedantic' >> $GITHUB_ENV
# TODO: Deny warnings when the warnings have been cleaned up.
# run: echo RUSTFLAGS='-Dwarnings -Wclippy::all -Wclippy::pedantic' >> $GITHUB_ENV
- run: rustup update
- run: cargo version
- run: rustup target add ${{ matrix.sys.target }}
- run: cargo clippy --target ${{ matrix.sys.target }} --lib
- if: matrix.sys.target != 'wasm32-unknown-unknown'
run: cargo clippy --target ${{ matrix.sys.target }} --bins --tests --examples --benches
- run: cargo build --target ${{ matrix.sys.target }}
- if: matrix.sys.test
run: cargo test --target ${{ matrix.sys.target }}