-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (122 loc) · 5.07 KB
/
Copy pathrust.yml
File metadata and controls
148 lines (122 loc) · 5.07 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
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
144
145
146
147
148
name: Rust
on:
workflow_call:
inputs:
if:
description: Whether to run the jobs.
type: boolean
required: false
default: true
runs-on:
description: The type of machine to run the job on.
type: string
required: false
default: ubuntu-latest
enable-lint:
description: Enable lint job.
type: boolean
required: false
default: true
enable-format:
description: Enable format job.
type: boolean
required: false
default: true
enable-dependencies:
description: Enable dependencies job.
type: boolean
required: false
default: true
enable-test:
description: Enable test job.
type: boolean
required: false
default: true
# Inputs for `actions-rust-lang/setup-rust-toolchain`.
# https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/action.yml
toolchain:
description: 'Comma-separated list of Rust toolchain specifications. Last version becomes the default. -- see https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specification'
type: string
required: false
target:
description: 'Target triple to install for this toolchain'
type: string
required: false
permissions:
contents: read
jobs:
lint:
name: Lint
if: ${{ inputs.if && inputs.enable-lint }}
runs-on: ${{ inputs.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1.16.1
with:
cache-shared-key: default
toolchain: ${{ inputs.toolchain }}
target: ${{ inputs.target }}
components: clippy
- name: Lint
run: cargo clippy --all-features --all-targets --locked
format:
name: Format
if: ${{ inputs.if && inputs.enable-format }}
runs-on: ${{ inputs.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1.16.1
with:
cache-shared-key: default
toolchain: ${{ inputs.toolchain }}
target: ${{ inputs.target }}
components: rustfmt
- name: Install Cargo Binary Install
uses: cargo-bins/cargo-binstall@30b5ca8b54e1dcffd9548bc87ede1531310fdc67 # v1.20.0
- name: Install crates
run: cargo binstall --force -y cargo-sort@2.1.4
- name: Check manifest formatting
run: cargo sort --workspace --check
- name: Check formatting
run: cargo fmt --all --check
dependencies:
name: Dependencies
if: ${{ inputs.if && inputs.enable-dependencies }}
runs-on: ${{ inputs.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1.16.1
with:
cache-shared-key: default
toolchain: ${{ inputs.toolchain }}
target: ${{ inputs.target }}
- name: Install Cargo Binary Install
uses: cargo-bins/cargo-binstall@30b5ca8b54e1dcffd9548bc87ede1531310fdc67 # v1.20.0
- name: Install crates
run: cargo binstall --force -y cargo-deny@0.19.8 cargo-machete@0.9.2
- name: Check dependencies
run: cargo deny check
- name: Check unused dependencies
run: cargo machete --with-metadata
test:
name: Test
if: ${{ inputs.if && inputs.enable-test }}
runs-on: ${{ inputs.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1.16.1
with:
cache-shared-key: default
toolchain: ${{ inputs.toolchain }}
target: ${{ inputs.target }}
components: rust-src
- name: Test
run: cargo test --all-features --locked --release