forge
Explore
Log in

Don't you dare go Hollow

wifi_lab

Clone
★ 0

0 watching0 forksRust2.1 MiBb265998Tahinli1 month ago27 commits

ci.yml125 lines, 3.8 KiBHistoryRawDownload
1name: CI
2
3on:
4 push:
5 branches: [main]
6 pull_request:
7 branches: [main]
8
9concurrency:
10 group: ${{ github.workflow }}-${{ github.ref }}
11 cancel-in-progress: true
12
13env:
14 CARGO_TERM_COLOR: always
15
16jobs:
17 fmt:
18 name: fmt
19 runs-on: ubuntu-latest
20 steps:
21 - uses: actions/checkout@v4
22 - name: Install Rust (stable + rustfmt)
23 uses: dtolnay/rust-toolchain@stable
24 with:
25 components: rustfmt
26 - name: cargo fmt --check
27 run: cargo fmt --check
28
29 clippy:
30 name: clippy
31 runs-on: ubuntu-latest
32 steps:
33 - uses: actions/checkout@v4
34 - name: Install Rust (stable + clippy)
35 uses: dtolnay/rust-toolchain@stable
36 with:
37 components: clippy
38 - name: Install system dependencies
39 run: |
40 sudo apt-get update
41 sudo apt-get install -y --no-install-recommends \
42 libxkbcommon-dev libwayland-dev libasound2-dev libudev-dev
43 - uses: Swatinem/rust-cache@v2
44 - name: cargo clippy
45 run: cargo clippy --all-targets -- -D warnings
46
47 test:
48 name: test
49 runs-on: ubuntu-latest
50 steps:
51 - uses: actions/checkout@v4
52 - name: Install Rust (stable)
53 uses: dtolnay/rust-toolchain@stable
54 - name: Install system dependencies
55 run: |
56 sudo apt-get update
57 sudo apt-get install -y --no-install-recommends \
58 libxkbcommon-dev libwayland-dev libasound2-dev libudev-dev
59 - uses: Swatinem/rust-cache@v2
60 - name: cargo test --release
61 run: cargo test --release
62
63 build:
64 name: build
65 runs-on: ubuntu-latest
66 steps:
67 - uses: actions/checkout@v4
68 - name: Install Rust (stable)
69 uses: dtolnay/rust-toolchain@stable
70 - name: Install system dependencies
71 run: |
72 sudo apt-get update
73 sudo apt-get install -y --no-install-recommends \
74 libxkbcommon-dev libwayland-dev libasound2-dev libudev-dev
75 - uses: Swatinem/rust-cache@v2
76 - name: cargo build --release
77 run: cargo build --release
78 - name: Upload release binary
79 uses: actions/upload-artifact@v4
80 with:
81 name: wifi_lab-release
82 path: target/release/wifi_lab
83 retention-days: 7
84
85 smoke:
86 name: smoke (mock UI under xvfb)
87 needs: build
88 runs-on: ubuntu-latest
89 steps:
90 - uses: actions/checkout@v4
91 - name: Install Rust (stable)
92 uses: dtolnay/rust-toolchain@stable
93 - name: Install system dependencies (incl. xvfb)
94 run: |
95 sudo apt-get update
96 sudo apt-get install -y --no-install-recommends \
97 xvfb libxkbcommon-dev libwayland-dev libasound2-dev libudev-dev \
98 libxkbcommon-x11-0 libxcb-xkb1 libegl1 libgl1
99 - uses: Swatinem/rust-cache@v2
100 - name: cargo build --release
101 run: cargo build --release
102 - name: Run --mock under xvfb for 25s
103 id: smoke
104 run: |
105 set +e
106 xvfb-run -a timeout 25 ./target/release/wifi_lab --mock >smoke.log 2>&1
107 status=$?
108 set -e
109 cat smoke.log
110 echo "exit_status=$status" >> "$GITHUB_OUTPUT"
111 # Success criteria:
112 # - 124: killed by timeout (still alive, no early crash), AND no panic
113 # - 0: exited cleanly on its own
114 # - any other status with no panic in the log is still treated as
115 # failure to be explicit about the process dying abnormally.
116 if grep -q "panicked" smoke.log; then
117 echo "::error::panic detected in mock-mode output"
118 exit 1
119 fi
120 if [ "$status" -eq 124 ] || [ "$status" -eq 0 ]; then
121 echo "smoke OK (status $status)"
122 exit 0
123 fi
124 echo "::error::mock-mode exited abnormally with status $status"
125 exit 1