-
Notifications
You must be signed in to change notification settings - Fork 14
145 lines (114 loc) · 3.75 KB
/
ci.yml
File metadata and controls
145 lines (114 loc) · 3.75 KB
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
name: ci
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
cargo-tests:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 20
steps:
- name: Checkout sources
uses: actions/checkout@v6
# Installs the toolchain specified in rust-toolchain.toml
- name: Install Rust toolchain
run: rustup toolchain install
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
# Install nextest
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Run tests (all features, excluding msg-sim)
run: cargo nextest run --all --all-features --no-fail-fast --exclude msg-sim
- name: Run doc tests (excluding msg-sim)
run: cargo test --doc --all --all-features
# msg-sim tests require root privileges to create network namespaces
cargo-tests-msg-sim:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout sources
uses: actions/checkout@v6
# Installs the toolchain specified in rust-toolchain.toml
- name: Install Rust toolchain
run: rustup toolchain install
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
# Install nextest
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Run msg-sim tests (requires root for network namespaces)
run: sudo env "PATH=$PATH" "HOME=$HOME" cargo nextest run -p msg-sim --all-features --no-fail-fast --test-threads=1
cargo-lint:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout sources
uses: actions/checkout@v6
- name: Install Rust nightly toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Check formatting
run: cargo +nightly fmt --all -- --check
- name: Run clippy
run: cargo +nightly clippy --all --all-features --all-targets -- -D warnings
cargo-build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 20
steps:
- name: Checkout sources
uses: actions/checkout@v6
# Installs the toolchain specified in rust-toolchain.toml
- name: Install Rust toolchain
run: rustup toolchain install
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Build all crates
run: cargo build --all --all-features --examples
- name: Build release
run: cargo build --all --all-features --examples --release
cargo-doc:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout sources
uses: actions/checkout@v6
- name: Install Rust nightly toolchain
uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Check documentation
run: RUSTDOCFLAGS="-D warnings" cargo +nightly doc --all --no-deps --all-features --document-private-items
env:
RUSTDOCFLAGS: "-D warnings"
# Find unused dependencies, this will fail if any are found.
cargo-shear:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout sources
uses: actions/checkout@v6
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@main
- name: Install cargo-shear
run: cargo binstall --no-confirm cargo-shear
- name: Run cargo shear
run: cargo shear