Skip to content

Commit

Permalink
Add CI for slides
Browse files Browse the repository at this point in the history
  • Loading branch information
tdittr committed Aug 13, 2024
1 parent 46f62a3 commit 979aa89
Show file tree
Hide file tree
Showing 45 changed files with 221 additions and 38 deletions.
61 changes: 61 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
version: 2
updates:
- package-ecosystem: "cargo"
directories:
- "/exercises/1-course-introduction/1-introduction/1-setup-your-installation"
- "/exercises/1-course-introduction/1-introduction/2-embedded"
- "/exercises/2-foundations-of-rust/1-basic-syntax/1-basic-syntax"
- "/exercises/2-foundations-of-rust/2-ownership-and-references/1-move-semantics"
- "/exercises/2-foundations-of-rust/2-ownership-and-references/2-borrowing"
- "/exercises/2-foundations-of-rust/3-advanced-syntax/1-error-propagation"
- "/exercises/2-foundations-of-rust/3-advanced-syntax/2-error-handling"
- "/exercises/2-foundations-of-rust/3-advanced-syntax/3-slices"
- "/exercises/2-foundations-of-rust/3-advanced-syntax/4-ring-buffer"
- "/exercises/2-foundations-of-rust/3-advanced-syntax/5-boxed-data"
- "/exercises/2-foundations-of-rust/4-traits-and-generics/1-local-storage-vec"
- "/exercises/2-foundations-of-rust/5-closures-and-dynamic-dispatch/1-config-reader"
- "/exercises/3-crate-engineering/1-crate-engineering/1-my-serde-app"
- "/exercises/3-crate-engineering/1-crate-engineering/3-bsn"
- "/exercises/3-crate-engineering/1-crate-engineering/4-3d-printer"
- "/exercises/3-crate-engineering/1-crate-engineering/5-fizzbuzz"
- "/exercises/4-multitasking/2-parallel-multitasking/1-tf-idf"
- "/exercises/4-multitasking/2-parallel-multitasking/2-mutex"
- "/exercises/4-multitasking/3-asynchronous-multitasking/0-sync-to-async"
- "/exercises/4-multitasking/3-asynchronous-multitasking/1-async-channels"
- "/exercises/4-multitasking/3-asynchronous-multitasking/2-async-chat"
- "/exercises/4-multitasking/3-asynchronous-multitasking/3-measurement-data-sink"
- "/exercises/4-multitasking/3-asynchronous-multitasking/3-measurement-data-sink/node-simulator"
- "/exercises/6-rust-for-systems-programming/1-foreign-function-interface/1-crc-in-c"
- "/exercises/6-rust-for-systems-programming/1-foreign-function-interface/2-crc-in-rust"
- "/exercises/6-rust-for-systems-programming/1-foreign-function-interface/3-tweetnacl-bindgen"
- "/exercises/7-rust-for-data-science/1-rust-from-python/1-hello-world"
- "/exercises/7-rust-for-data-science/1-rust-from-python/2-strompy"
- "/exercises/8-embedded/1-embedded-ecosystem/1-lsm303agr-id"
- "/exercises/8-embedded/2-portable-drivers/1-lsm303agr-driver"
- "/exercises/8-embedded/3-async-on-embedded/1-compass"
- "/exercises/8-embedded/4-embassy-framework/1-embassy-project"
schedule:
interval: "weekly"
day: "thursday"
groups:
exercises-dependencies:
patterns:
- "*"
- package-ecosystem: "npm"
directory: "/slides/"
schedule:
interval: "weekly"
day: "thursday"
groups:
npm-dependencies:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "thursday"
groups:
ci-dependencies:
patterns:
- "*"
36 changes: 36 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: checks

permissions:
contents: read

on:
push:
branches:
- main
pull_request:
branches-ignore:
- 'release/**'
merge_group:
branches:
- main
workflow_call: {}

jobs:
check:
name: "Check everything still builds"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install mdbook
run: |
wget --no-verbose "https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz"
tar -xzf mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz
sudo mv mdbook /usr/bin/
- name: Run checks
run: ./check.sh
- name: Build book and slides
run: ./build-all.sh ${{github.event.repository.name}}
48 changes: 48 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
on:
push:
branches:
- main

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install mdbook
run: |
wget --no-verbose "https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz"
tar -xzf mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz
sudo mv mdbook /usr/bin/
- name: Build
run: ./build-all.sh ${{github.event.repository.name}}

- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifacts
uses: actions/upload-pages-artifact@v3
with:
path: public/
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*/**/target
target
.idea
public/
4 changes: 4 additions & 0 deletions book/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ multilingual = false

[build]
build-dir = "./target"

[output.html]
git-repository-url = "https://github.com/tweedegolf/rust-training/"
site-url = "/rust-training/"
2 changes: 1 addition & 1 deletion book/src/advanced-syntax.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 2.3 - Advanced Syntax

<a href="/slides/2_3/" target="_blank">Slides</a>
<a href="/rust-training/slides/2_3-advanced-syntax/" target="_blank">Slides</a>

## Exercise 2.3.1: Error propagation

Expand Down
2 changes: 1 addition & 1 deletion book/src/async-on-embedded.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 8.3 - Async on Embedded

<a href="/slides/8_3/" target="_blank">Slides</a>
<a href="/rust-training/slides/8_3-async-on-embedded/" target="_blank">Slides</a>

## Exercise 8.3.1: Compass
In this exercise, we'll use the [`lsm303agr`](https://docs.rs/lsm303agr) driver. Although the documentation doesn't show it, it supports async if you enable its `async` [feature](https://doc.rust-lang.org/cargo/reference/features.html)
Expand Down
2 changes: 1 addition & 1 deletion book/src/asynchronous-multitasking.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 4.3 - Asynchronous Multitasking

<a href="/slides/4_3/" target="_blank">Slides</a>
<a href="/rust-training/slides/4_3-asynchronous-multitasking/" target="_blank">Slides</a>

## Exercise 4.3.1: Async Channels

Expand Down
2 changes: 1 addition & 1 deletion book/src/basic-syntax.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 2.1 - Basic Syntax

<a href="/slides/2_1/" target="_blank">Slides</a>
<a href="/rust-training/slides/2_1-basic-syntax/" target="_blank">Slides</a>

## Exercise 2.1.1: Basic Syntax

Expand Down
2 changes: 1 addition & 1 deletion book/src/closures-and-dynamic-dispatch.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 2.5 - Closures and Dynamic dispatch

<a href="/slides/2_5/" target="_blank">Slides</a>
<a href="/rust-training/slides/2_5-closures-and-dynamic-dispatch/" target="_blank">Slides</a>

## Exercise 2.5.1: Config Reader

Expand Down
2 changes: 1 addition & 1 deletion book/src/crate-engineering.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 3.1 - Crate Engineering

<a href="/slides/3_1/" target="_blank">Slides</a>
<a href="/rust-training/slides/3_1-crate-engineering/" target="_blank">Slides</a>

## Exercise 3.1.1: My Serde App

Expand Down
2 changes: 1 addition & 1 deletion book/src/embassy-framework.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 8.4 - The Embassy Framework

<a href="/slides/8_4/" target="_blank">Slides</a>
<a href="/rust-training/slides/8_4-embassy-framework/" target="_blank">Slides</a>

## Exercise 8.4.1: Embassy project

Expand Down
2 changes: 1 addition & 1 deletion book/src/embedded-ecosystem.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 8.1 - The Rust embedded ecosystem

<a href="/slides/8_1/" target="_blank">Slides</a>
<a href="/rust-training/slides/8_1-embedded-ecosystem/" target="_blank">Slides</a>

## Exercise 8.1.1: LSM303AGR ID
Use our newly gained knowledge to get our first application running and read out the ID of the LSM303AGR accelerometer.
Expand Down
2 changes: 1 addition & 1 deletion book/src/foreign-function-interface.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 6.1 - Foreign Function Interface

<a href="/slides/6_1/" target="_blank">Slides</a>
<a href="/rust-training/slides/6_1-foreign-function-interface/" target="_blank">Slides</a>

## Exercise 6.1.1: CRC in C

Expand Down
2 changes: 1 addition & 1 deletion book/src/introduction-to-multitasking.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Unit 4.1 - Introduction to Multitasking

<a href="/slides/4_1/" target="_blank">Slides</a>
<a href="/rust-training/slides/4_1-introduction-to-multitasking/" target="_blank">Slides</a>

*There are no exercises for this unit*
2 changes: 1 addition & 1 deletion book/src/introduction.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 1.1 - Introduction

<a href="/slides/1_1/" target="_blank">Slides</a>
<a href="/rust-training/slides/1_1-introduction/" target="_blank">Slides</a>

## Exercise 1.1.1: Setup Your Installation

Expand Down
2 changes: 1 addition & 1 deletion book/src/ownership-and-references.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 2.2 - Ownership and References

<a href="/slides/2_2/" target="_blank">Slides</a>
<a href="/rust-training/slides/2_2-ownership-and-references/" target="_blank">Slides</a>

## Exercise 2.2.1: Move Semantics

Expand Down
2 changes: 1 addition & 1 deletion book/src/parallel-multitasking.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 4.2 - Parallel Multitasking

<a href="/slides/4_2/" target="_blank">Slides</a>
<a href="/rust-training/slides/4_2-parallel-multitasking/" target="_blank">Slides</a>

## Exercise 4.2.1: TF-IDF

Expand Down
2 changes: 1 addition & 1 deletion book/src/portable-drivers.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 8.2 - Portable Rust drivers

<a href="/slides/8_2/" target="_blank">Slides</a>
<a href="/rust-training/slides/8_2-portable-drivers/" target="_blank">Slides</a>

## Exercise 8.2.1: LSM303AGR Driver

Expand Down
2 changes: 1 addition & 1 deletion book/src/rust-for-web.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 5.1 - Rust for Web

<a href="/slides/5_1/" target="_blank">Slides</a>
<a href="/rust-training/slides/5_1-rust-for-web/" target="_blank">Slides</a>

## Exercise 5.1.1: Pastebin

Expand Down
2 changes: 1 addition & 1 deletion book/src/rust-from-python.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 7.1 - Rust from Python

<a href="/slides/7_1/" target="_blank">Slides</a>
<a href="/rust-training/slides/7_1-rust-from-python.md/" target="_blank">Slides</a>

## Exercise 7.1.1: Test your environment

Expand Down
2 changes: 1 addition & 1 deletion book/src/traits-and-generics.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit 2.4 - Traits and Generics

<a href="/slides/2_4/" target="_blank">Slides</a>
<a href="/rust-training/slides/2_4-traits-and-generics/" target="_blank">Slides</a>

## Exercise 2.4.1: Local Storage Vec

Expand Down
2 changes: 1 addition & 1 deletion book/src/wrap-up.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Wrap-up

<a href="/slides/Z/" target="_blank">Slides</a>
<a href="/rust-training/slides/Z-wrap-up/" target="_blank">Slides</a>

## Evaluation form

Expand Down
23 changes: 23 additions & 0 deletions build-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -eo pipefail

echo "TODO: use $1 as base"

rm -rf public/
mkdir -p public/

# build mdbook
pushd book
mdbook build
popd
mv book/target/* ./public/

# build slides
pushd slides
npm install
for f in *.md; do
npm run build -- --out "dist/${f%.md}" --base "/rust-training/slides/$f{%.md}/" "$f"
done
popd
mv slides/dist ./public/slides
10 changes: 10 additions & 0 deletions check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -eo pipefail

TARGETS=$(find exercises/ -name Cargo.toml | sort)

echo "Check all examples are covered by dependabot"
for target in $TARGETS; do
DIRNAME=$(dirname "$target")
grep -Fxq " - \"/$DIRNAME\"" .github/dependabot.yml || echo "Missing entry in dependabot.yml: $DIRNAME" 1>&2
done
1 change: 1 addition & 0 deletions slides/1_1-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ fonts:
drawings:
persist: false
layout: cover
routerMode: hash
---


Expand Down
1 change: 1 addition & 0 deletions slides/2_1-basic-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fonts:
mono: Fira Mono
layout: cover
title: "Rust - 2.1: Basic Syntax"
routerMode: hash
---

# Rust programming
Expand Down
1 change: 1 addition & 0 deletions slides/2_2-ownership-and-references.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fonts:
mono: Fira Mono
layout: cover
title: "Rust - 2.2: Ownership and References"
routerMode: hash
---

# Rust programming
Expand Down
1 change: 1 addition & 0 deletions slides/2_3-advanced-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fonts:
mono: Fira Mono
layout: cover
title: "Rust - 2.3: Advanced Syntax"
routerMode: hash
---

# Rust programming
Expand Down
1 change: 1 addition & 0 deletions slides/2_4-traits-and-generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fonts:
mono: Fira Mono
layout: cover
title: "Rust - 2.4: Traits and Generics"
routerMode: hash
---

# Rust programming
Expand Down
1 change: 1 addition & 0 deletions slides/2_5-closures-and-dynamic-dispatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fonts:
mono: Fira Mono
layout: cover
title: "Rust - 2.5: Closures and Dynamic dispatch"
routerMode: hash
---

# Rust programming
Expand Down
1 change: 1 addition & 0 deletions slides/3_1-crate-engineering.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fonts:
mono: Fira Mono
layout: cover
title: "Rust - 3.1: Crate Engineering"
routerMode: hash
---

# Rust programming
Expand Down
Loading

0 comments on commit 979aa89

Please sign in to comment.