-
Notifications
You must be signed in to change notification settings - Fork 518
166 lines (153 loc) · 5.18 KB
/
ci.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: CI
on:
push: # Run CI for all branches except GitHub merge queue tmp branches
branches-ignore:
- "gh-readonly-queue/**"
pull_request: # Run CI for PRs on any branch
merge_group: # Run CI for the GitHub merge queue
jobs:
# Check build succeeds for each f3discovery chapter containing example code.
build-f3discovery-chapter:
runs-on: ubuntu-20.04
strategy:
matrix:
chapter:
- 05-led-roulette
- 06-hello-world
- 07-registers
- 08-leds-again
- 09-clocks-and-timers
- 11-usart
- 14-i2c
- 15-led-compass
- 16-punch-o-meter
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: thumbv7em-none-eabihf
- name: Build chapter
working-directory: f3discovery/src/${{ matrix.chapter }}
run: cargo build --target thumbv7em-none-eabihf
- name: Build chapter examples
working-directory: f3discovery/src/${{ matrix.chapter }}
run: cargo build --target thumbv7em-none-eabihf --examples
# Check build succeeds for f3discovery docs.
build-f3discovery-doc:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: thumbv7em-none-eabihf
- name: Build docs
run: cargo doc --target thumbv7em-none-eabihf
working-directory: f3discovery
# Check a build succeeds for each microbit chapter that contains example code.
build-microbit-chapter:
runs-on: ubuntu-20.04
strategy:
matrix:
chapter:
- 05-led-roulette
- 07-uart
- 08-i2c
- 09-led-compass
- 10-punch-o-meter
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: thumbv6m-none-eabi
- run: rustup target add thumbv7em-none-eabihf
- name: Build chapter micro:bit v1
working-directory: microbit/src/${{ matrix.chapter }}
run: cargo build --features v1 --target thumbv6m-none-eabi
- name: Build chapter micro:bit v2
working-directory: microbit/src/${{ matrix.chapter }}
run: cargo build --features v2 --target thumbv7em-none-eabihf
# Check build succeeds for microbit docs.
build-microbit-doc:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: thumbv6m-none-eabi
- run: rustup target add thumbv7em-none-eabihf
- name: Build docs for micro:bit v1
run: cargo doc --features v1 --target thumbv6m-none-eabi
working-directory: microbit
- name: Build docs for micro:bit v2
run: cargo doc --features v2 --target thumbv7em-none-eabihf
working-directory: microbit
# Build the book HTML itself and optionally publish it.
build-book:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: thumbv7em-none-eabihf
- run: rustup target add thumbv6m-none-eabi
- name: Install Python dependencies
run: |
pip3 install --user python-dateutil linkchecker
- name: Put pip binary directory into path
run: echo "~/.local/bin" >> $GITHUB_PATH
- name: Cache Cargo installed binaries
uses: actions/cache@v1
id: cache-cargo
with:
path: ~/cargo-bin
key: cache-cargo
- name: Install mdbook
if: steps.cache-cargo.outputs.cache-hit != 'true'
uses: actions-rs/install@v0.1
with:
crate: mdbook
version: latest
- name: Copy mdbook to cache directory
if: steps.cache-cargo.outputs.cache-hit != 'true'
run: |
mkdir ~/cargo-bin
cp ~/.cargo/bin/mdbook ~/cargo-bin
- name: Put new cargo binary directory into path
run: echo "~/cargo-bin" >> $GITHUB_PATH
- name: Build f3discovery book
working-directory: f3discovery
run: mkdir target && mdbook build
- name: Check microbit links
working-directory: f3discovery
run: linkchecker --ignore-url "print.html" book
- name: Build microbit book
working-directory: microbit
run: mkdir target && mdbook build
- name: Check microbit links
working-directory: microbit
run: linkchecker --ignore-url "print.html" book
- name: Build front page
run: mdbook build
- name: Check links
run: linkchecker book
- name: Collect books
run: |
mv f3discovery/book book/f3discovery
mv microbit/book book/microbit
- name: Deploy book
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: book
force_orphan: true