Skip to content

Commit a33b9fc

Browse files
authored
CI (#92)
* Ci2 (#6) * Add g491 and 4a1 to ci, check examples, check with different feature sets * Add todo * Remove unused feature embedded-can-03 * Remove feature unstable-defmt from ci * Add clippy to ci * Fix warning * g91 and 4a1 support does not seem quite ready yet * Fix CI errors for flash example * Deny warnings * Fix more warnings * Fix warnings about empty loops * Fix more warnings related to itm or semihosting * Make itm use log::info as println to avoid logger arg * CI - Always enable some way to print
1 parent 2ff74f8 commit a33b9fc

File tree

15 files changed

+84
-21
lines changed

15 files changed

+84
-21
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,32 @@ on:
33

44
name: Continuous integration
55

6+
# Make sure CI fails on all warnings, including Clippy lints
7+
env:
8+
RUSTFLAGS: "-Dwarnings"
9+
610
jobs:
711
ci:
812
runs-on: ubuntu-latest
913
strategy:
1014
matrix:
1115
rust:
1216
- stable
13-
feature:
17+
device:
1418
- stm32g431
1519
- stm32g441
1620
- stm32g471
1721
- stm32g473
1822
- stm32g474
1923
- stm32g483
2024
- stm32g484
25+
#- stm32g491 # Does not seem ready yet
26+
#- stm32g4a1 # Does not seem ready yet
27+
features:
28+
- log-rtt,defmt
29+
# TODO: -log-rtt # log-rtt without defmt, more combos?
30+
- log-itm
31+
- log-semihost
2132

2233
steps:
2334
- uses: actions/checkout@v2
@@ -29,4 +40,8 @@ jobs:
2940
override: true
3041

3142
- name: Regular build
32-
run: cargo check --features ${{ matrix.feature }}
43+
run: cargo check --features ${{ matrix.device }} --features ${{ matrix.features }}
44+
- name: Build examples
45+
run: cargo check --examples --features ${{ matrix.device }} --features ${{ matrix.features }}
46+
- name: Clippy
47+
run: cargo clippy --examples --features ${{ matrix.device }} --features ${{ matrix.features }}

.github/workflows/clippy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- uses: actions-rs/clippy-check@v1
2020
with:
2121
token: ${{ secrets.GITHUB_TOKEN }}
22-
args: --features=stm32g431 --target thumbv7em-none-eabihf
22+
args: --features=stm32g484,log-rtt,defmt --target thumbv7em-none-eabihf

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,4 @@ lto = true
104104

105105
[[example]]
106106
name = "flash_with_rtic"
107-
required-features = ["stm32g474"]
107+
required-features = ["stm32g474"]

examples/button.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ fn EXTI15_10() {
5050

5151
#[entry]
5252
fn main() -> ! {
53+
utils::logger::init();
54+
5355
let mut dp = stm32::Peripherals::take().expect("cannot take peripherals");
5456
let mut rcc = dp.RCC.constrain();
5557
let mut syscfg = dp.SYSCFG.constrain();

examples/comp.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use rt::entry;
1616
#[cfg(not(feature = "stm32g474"))]
1717
#[entry]
1818
fn main() -> ! {
19+
#[allow(clippy::empty_loop)]
1920
loop {} // TODO: add support for more devices
2021
}
2122

examples/comp_w_dac.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use rt::entry;
1111
#[cfg(not(feature = "stm32g474"))]
1212
#[entry]
1313
fn main() -> ! {
14+
#[allow(clippy::empty_loop)]
1415
loop {} // TODO: add support for more devices
1516
}
1617

examples/flash_with_rtic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ mod app {
3838

3939
#[init]
4040
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
41+
crate::utils::logger::init();
42+
4143
let dp = cx.device;
4244
let cp = cx.core;
4345

examples/hello.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ use utils::logger::println;
1616

1717
#[entry]
1818
fn main() -> ! {
19+
utils::logger::init();
20+
1921
println!("Hello, STM32G4!");
2022

2123
#[allow(clippy::empty_loop)]

examples/independent_watchdog.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use utils::logger::info;
1212

1313
#[entry]
1414
fn main() -> ! {
15-
//utils::logger::init();
15+
utils::logger::init();
1616
let dp = Peripherals::take().unwrap();
1717

1818
let mut watchdog = IndependentWatchdog::new(dp.IWDG);

examples/panic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ pub fn exit() -> ! {
2222

2323
#[cortex_m_rt::entry]
2424
fn main() -> ! {
25+
utils::logger::init();
26+
2527
logger::info!("main");
2628

2729
panic!("Something bad");

0 commit comments

Comments
 (0)