-
Notifications
You must be signed in to change notification settings - Fork 12
128 lines (104 loc) · 3.68 KB
/
main.yml
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
merge_group:
jobs:
build:
runs-on: ubuntu-latest
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
strategy:
fail-fast: false
matrix:
partition: [ "1/10", "2/10", "3/10", "4/10", "5/10", "6/10", "7/10", "8/10", "9/10", "10/10" ]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Get git tree hash
id: get-tree-hash
run: |
git rev-parse HEAD^{tree} > .tree-hash
echo "hash=$(cat .tree-hash)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: result-cache
with:
path: .tree-hash
key: success-${{ steps.get-tree-hash.outputs.hash }}-${{ matrix.partition }}
- name: Run sccache-cache
if: steps.result-cache.outputs.cache-hit != 'true'
uses: mozilla-actions/sccache-action@v0.0.4
- name: Install toolchain
if: steps.result-cache.outputs.cache-hit != 'true'
uses: dtolnay/rust-toolchain@nightly
with:
targets: thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi
- name: rust cache
if: steps.result-cache.outputs.cache-hit != 'true'
uses: Swatinem/rust-cache@v2
with:
key: "${{ matrix.partition }}"
- uses: taiki-e/install-action@v2
if: steps.result-cache.outputs.cache-hit != 'true'
with:
tool: cargo-binstall
- name: "installing prerequisites"
if: steps.result-cache.outputs.cache-hit != 'true'
run: |
git config --global init.defaultBranch main
git config --global user.email "ci@riot-labs.de"
git config --global user.name "CI"
cargo binstall --no-confirm --no-symlinks --force --no-discover-github-token laze
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
sudo apt-get install ninja-build
- name: "riot-rs compilation test"
if: steps.result-cache.outputs.cache-hit != 'true'
run: |
sccache --start-server || true # work around https://github.com/ninja-build/ninja/issues/2052
laze build --partition hash:${{ matrix.partition }} --builders microbit-v2,nrf52840dk,rpi-pico,rpi-pico-w -g
lint:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rustfmt
- name: rust cache
uses: Swatinem/rust-cache@v2
# TODO: we'll eventually want to check the whole workspace with --workspace
# TODO: we'll eventually want to check relevant feature combinations
# TODO: we may want to use --no-deps as well
- name: clippy
uses: clechasseur/rs-clippy-check@v3
with:
args: --verbose --locked -p riot-rs-embassy
# TODO: we'll eventually want to generate docs for riot-rs instead
# TODO: we'll eventually want to enable relevant features
- name: "rustdoc"
run: cargo rustdoc -p riot-rs-embassy -- -D warnings
- name: rustfmt
run: cargo fmt --check --all
- name: Install rust-sort
run: cargo install --git=https://github.com/DevinR528/cargo-sort --rev 55ec89082466f6bb246d870a8d56d166a8e1f08b cargo-sort
- name: Check formatting and item order of Cargo.toml files
run: cargo sort --check --check-format --grouped --workspace
CI-success:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Final Results
needs: [build]
steps:
- run: |
result="${{ needs.build.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
exit 1
fi