Skip to content

Commit

Permalink
ci: update CI tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
astapleton committed Jun 6, 2024
1 parent f15ae73 commit 396dacc
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 97 deletions.
29 changes: 10 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [ staging, trying, master ]
branches: [ master ]
pull_request:

name: Continuous integration
Expand All @@ -22,31 +22,22 @@ jobs:
FLAGS: rt

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Cache cargo registry and index
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo build
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-target-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}-memory-${{ hashFiles('**/*.x') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: thumbv8m.main-none-eabihf
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --release --examples --target thumbv8m.main-none-eabihf --features ${{ matrix.mcu }},${{ env.FLAGS }}
- uses: actions-rs/cargo@v1
with:
command: test
args: --lib --target x86_64-unknown-linux-gnu --features ${{ matrix.mcu }},${{ env.FLAGS }}
- name: Install thumbv8m rust target
run: rustup target add thumbv8m.main-none-eabihf
- name: Build
run: cargo build --verbose --release --examples --target thumbv8m.main-none-eabihf --features ${{ matrix.mcu }},${{ env.FLAGS }}
- name: Test
run: cargo test --lib --target x86_64-unknown-linux-gnu --features ${{ matrix.mcu }},${{ env.FLAGS }}
18 changes: 6 additions & 12 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
on:
pull_request:
push:
branches: [staging, trying, master]
branches: [master]

name: Clippy

jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
components: clippy
toolchain: 1.69.0
target: thumbv8m.main-none-eabihf
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --examples --target thumbv8m.main-none-eabihf --features=rt,stm32h503 -- -D warnings
- uses: actions/checkout@v4
- name: Install thumb8 rust target
run: rustup target add thumbv8m.main-none-eabihf
- name: Cargo clippy
run: cargo clippy --examples --target thumbv8m.main-none-eabihf --features=rt,stm32h503 -- -D warnings
32 changes: 11 additions & 21 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ jobs:
matrix:
mcu:
- stm32h503
- stm32h562
- stm32h563
- stm32h573
logging: # Example logging options
- log-itm
- log-semihost
Expand All @@ -25,31 +22,24 @@ jobs:
FLAGS: rt

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Cache cargo registry and index
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo build
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-target-nightly-${{ hashFiles('**/Cargo.toml') }}-memory-${{ hashFiles('**/*.x') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: thumbv8m.main-none-eabihf
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --release --examples --target thumbv8m.main-none-eabihf --features ${{ matrix.mcu }},${{ env.FLAGS }},${{ matrix.logging }}
- uses: actions-rs/cargo@v1
with:
command: test
args: --lib --target x86_64-unknown-linux-gnu --features ${{ matrix.mcu }},${{ env.FLAGS }}
- name: Install nightly toolchain
run: rustup toolchain install nightly
- name: Install thumbv8m rust target
run: rustup +nightly target add thumbv8m.main-none-eabihf
- name: Build
run: cargo +nightly build --verbose --release --examples --target thumbv8m.main-none-eabihf --features ${{ matrix.mcu }},${{ env.FLAGS }},${{ matrix.logging }}
- name: Test
run: cargo +nightly test --lib --target x86_64-unknown-linux-gnu --features ${{ matrix.mcu }},${{ env.FLAGS }}
18 changes: 5 additions & 13 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
on:
push:
branches: [ staging, trying, master ]
branches: [ master ]
pull_request:

name: Code formatting check
name: rustfmt

jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt --all -- --check
6 changes: 3 additions & 3 deletions .github/workflows/version-match.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [ staging, trying, master ]
branches: [ master ]
pull_request:

name: Verify rustc versions match
Expand All @@ -10,6 +10,6 @@ jobs:
name: Rustc version match
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: node tools/verify-rust-version.js
13 changes: 6 additions & 7 deletions examples/blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,22 @@ use stm32h5xx_hal::pac;
fn main() -> ! {
utilities::logger::init();

let cp = cortex_m::Peripherals::take().unwrap();
let dp = pac::Peripherals::take().unwrap();

// TODO: Power/clock config is required before blinky can... blink.

dp.GPIOA.moder.write(|w| w.mode5().variant(1)); // output
dp.GPIOA.pupdr.write(|w| w.pupd5().variant(1)); // pull-up
dp.GPIOA.moder().write(|w| w.mode5().output()); // output
dp.GPIOA.pupdr().write(|w| w.pupd5().pull_up()); // pull-up

// dp.GPIOA.odr.write(|w| w.od5().set_bit());

loop {
dp.GPIOA.odr.write(|w| w.od5().clear_bit());
for _ in 0..1_000_0 {
dp.GPIOA.odr().write(|w| w.od5().low());
for _ in 0..10_000 {
cortex_m::asm::nop();
}
dp.GPIOA.odr.write(|w| w.od5().set_bit());
for _ in 0..1_000_0 {
dp.GPIOA.odr().write(|w| w.od5().high());
for _ in 0..10_000 {
cortex_m::asm::nop();
}
}
Expand Down
2 changes: 0 additions & 2 deletions examples/utilities/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//! Utilities for examples
pub mod logger;
#[macro_use]
mod power;
15 changes: 0 additions & 15 deletions examples/utilities/power.rs

This file was deleted.

12 changes: 7 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ compile_error!("Cannot not select both rm0492 and rm0481");
#[cfg(feature = "stm32h503")]
pub use stm32h5::stm32h503 as stm32;

#[cfg(any(
feature = "stm32h562",
feature = "stm32h563",
feature = "stm32h573",
))]
#[cfg(feature = "stm32h562")]
pub use stm32h5::stm32h562 as stm32;

#[cfg(feature = "stm32h563")]
pub use stm32h5::stm32h563 as stm32;

#[cfg(feature = "stm32h573")]
pub use stm32h5::stm32h573 as stm32;

#[cfg(feature = "device-selected")]
Expand Down

0 comments on commit 396dacc

Please sign in to comment.