Skip to content

Commit c130e0f

Browse files
committed
Try to reduce the pretty drastic amount of CI checks we're currently running
1 parent 45bdeb4 commit c130e0f

File tree

3 files changed

+51
-9
lines changed

3 files changed

+51
-9
lines changed

.github/workflows/build.yml

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
run: |
9191
cargo build --release --target=${{ matrix.target }} --features ${{ matrix.features }}
9292
93-
build-ptp:
93+
build-no-ptp:
9494
name: build-no-ptp
9595
runs-on: ubuntu-20.04
9696
strategy:
@@ -117,7 +117,8 @@ jobs:
117117
run: |
118118
cargo build --release --target=${{ matrix.target }} --features ${{ matrix.features }} --no-default-features
119119
120-
# Examples
120+
# Test that all of the examples compile
121+
# for stm32f429
121122
examples:
122123
name: examples
123124
runs-on: ubuntu-20.04
@@ -138,21 +139,44 @@ jobs:
138139
features: ptp
139140
- example: timesync-client
140141
features: ptp
142+
toolchain:
143+
- stable
144+
target:
145+
- thumbv7em-none-eabi
146+
steps:
147+
- name: Checkout
148+
uses: actions/checkout@v3
149+
150+
- name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }})
151+
run: |
152+
rustup set profile minimal
153+
rustup override set ${{ matrix.toolchain }}
154+
rustup target add ${{ matrix.target }}
155+
156+
- name: Build example ${{ matrix.example.example }} for stm32f429
157+
run: |
158+
cargo build --release --target=${{ matrix.target }} --example ${{ matrix.example.example }} --features stm32f429,${{ matrix.example.features }}
159+
160+
# Test that all the code shared with other MCU families also compiles
161+
examples-common:
162+
name: examples-common
163+
runs-on: ubuntu-20.04
164+
strategy:
165+
matrix:
166+
toolchain:
167+
- stable
168+
target:
169+
- thumbv7em-none-eabi
141170
mcu:
142171
- stm32f107
143172
- stm32f429
144173
- stm32f745
145-
toolchain:
146-
- stable
147-
target:
148-
- thumbv7m-none-eabi
149174
pins:
150175
- nucleo
151176
- default
152177
pps:
153178
- default
154179
- alternate
155-
156180
steps:
157181
- name: Checkout
158182
uses: actions/checkout@v3
@@ -163,9 +187,9 @@ jobs:
163187
rustup override set ${{ matrix.toolchain }}
164188
rustup target add ${{ matrix.target }}
165189
166-
- name: Build example ${{ matrix.example.example }} for ${{ matrix.mcu }}, eth pins ${{ matrix.pins }}, pps pin ${{ matrix.pps }}
190+
- name: Build examples common file for ${{ matrix.mcu }}, eth pins ${{ matrix.pins }}, pps pin ${{ matrix.pps }}
167191
run: |
168-
STM32_ETH_EXAMPLE_PPS=${{ matrix.pps }} STM32_ETH_EXAMPLE_PINS=${{ matrix.pins }} cargo build --release --target=${{ matrix.target }} --example ${{ matrix.example.example}} --features ${{ matrix.mcu }},${{ matrix.example.features }}
192+
STM32_ETH_EXAMPLE_PPS_PIN=${{ matrix.pps}} STM32_ETH_EXAMPLE_PINS=${{ matrix.pins }} cargo check --release --target=${{ matrix.target }} --example common --features ${{ matrix.mcu }},defmt,smoltcp-phy,ptp
169193
170194
# Refs: https://github.com/rust-lang/crater/blob/9ab6f9697c901c4a44025cf0a39b73ad5b37d198/.github/workflows/bors.yml#L125-L149
171195
#
@@ -179,6 +203,8 @@ jobs:
179203
- build
180204
- test
181205
- examples
206+
- examples-common
207+
- build-no-ptp
182208
runs-on: ubuntu-20.04
183209
steps:
184210
- name: Mark the job as a success

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ panic-probe = { version = "0.3", features = [ "print-defmt" ] }
7474
systick-monotonic = "1.0"
7575
smoltcp = { version = "0.9", features = [ "medium-ethernet", "proto-ipv4", "socket-udp", "socket-tcp", "defmt" ], default-features = false }
7676

77+
# This isn't an actual example. It just exists so we can easily
78+
# test the common items :)
79+
[[example]]
80+
name = "common"
81+
required-features = ["defmt", "smoltcp-phy", "ptp"]
82+
7783
[[example]]
7884
name = "pktgen"
7985
required-features = [ "defmt" ]

examples/common.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#![allow(unused_attributes)]
2+
#![no_std]
23

34
//! Common features used in examples.
45
//!
56
//! Note that this module isn't an example by itself.
67
8+
use defmt_rtt as _;
9+
use panic_probe as _;
10+
711
use stm32_eth::{
812
hal::{gpio::GpioExt, rcc::Clocks},
913
PartsIn,
@@ -14,6 +18,12 @@ pub use pins::{setup_pins, Gpio};
1418
use fugit::RateExtU32;
1519
use stm32_eth::hal::rcc::RccExt;
1620

21+
// This is here so that we can build the `common.rs` example individually for
22+
// each supported MCU family. That way we can be reasonably sure that all examples
23+
// compile, without having to compile all of them each time.
24+
#[allow(unused)]
25+
fn main() {}
26+
1727
/// Setup the clocks and return clocks and a GPIO struct that
1828
/// can be used to set up all of the pins.
1929
///

0 commit comments

Comments
 (0)