Repository navigation
75 lines (58 loc) · 2.41 KB
/
Copy pathrust.yml
File metadata and controls
75 lines (58 loc) · 2.41 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
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
# Speed up CI builds a bit by not generating debug symbols.
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
# Cache Cargo registry + build artifacts. This is usually the biggest win for Rust CI runtimes.
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Enable vcan support on runner (fast path first)
run: |
set -euxo pipefail
if ! command -v setcap >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y libcap2-bin
fi
# Try to load SocketCAN + vcan.
sudo modprobe can || true
sudo modprobe can_raw || true
if ! sudo modprobe vcan; then
# GitHub's ubuntu runners use an Azure-flavoured kernel. Only install extra modules when needed.
sudo apt-get update
sudo apt-get install -y "linux-modules-extra-$(uname -r)" \
|| sudo apt-get install -y linux-modules-extra-azure \
|| true
sudo modprobe vcan || true
fi
# Helpful debug output when the kernel simply doesn't provide vcan.
if ! lsmod | grep -q '^vcan\b'; then
echo "WARNING: vcan kernel module is not available on this runner kernel ($(uname -r))."
echo " vcan-based integration tests will fail unless you use a runner/kernel that provides vcan."
fi
- name: Build & install ferroflow-vcan helper (CAP_NET_ADMIN)
run: |
set -euxo pipefail
# Build the helper in *debug* profile so it can reuse compilation artifacts from the rest of the CI run.
cargo build --bin ferroflow-vcan --features test-vcan
# Grant CAP_NET_ADMIN so integration tests can create/delete vcan interfaces without sudo.
sudo setcap cap_net_admin+ep target/debug/ferroflow-vcan
# Put the helper on PATH for the test process (tests invoke it via `Command::new("ferroflow-vcan")`).
echo "$GITHUB_WORKSPACE/target/debug" >> "$GITHUB_PATH"
- name: Make CI script executable
run: chmod +x ci-rust.sh
- name: Run CI checks
run: ./ci-rust.sh all