-
Notifications
You must be signed in to change notification settings - Fork 5
138 lines (115 loc) · 3.74 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
131
132
133
134
135
136
137
138
# Inspired by:
# systemd/zram-generator CI - https://github.com/systemd/zram-generator/blob/main/.github/workflows/ci.yml
# aufover/aufover-benchmark CI - https://github.com/aufover/aufover-benchmark/blob/main/.github/workflows/fedora.yml
---
name: Rust CI
on:
pull_request:
push:
branches: [ main ]
# Every Monday at 04:00 AM
schedule:
- cron: 0 4 * * 1
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
test:
name: "[ Fedora ${{ matrix.fedora }} ] - Cargo Test ${{ matrix.coverage == true && '& Coverage ' || '' }}(rust ${{ matrix.rust }})"
strategy:
fail-fast: false
matrix:
rust: [ stable, beta, nightly ]
fedora: [ 35, 36, 37, rawhide ]
include:
- rust: nightly
fedora: 37
coverage: true
runs-on: ubuntu-latest
container:
image: fedora:${{ matrix.fedora }}
# Docker seccomp policy incompatible with glibc 2.34
# https://github.com/actions/runner-images/issues/3812
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v3
- name: Install rust ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
profile: minimal
- name: Install libudev and umockdev devel packages
# required to be able to build rust packages: Development Tools
# https://trendoceans.com/fix-linker-cc-not-found/
# required by prefixdevname: libudev-devel umockdev-devel
run: |
sudo dnf groupinstall -y "Development Tools"
sudo dnf install -y \
libudev-devel \
umockdev-devel
- name: Test
if: ${{ matrix.coverage != true }}
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-fail-fast
- name: Test + Coverage
# -Z flag is available only on rust nightly
if: ${{ matrix.coverage == true }}
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-fail-fast
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
- name: Generate coverage data
if: ${{ matrix.coverage == true }}
id: coverage
uses: actions-rs/grcov@v0.1
- name: CodeCov - Upload coverage data
if: ${{ matrix.coverage == true }}
uses: codecov/codecov-action@v3
with:
files: ${{ steps.coverage.outputs.report }}
fail_ci_if_error: false
rustfmt:
name: Cargo Fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install latest stable rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- name: Check format
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
clippy:
name: Cargo Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install latest nightly rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
profile: minimal
components: clippy
- name: Install libudev devel package
run: sudo apt install -y libudev-dev
- name: Run Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- --no-deps
...