-
Notifications
You must be signed in to change notification settings - Fork 6
130 lines (115 loc) · 4.1 KB
/
rust_ci.yml
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
# This CI (Continuous Integration) file will automatically check your Rust code for errors.
# It runs using GitHub Actions: https://docs.github.com/en/actions
# It will check the code compiles, run tests, run lints, and check for security issues.
# CI will help you standardise your code style and to detect issues with your code easily and early.
# It makes it easier to integrate different branches once they're finished.
# adapted from https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md and https://gist.github.com/LukeMathWalker/5ae1107432ce283310c3e601fac915f3
name: Rust CI
on:
push:
# branches:
# - main
release:
types: [published]
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Check code compiles
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install apt dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: build-essential gettext git libcairo2-dev libgtk-4-dev meson ninja-build sassc valac
version: latest
- name: Clone libadwaita git repo
run: git clone https://gitlab.gnome.org/GNOME/libadwaita.git -b libadwaita-1-2 --depth=1
- name: Build libadwaita with Meson
run: |
cd libadwaita
meson . _build -Dgtk_doc=false -Dtests=false -Dexamples=false
- name: Install libadwaita with Ninja
run: |
cd libadwaita
sudo ninja -C _build install
- uses: dtolnay/rust-toolchain@nightly
- name: Run cargo check
run: cargo check
test:
name: Run tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install apt dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: build-essential gettext git libcairo2-dev libgtk-4-dev meson ninja-build sassc valac
version: latest
- name: Clone libadwaita git repo
run: git clone https://gitlab.gnome.org/GNOME/libadwaita.git -b libadwaita-1-2 --depth=1
- name: Build libadwaita with Meson
run: |
cd libadwaita
meson . _build -Dgtk_doc=false -Dtests=false -Dexamples=false
- name: Install libadwaita with Ninja
run: |
cd libadwaita
sudo ninja -C _build install
- uses: dtolnay/rust-toolchain@nightly
- name: Run cargo test
run: cargo test
fmt:
name: Lint with rustfmt
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Run rustfmt checks
run: cargo fmt --check
clippy:
name: Lint with clippy
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install apt dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: build-essential gettext git libcairo2-dev libgtk-4-dev meson ninja-build sassc valac
version: latest
- name: Clone libadwaita git repo
run: git clone https://gitlab.gnome.org/GNOME/libadwaita.git -b libadwaita-1-2 --depth=1
- name: Build libadwaita with Meson
run: |
cd libadwaita
meson . _build -Dgtk_doc=false -Dtests=false -Dexamples=false
- name: Install libadwaita with Ninja
run: |
cd libadwaita
sudo ninja -C _build install
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: Run cargo clippy checks
run: cargo clippy -- -D warnings
cargo-deny:
name: Security scan with cargo deny
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Run "cargo deny" to check for vulnerabilities
uses: EmbarkStudios/cargo-deny-action@v1
cargo-audit:
name: Security scan with cargo audit
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: Install cargo audit
run: cargo install cargo-audit
- name: Run "cargo audit" to check for vulnerabilities
run: cargo audit