-
Notifications
You must be signed in to change notification settings - Fork 892
61 lines (56 loc) · 1.99 KB
/
rust.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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 }}