-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (95 loc) · 2.74 KB
/
_build.yml
File metadata and controls
115 lines (95 loc) · 2.74 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
name: Build
on:
workflow_call:
inputs:
rust_toolchain:
required: true
type: string
rust_features:
required: false
type: string
default: --all-features
with_rustfmt:
required: false
type: boolean
default: false
with_audit:
required: false
type: boolean
default: false
with_clippy:
required: false
type: boolean
default: false
with_doc:
required: false
type: boolean
default: false
with_miri:
required: false
type: boolean
default: false
pre_build_script:
required: false
type: string
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Rust ${{ inputs.rust_toolchain }} ${{ inputs.rust_features }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ inputs.rust_toolchain }}
components: rustfmt, clippy
- id: install-miri
if: ${{ inputs.with_miri }}
run: rustup component add miri
- id: quickinstall
name: Install cargo-quickinstall
if: ${{ inputs.with_audit }}
run: |
cargo install cargo-quickinstall
- id: pre_build_script
name: Pre build script
if: ${{ inputs.pre_build_script }}
run: ${{ inputs.pre_build_script }}
- id: rustfmt
name: Rust format
if: ${{ inputs.with_rustfmt }}
run: |
cargo fmt --verbose --all -- --check
echo "Rustfmt OK" >> "$GITHUB_STEP_SUMMARY"
- id: audit
name: Audit
if: ${{ inputs.with_audit }}
run: |
cargo quickinstall cargo-audit
cargo audit
echo "Audit OK" >> "$GITHUB_STEP_SUMMARY"
- id: clippy
name: Clippy
if: ${{ inputs.with_clippy }}
run: |
cargo clippy --all ${{ inputs.rust_features }} --all-targets -- -D warnings
echo "Clippy OK" >> "$GITHUB_STEP_SUMMARY"
- id: test
name: Compile and run tests
run: cargo test ${{ inputs.rust_features }} --verbose
- id: compile-test
name: Run compile tests
run: cd compile-tests && cargo test ${{ inputs.rust_features }} --verbose
- id: miri
name: Run tests with Miri
if: ${{ inputs.with_miri }}
run: |
cargo miri test ${{ inputs.rust_features }} --verbose
echo "Miri OK" >> "$GITHUB_STEP_SUMMARY"
- id: doc
name: Doc
if: ${{ inputs.with_doc }}
run: |
RUSTDOCFLAGS="-D warnings" cargo doc ${{ inputs.rust_features }} --no-deps
echo "Doc OK" >> "$GITHUB_STEP_SUMMARY"