cleaned up front matter #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 a build succeeds for each book chapter that contains example code. | |
build-book-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: thumbv7em-none-eabihf | |
- name: Build chapter micro:bit v2 | |
working-directory: mdbook/src/${{ matrix.chapter }} | |
run: cargo build --features v2 --target thumbv7em-none-eabihf --target-dir ../target | |
# 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: thumbv7em-none-eabihf | |
- name: Build docs for micro:bit v2 | |
run: cargo doc --features v2 --target thumbv7em-none-eabihf --target-dir ../target | |
working-directory: mdbook | |
# 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 | |
- 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 book | |
working-directory: mdbook | |
run: mdbook build | |
- name: Check book links | |
working-directory: mdbook | |
run: linkchecker --ignore-url "print.html" book | |
- name: Check links | |
run: linkchecker book | |
- name: Collect books | |
run: | | |
mv mdbook/book book | |
- 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 |