-
-
Notifications
You must be signed in to change notification settings - Fork 207
137 lines (117 loc) · 3.93 KB
/
linux.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
name: ci-linux
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- '**.rs' # only execute on changes to go files
- '**/Cargo.toml' # or dependency updates
- '.github/workflows/**' # or workflow changes
push:
branches:
- main
paths:
- '**.rs' # only execute on changes to go files
- '**/Cargo.toml' # or dependency updates
- '.github/workflows/**' # or workflow changes
jobs:
udeps:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
- name: Install cargo-udeps
uses: taiki-e/install-action@cargo-udeps
- name: Check unused dependencies on default features
run: cargo udeps
- name: Check unused dependencies on full features
run: cargo udeps --features full
- name: Check unused dependencies on all features
run: cargo udeps --all-features
msrv:
name: Check MSRV - x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get MSRV from package metadata
id: msrv
run: grep rust-version Cargo.toml | cut -d'"' -f2 | sed 's/^/version=/' >> $GITHUB_OUTPUT
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.msrv.outputs.version }}
components: rustfmt, clippy
- name: check crates
run: cargo check --all --bins --examples --tests
test:
strategy:
fail-fast: false
matrix:
version:
- stable
# - nightly
name: Cargo check ${{ matrix.version }} - x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.version }}
components: rustfmt, clippy
- name: check build
run: cargo check --all --bins --examples --tests
- name: check examples
run: cargo check --all --bins --examples --tests
working-directory: ./examples
- name: check release build
run: cargo check --all --bins --examples --tests --release
- name: Cargo test
timeout-minutes: 40
run: cargo test --all --all-features --no-fail-fast -- --nocapture
hack:
strategy:
fail-fast: false
matrix:
version:
- nightly
name: Cargo check ${{ matrix.version }} - x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.version }}
components: rustfmt, clippy
- name: Install cargo-hack
run: cargo install cargo-hack
- name: check --feature-powerset
run: cargo hack check --feature-powerset --depth 1 -Z avoid-dev-deps --exclude-features server --exclude-no-default-features
cover:
strategy:
fail-fast: false
matrix:
version:
- stable
# - nightly
name: Coverage ${{ matrix.version }} - x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
needs: [hack]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.version }}
components: rustfmt, clippy
- name: Generate coverage file
if: matrix.version == 'stable' && (github.ref == 'refs/heads/main' || github.event_name == 'push')
run: |
cargo install cargo-tarpaulin
cargo tarpaulin --all-features --out xml
- name: Upload to codecov
if: matrix.version == 'stable' && (github.ref == 'refs/heads/main' || github.event_name == 'push')
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: cobertura.xml