Skip to content

Commit 8c7460d

Browse files
committed
ci: add github workflow with checks
windows and linux clippy and fmt fix formatting check typos
1 parent bda22b2 commit 8c7460d

File tree

4 files changed

+54
-7
lines changed

4 files changed

+54
-7
lines changed

.github/workflows/rust.yml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,44 @@
1-
# TODO
1+
name: test suite
2+
on: [push, pull_request]
3+
4+
env:
5+
CLICOLOR: 1
6+
7+
jobs:
8+
spelling:
9+
name: Spell Check with Typos
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Actions Repository
13+
uses: actions/checkout@v4
14+
- name: Spell Check Repo
15+
uses: crate-ci/[email protected]
16+
17+
clippy:
18+
name: clippy
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: dtolnay/rust-toolchain@stable
23+
- run: cargo clippy -- -D warnings
24+
25+
format:
26+
name: format
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: dtolnay/rust-toolchain@stable
31+
- run: cargo fmt -- --check
32+
33+
test_and_build:
34+
strategy:
35+
matrix:
36+
os: [ubuntu-latest, windows-latest]
37+
38+
name: test_and_build
39+
runs-on: ${{ matrix.os }}
40+
steps:
41+
- uses: actions/checkout@v4
42+
- uses: dtolnay/rust-toolchain@stable
43+
- run: cargo test --release
44+
- run: cargo b --release

_typos.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[files]
2+
extend-exclude = [
3+
"stm32cubeprogrammer-sys/include",
4+
"stm32cubeprogrammer-sys/src/bindings_unix.rs",
5+
"stm32cubeprogrammer-sys/src/bindings_windows.rs",
6+
]

stm32cubeprogrammer-cli/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//! - Enabling read protection
88
//! - Disabling read protection
99
//! - Resetting target
10-
//!
10+
//!
1111
//! All commands above can be combined in a single command line invocation by chaining them.
12-
//!
12+
//!
1313
//! If you need other commands, feel free to open an issue or a pull request. :smile:
1414
//!
1515
//! # Example usage:
@@ -28,7 +28,7 @@
2828
//! ```sh
2929
//! STM32_CUBE_PROGRAMMER_DIR=`installation_dir` stm32cubeprogrammer-cli unprotect reset flash-hex `path_to_hex_file` protect
3030
//! ```
31-
//!
31+
//!
3232
//! Use the `--list` flag to list available probes.
3333
//! ```sh
3434
//! stm32cubeprogrammer-cli --stm32-cube-programmer-dir `installation_dir` --list

stm32cubeprogrammer-cli/src/parse.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ mod test {
165165

166166
#[test]
167167
fn parse_reset() {
168-
dotenvy::dotenv().expect("Failed to load .env file");
168+
std::env::set_var("STM32_CUBE_PROGRAMMER_DIR", "some/dir");
169169

170170
let value = options().run_inner(&["reset"]).unwrap();
171171
println!("{:?}", value);
@@ -198,8 +198,6 @@ mod test {
198198

199199
#[test]
200200
fn parse_multi() {
201-
dotenvy::dotenv().expect("Failed to load .env file");
202-
203201
let value = options()
204202
.run_inner(&[
205203
"--stm32-cube-programmer-dir",

0 commit comments

Comments
 (0)