-
Notifications
You must be signed in to change notification settings - Fork 27
139 lines (129 loc) · 4.65 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Rust
on:
push:
branches: [main]
pull_request:
merge_group:
env:
CARGO_HACK_ARGS: --feature-powerset --exclude-features default --group-features base64,serde,serde_json,schemars,arbitrary,hex
jobs:
complete:
if: always()
needs: [generate, fmt, readme, 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
readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- run: rustup install nightly
- run: make readme
- run: git add -N . && git diff HEAD --exit-code
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: 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 -Dclippy::all -Dclippy::pedantic' >> $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: 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 -Dclippy::all -Dclippy::pedantic' >> $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