Skip to content

Commit a4808e1

Browse files
committed
Add GitHub Actions CI workflow
- Check: cargo check for quick compilation verification - Test: run all workspace tests - Clippy: lint with warnings as errors - Format: verify code formatting with rustfmt - Build: create release binaries and upload as artifacts Runs on Ubuntu 24.04 with all required system dependencies.
1 parent c5bfb90 commit a4808e1

1 file changed

Lines changed: 215 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
RUST_BACKTRACE: 1
12+
13+
jobs:
14+
check:
15+
name: Check
16+
runs-on: ubuntu-24.04
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Install system dependencies
22+
run: |
23+
sudo apt-get update
24+
sudo apt-get install -y \
25+
build-essential \
26+
pkg-config \
27+
libx264-dev \
28+
libxcb1-dev \
29+
libxcb-shm0-dev \
30+
libxcb-randr0-dev \
31+
libxcb-render0-dev \
32+
libpipewire-0.3-dev \
33+
libspa-0.2-dev \
34+
libclang-dev \
35+
libevdev-dev \
36+
libgtk-3-dev \
37+
libssl-dev \
38+
evdi-dkms
39+
40+
- name: Install Rust toolchain
41+
uses: dtolnay/rust-action@stable
42+
43+
- name: Cache cargo
44+
uses: actions/cache@v4
45+
with:
46+
path: |
47+
~/.cargo/bin/
48+
~/.cargo/registry/index/
49+
~/.cargo/registry/cache/
50+
~/.cargo/git/db/
51+
target/
52+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
53+
restore-keys: ${{ runner.os }}-cargo-
54+
55+
- name: Run cargo check
56+
run: cargo check --workspace --all-targets
57+
58+
test:
59+
name: Test
60+
runs-on: ubuntu-24.04
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@v4
64+
65+
- name: Install system dependencies
66+
run: |
67+
sudo apt-get update
68+
sudo apt-get install -y \
69+
build-essential \
70+
pkg-config \
71+
libx264-dev \
72+
libxcb1-dev \
73+
libxcb-shm0-dev \
74+
libxcb-randr0-dev \
75+
libxcb-render0-dev \
76+
libpipewire-0.3-dev \
77+
libspa-0.2-dev \
78+
libclang-dev \
79+
libevdev-dev \
80+
libgtk-3-dev \
81+
libssl-dev \
82+
evdi-dkms
83+
84+
- name: Install Rust toolchain
85+
uses: dtolnay/rust-action@stable
86+
87+
- name: Cache cargo
88+
uses: actions/cache@v4
89+
with:
90+
path: |
91+
~/.cargo/bin/
92+
~/.cargo/registry/index/
93+
~/.cargo/registry/cache/
94+
~/.cargo/git/db/
95+
target/
96+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
97+
restore-keys: ${{ runner.os }}-cargo-
98+
99+
- name: Run tests
100+
run: cargo test --workspace
101+
102+
clippy:
103+
name: Clippy
104+
runs-on: ubuntu-24.04
105+
steps:
106+
- name: Checkout
107+
uses: actions/checkout@v4
108+
109+
- name: Install system dependencies
110+
run: |
111+
sudo apt-get update
112+
sudo apt-get install -y \
113+
build-essential \
114+
pkg-config \
115+
libx264-dev \
116+
libxcb1-dev \
117+
libxcb-shm0-dev \
118+
libxcb-randr0-dev \
119+
libxcb-render0-dev \
120+
libpipewire-0.3-dev \
121+
libspa-0.2-dev \
122+
libclang-dev \
123+
libevdev-dev \
124+
libgtk-3-dev \
125+
libssl-dev \
126+
evdi-dkms
127+
128+
- name: Install Rust toolchain
129+
uses: dtolnay/rust-action@stable
130+
with:
131+
components: clippy
132+
133+
- name: Cache cargo
134+
uses: actions/cache@v4
135+
with:
136+
path: |
137+
~/.cargo/bin/
138+
~/.cargo/registry/index/
139+
~/.cargo/registry/cache/
140+
~/.cargo/git/db/
141+
target/
142+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
143+
restore-keys: ${{ runner.os }}-cargo-
144+
145+
- name: Run clippy
146+
run: cargo clippy --workspace --all-targets -- -D warnings
147+
148+
format:
149+
name: Format
150+
runs-on: ubuntu-latest
151+
steps:
152+
- name: Checkout
153+
uses: actions/checkout@v4
154+
155+
- name: Install Rust toolchain
156+
uses: dtolnay/rust-action@stable
157+
with:
158+
components: rustfmt
159+
160+
- name: Check formatting
161+
run: cargo fmt --all -- --check
162+
163+
build:
164+
name: Build Release
165+
runs-on: ubuntu-24.04
166+
needs: [check, test, clippy, format]
167+
steps:
168+
- name: Checkout
169+
uses: actions/checkout@v4
170+
171+
- name: Install system dependencies
172+
run: |
173+
sudo apt-get update
174+
sudo apt-get install -y \
175+
build-essential \
176+
pkg-config \
177+
libx264-dev \
178+
libxcb1-dev \
179+
libxcb-shm0-dev \
180+
libxcb-randr0-dev \
181+
libxcb-render0-dev \
182+
libpipewire-0.3-dev \
183+
libspa-0.2-dev \
184+
libclang-dev \
185+
libevdev-dev \
186+
libgtk-3-dev \
187+
libssl-dev \
188+
evdi-dkms
189+
190+
- name: Install Rust toolchain
191+
uses: dtolnay/rust-action@stable
192+
193+
- name: Cache cargo
194+
uses: actions/cache@v4
195+
with:
196+
path: |
197+
~/.cargo/bin/
198+
~/.cargo/registry/index/
199+
~/.cargo/registry/cache/
200+
~/.cargo/git/db/
201+
target/
202+
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
203+
restore-keys: ${{ runner.os }}-cargo-release-
204+
205+
- name: Build release binaries
206+
run: cargo build --release --workspace
207+
208+
- name: Upload artifacts
209+
uses: actions/upload-artifact@v4
210+
with:
211+
name: linglide-linux-x86_64
212+
path: |
213+
target/release/linglide
214+
target/release/linglide-gui
215+
if-no-files-found: error

0 commit comments

Comments
 (0)