Merge pull request #21 from okhsunrog/main #86
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
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
name: CI | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
target: thumbv7m-none-eabi | |
- name: Run cargo format in check mode | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
- name: Cache artifacts | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo build | |
uses: actions-rs/cargo@v1 | |
env: | |
RUSTFLAGS: -D warnings | |
with: | |
command: build | |
args: --release | |
docs: | |
name: Docs | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
packages: read | |
needs: | |
- build | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
target: thumbv7m-none-eabi | |
- name: Cache artifacts | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo doc | |
uses: actions-rs/cargo@v1 | |
with: | |
command: doc | |
# https://github.com/actions/upload-pages-artifact#file-permissions | |
- run: chmod -c -R +rX ./target/thumbv7m-none-eabi/doc | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./target/thumbv7m-none-eabi/doc | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |