-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (129 loc) · 3.62 KB
/
rust.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
139
140
141
142
name: Rust
# I unfortunately could not figure out how to get the SRC_DR to work in the
# paths key
env:
CARGO_TERM_COLOR: always
SRC_DIR: "xbf_rs"
on:
push:
branches: ["main", "develop"]
paths:
- "xbf_rs/**"
pull_request:
branches: ["main"]
paths:
- "xbf_rs/**"
schedule:
- cron: "00 18 * * *"
workflow_dispatch:
inputs:
reason:
required: false
description: Reason for triggering this workflow
type: string
jobs:
sanity-checks:
name: Sanity checks (check, clippy) as expected on ${{ matrix.os }}
needs: [debug-tests, release-tests]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
defaults:
run:
working-directory: ${{ env.SRC_DIR }}
# Sanity Checks
steps:
- uses: actions/checkout@v3
- name: Check
run: cargo check --verbose
- name: Clippy
run: cargo clippy -- -D warnings
debug-tests:
name: Regular build and test (debug) on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
defaults:
run:
working-directory: ${{ env.SRC_DIR }}
# Test in debug mode
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
release-tests:
name: Regular build and test (release) on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
defaults:
run:
working-directory: ${{ env.SRC_DIR }}
# Test in release mode
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose -r
- name: Run tests
run: cargo test --verbose -r
hygiene-checks:
name: Hygiene checks (audit, coverage, formatting) on ${{ matrix.os }}
needs: [release-tests, debug-tests, nightly-checks]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
defaults:
run:
working-directory: ${{ env.SRC_DIR }}
# Extras
steps:
- uses: actions/checkout@v3
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Setup
run: cargo install cargo-audit cargo-tarpaulin # and install dependencies
- name: Audit
run: cargo audit -D warnings
- name: Coverage
run: cargo tarpaulin --ignore-tests --all-targets --fail-under 90 --coveralls ${{ secrets.COVERALLS_REPO_TOKEN }}
- name: Format
run: cargo fmt -- --check
nightly-checks:
name: Nightly checks (build, test, Miri) on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
defaults:
run:
working-directory: ${{ env.SRC_DIR }}
# Extras
steps:
- uses: actions/checkout@v3
- name: Install nightly and Miri
run: |
rustup toolchain install nightly --component miri
rustup override set nightly
- name: Build (release)
run: cargo build --verbose -r
- name: Run tests (release)
run: cargo test --verbose -r
- name: Clean previous
run: cargo clean
- name: Build (debug)
run: cargo build --verbose
- name: Run tests (debug)
run: cargo test --verbose
- name: Clean previous for Miri
run: |
cargo clean
cargo miri setup
- name: Run Miri
run: cargo miri test