-
Notifications
You must be signed in to change notification settings - Fork 1.1k
202 lines (193 loc) · 6.8 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: Rust
on:
push:
branches: [ main ]
pull_request:
branches:
- "**"
paths-ignore:
- 'CONTRIBUTING.md'
- 'INSTALL.md'
- 'docker/**'
- 'docker_scylla/**'
- 'configuration/**'
- 'kubernetes/**'
workflow_dispatch:
# This allows a subsequently queued workflow run to interrupt previous runs on pull-requests
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }}'
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
# We allow redundant explicit links because `cargo rdme` doesn't know how to resolve implicit intra-crate links.
RUSTDOCFLAGS: -A rustdoc::redundant_explicit_links -D warnings
RUSTFLAGS: -D warnings
RUSTUP_MAX_RETRIES: 10
RUST_LOG: warn
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest-16-cores
timeout-minutes: 95
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: foundry-rs/foundry-toolchain@v1.2.0
- uses: pontem-network/get-solc@master
with:
version: v0.8.25
- name: Clear up some space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install chromedriver
uses: nanasess/setup-chromedriver@v2
- name: Install wasm-pack
uses: jetli/wasm-pack-action@v0.4.0
with:
version: 'latest'
- name: Run Ethereum tests
run: |
cargo test -p linera-ethereum --features ethereum
cargo test test_wasm_end_to_end_ethereum_tracker --features ethereum
- name: Build example applications
run: |
cd examples
cargo build --locked --release --target wasm32-unknown-unknown
- name: Compile the workspace with the default features (test)
run: |
cargo test --locked --no-run
- name: Compile `linera-core` for the browser
run: |
cargo build -p linera-core \
--locked \
--target wasm32-unknown-unknown \
--no-default-features \
--features web
- name: Compile the workspace with the default features (build)
run: |
cargo build --locked
- name: Compile Wasm test modules for Witty integration tests
run: |
cargo build -p linera-witty-test-modules --target wasm32-unknown-unknown
- name: Check that the WIT files are up-to-date
run: |
cargo run --bin wit-generator -- -c
- name: Run all tests using the default features
run: |
cargo test --locked
- name: Run some extra execution tests with wasmtime
run: |
cargo test --locked -p linera-execution --features wasmtime
- name: Run the browser tests
run: |
cd linera-views
WASM_BINDGEN_TEST_TIMEOUT=300 wasm-pack test --chrome --headless --features web,indexeddb
- name: Run the benchmark test
run: |
cargo build --locked -p linera-service --bin linera-benchmark --features benchmark
cargo test --locked -p linera-service --features benchmark benchmark
- name: Run Wasm application tests
run: |
cd examples
cargo test --locked
- name: Run Witty integration tests
run: |
cargo test -p linera-witty --features wasmer,wasmtime
- name: Check for outdated CLI.md
run: |
if ! diff CLI.md <(cargo run --bin linera -- help-markdown)
then
echo '`CLI.md` differs from the output of `linera help-markdown`'
echo 'Run `linera help-markdown > CLI.md` to update it.'
exit 1
fi
lint:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Clear up some space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Build check_copyright_header script
run: |
cd ./scripts/check_copyright_header
cargo build --locked --release
- name: Check Copyright headers
run: >
find linera-* examples -name '*.rs' -a -not -wholename '*/target/*' -print0
| xargs -0 scripts/target/release/check_copyright_header
- name: Put lint toolchain file in place
run: |
ln -sf toolchains/lint/rust-toolchain.toml
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install cargo-machete
run: |
cargo install cargo-machete --locked
- name: Install cargo-all-features
run: |
cargo install --git https://github.com/ma2bd/cargo-all-features --branch workspace_metadata --locked
- name: Install cargo-rdme
run: |
cargo install cargo-rdme --locked
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install cargo-sort
run: |
cargo install cargo-sort --git https://github.com/Twey/cargo-sort/ --tag linera
- name: Check formatting
run: |
cargo fmt -- --check
- name: Check if Cargo.toml files are sorted
run: |
cargo sort --check --workspace --grouped
- name: Check if example Cargo.toml files are sorted
run: |
cd examples
cargo sort --check --workspace --grouped
- name: Check for unused dependencies
run: |
cargo machete
- name: Check for outdated README.md
run: |
(set -e; for I in linera-*; do if [ -d "$I" ]; then echo $I; cargo rdme --check --no-fail-on-warnings -w $I; fi; done)
cd examples
(set -e; for I in fungible native-fungible non-fungible social crowd-funding amm hex-game counter meta-counter matching-engine; do echo $I; cargo rdme --check --no-fail-on-warnings -w $I; done)
- name: Run Wasm application lints
run: |
cd examples
cargo fmt -- --check
cargo clippy --all-targets --all-features --target wasm32-unknown-unknown --locked
cargo clippy --all-targets --all-features --target x86_64-unknown-linux-gnu --locked
- name: Run clippy
run: |
cargo clippy --all-targets --all-features --locked
cargo clippy --no-default-features --features kubernetes --locked
cargo clippy --no-default-features --locked
- name: Run cargo doc
run: |
cargo doc --locked --all-features
- name: Run cargo check-all-features
run: |
cargo check-all-features
cargo check-all-features --all-targets
- name: Restore `rust-toolchain.toml` file
if: '!cancelled()'
run: |
ln -sf toolchains/build/rust-toolchain.toml