-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (52 loc) · 1.53 KB
/
rust.yml
File metadata and controls
64 lines (52 loc) · 1.53 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
name: Rust
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Cache apt packages
uses: actions/cache@v4
with:
path: ~/apt-cache
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/rust.yml') }}
restore-keys: |
${{ runner.os }}-apt-
- name: Restore apt cache
run: |
sudo mkdir -p /var/cache/apt/archives
sudo cp -r ~/apt-cache/. /var/cache/apt/archives/ 2>/dev/null || true
- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install -y \
pkg-config \
libx11-dev \
libx11-xcb-dev \
libxcb1-dev \
libxcb-shape0-dev \
libxcb-xfixes0-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev
- name: Save apt cache
run: |
mkdir -p ~/apt-cache
cp /var/cache/apt/archives/*.deb ~/apt-cache/ 2>/dev/null || true
- name: Check formatting
run: cargo fmt --check
- name: Run Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Run tests
run: cargo test --all-targets