-
Notifications
You must be signed in to change notification settings - Fork 1
151 lines (119 loc) · 3.91 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
143
144
145
146
147
148
149
150
151
name: CI
on: [push]
jobs:
audit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Audit
run: |
cargo audit -D warnings
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Run unit tests
run: |
cargo test --workspace --all-targets --all-features
- name: Run doc tests
run: |
cargo test --workspace --doc --all-features
msrv:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.72"
- name: Run unit tests
run: |
cargo test --workspace --all-targets --all-features
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Run Clippy
run: |
cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Run Rustdoc
run: |
cargo doc --no-deps --workspace --all-features
env:
RUSTDOCFLAGS: -D warnings
docs:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust
uses: dtolnay/rust-toolchain@nightly
- name: Generate Docs
run: |
rustup install nightly --profile minimal
cargo +nightly doc --no-deps --workspace --all-features
env:
RUSTDOCFLAGS: --cfg docsrs
- name: Deploy Docs
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
branch: gh-pages
folder: target/doc/
git-config-name: kl-botsu
git-config-email: [email protected]
target-folder: /main/
clean: true
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install code coverage requirements
run: |
rustup toolchain install nightly --profile minimal --component llvm-tools-preview --allow-downgrade
# grcov uses "llvm-tools-preview" of the current default toolchain
rustup default nightly
# Current versions are causing "[ERROR] Execution count overflow detected."
# https://github.com/mozilla/grcov/issues/555
# curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-linux-x86_64.tar.bz2 | tar jxf -
curl -L https://github.com/mozilla/grcov/releases/download/v0.6.1/grcov-linux-x86_64.tar.bz2 | tar jxf -
- name: Run code coverage
run: |
LLVM_PROFILE_FILE="profraw/%m.profraw" cargo test --workspace --all-targets --all-features
./grcov profraw -b target/debug -s . -t html --branch --ignore-not-existing -o coverage
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Zinstrument-coverage"
RUSTDOCFLAGS: "-Cpanic=abort"
- name: Deploy Coverage
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
branch: gh-pages
folder: coverage/
git-config-name: kl-botsu
git-config-email: [email protected]
target-folder: /coverage/
clean: true
format:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Rust Formatting
continue-on-error: true
run: |
rustup toolchain install nightly --profile minimal --component rustfmt --allow-downgrade
cargo +nightly fmt -- --check
- name: Prettier
run: |
sudo npm install -g prettier prettier-plugin-toml
npx prettier -l .