-
-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (125 loc) · 3.25 KB
/
sub-rs-check.yaml
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
139
140
141
142
143
name: ❖ Check - Rust
on:
workflow_call:
inputs:
clippy:
description: 'Run Clippy'
type: boolean
default: true
udeps:
description: 'Check unused dependencies'
type: boolean
default: true
formatting:
description: 'Check Formatting'
type: boolean
default: true
deny:
description: 'Run Deny'
type: boolean
default: true
tests:
description: 'Run Tests'
type: boolean
default: true
env:
RUST_BACKTRACE: full
permissions:
contents: read
jobs:
clippy:
name: Rust - Clippy
runs-on: ubuntu-latest
if: ${{ inputs.clippy }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust ${{ vars.RUST_VERSION }} with clippy
uses: actions-rs/[email protected]
with:
profile: minimal
toolchain: ${{ vars.RUST_VERSION }}
components: clippy
override: true
- name: Run Clippy
uses: actions-rs/[email protected]
with:
command: clippy
args: --all-targets --all-features --tests -- -D warnings
udeps:
name: Rust - Unused Dependencies
runs-on: ubuntu-latest
if: ${{ inputs.udeps }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust nightly
uses: actions-rs/[email protected]
with:
profile: minimal
toolchain: nightly
override: true
- name: Run cargo-udeps
uses: aig787/cargo-udeps-action@v1
with:
version: 'latest'
args: '--all-targets'
formatting:
name: Rust - Check Formatting
runs-on: ubuntu-latest
if: ${{ inputs.formatting }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install nightly with rustfmt
uses: actions-rs/[email protected]
with:
profile: minimal
toolchain: nightly
components: rustfmt
override: true
- name: Check Formatting
uses: actions-rs/[email protected]
with:
command: fmt
args: -- --check
deny:
name: Rust - Deny
runs-on: ubuntu-latest
if: ${{ inputs.deny }}
strategy:
matrix:
checks:
- advisories
- bans licenses sources
continue-on-error: ${{ matrix.checks == 'advisories' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
arguments: --all-features
tests:
name: Rust - Tests
runs-on: ubuntu-latest
if: ${{ inputs.tests }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust ${{ vars.RUST_VERSION }}
uses: actions-rs/[email protected]
with:
profile: minimal
toolchain: ${{ vars.RUST_VERSION }}
override: true
- name: Unit Tests (Default Features)
uses: actions-rs/[email protected]
with:
command: test
args: --lib --bins
- name: Unit Tests (All Features)
uses: actions-rs/[email protected]
with:
command: test
args: --all-features --lib --bins