-
Notifications
You must be signed in to change notification settings - Fork 70
86 lines (78 loc) · 2.33 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Rust
on:
push:
branches: [main, dev]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }}
cancel-in-progress: true
env:
MINIMUM_RUST_VERSION: 1.79.0
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
dirs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: dirs
run: |
dirs=$(find . -type f -name 'Makefile' -mindepth 2 | xargs dirname | sed 's|^\./||' | jq -Rnc '[inputs | "\(.)"]')
echo "dirs=$dirs" >> $GITHUB_OUTPUT
outputs:
dirs: ${{ steps.dirs.outputs.dirs }}
fmt:
needs: dirs
strategy:
matrix:
working-directory: ${{ fromJSON(needs.dirs.outputs.dirs) }}
defaults:
run:
working-directory: ${{ matrix.working-directory }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup update
- run: cargo fmt --all --check
build-and-test:
needs: dirs
strategy:
matrix:
working-directory: ${{ fromJSON(needs.dirs.outputs.dirs) }}
rust: [msrv, latest]
sys:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
defaults:
run:
working-directory: ${{ matrix.working-directory }}
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: |
rustup override set $MINIMUM_RUST_VERSION
rustup component add clippy --toolchain $MINIMUM_RUST_VERSION
- 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='-Dwarnings' >> $GITHUB_ENV
- run: rustup update
- run: cargo version
- run: rustup target add ${{ matrix.sys.target }}
- run: rustup target add wasm32-unknown-unknown
- uses: stellar/binaries@v16
with:
name: soroban-cli
version: 0.8.7
- run: make test
env:
CARGO_BUILD_TARGET: ${{ matrix.sys.target }}