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
name: Examples build
permissions:
contents: read
on:
schedule:
- cron: "0 0 * * 0"
push:
pull_request:
jobs:
check_format_build:
name: Examples - ${{ matrix.platform }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- platform: rp2040
target: thumbv6m-none-eabi
needs_flip_link: true
- platform: rp235x
target: thumbv8m.main-none-eabihf
needs_flip_link: false
steps:
#Checkout source
- name: Checkout sources
uses: actions/checkout@v7
#Cache cargo dependencies
- name: Cache cargo dependencies
uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
examples/${{ matrix.platform }}/target/
key: ${{ matrix.platform }}-${{ runner.os }}-cargo-${{ hashFiles('examples/${{ matrix.platform }}/Cargo.lock') }}
restore-keys: |
${{ matrix.platform }}-${{ runner.os }}-cargo-
#Cache flip-link binary
- name: Cache flip-link
if: matrix.needs_flip_link
id: cache-flip-link
uses: actions/cache@v5
with:
path: ~/.cargo/bin/flip-link
key: ${{ runner.os }}-flip-link
#toolchain and tools
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{ matrix.target }}
components: rustfmt, clippy
- name: Install flip-link linker
if: matrix.needs_flip_link && steps.cache-flip-link.outputs.cache-hit != 'true'
run: cargo install flip-link
#build and lint
- name: Run cargo check
working-directory: ./examples/${{ matrix.platform }}/
run: cargo check
- name: Run cargo fmt
working-directory: ./examples/${{ matrix.platform }}/
run: cargo fmt --all -- --check
- name: Run cargo clippy
working-directory: ./examples/${{ matrix.platform }}/
run: cargo clippy -- -D warnings
- name: Run cargo build
working-directory: ./examples/${{ matrix.platform }}/
run: cargo build