Skip to content

docs(book): explain concepts required for building a RIOT-rs application #1765

docs(book): explain concepts required for building a RIOT-rs application

docs(book): explain concepts required for building a RIOT-rs application #1765

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
merge_group:
schedule:
# run every morning at 3:17am
- cron: '17 3 * * *'
jobs:
build:
runs-on: ubuntu-latest
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
strategy:
fail-fast: false
matrix:
partition: [ "1/20", "2/20", "3/20", "4/20", "5/20", "6/20", "7/20", "8/20", "9/20", "10/20", "11/20", "12/20", "13/20", "14/20", "15/20", "16/20", "17/20", "18/20", "19/20", "20/20" ]
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/[email protected]
- id: get_toolchain
run: echo "toolchain=$(cat rust-toolchain)" >> $GITHUB_OUTPUT
- name: Install toolchain
if: steps.result-cache.outputs.cache-hit != 'true'
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.get_toolchain.outputs.toolchain }}
targets: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf,thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi,thumbv8m.main-none-eabi
# rust-src: Used for -Zbuild-std.
# rustfmt: Used by bindgen for liboscore
components: rust-src, rustfmt
- 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 "[email protected]"
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 gcc-arm-none-eabi
- name: "limit build unless nightly build"
if: github.event_name != 'schedule'
run: |
echo "LAZE_BUILDERS=ai-c3,espressif-esp32-c6-devkitc-1,microbit-v2,nrf52840dk,nrf5340dk,rpi-pico,rpi-pico-w,st-nucleo-h755zi-q,st-nucleo-wb55" >> "$GITHUB_ENV"
- 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
CONFIG_WIFI_NETWORK='test' CONFIG_WIFI_PASSWORD='password' laze build --global --partition hash:${{ matrix.partition }}
cargo-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- id: get_toolchain
run: echo "toolchain=$(cat rust-toolchain)" >> $GITHUB_OUTPUT
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.get_toolchain.outputs.toolchain }}
# TODO: we'll eventually want to test the whole workspace with --workspace
# TODO: we'll eventually want to enable relevant features
- name: Run crate tests
run: |
cargo test --no-default-features --features no-boards -p riot-rs -p riot-rs-embassy -p riot-rs-runqueue -p riot-rs-threads -p riot-rs-macros
cargo test -p rbi -p ringbuffer -p coapcore
lint:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- id: get_toolchain
run: echo "toolchain=$(cat rust-toolchain)" >> $GITHUB_OUTPUT
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.get_toolchain.outputs.toolchain }}
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 --features no-boards -p riot-rs -p riot-rs-boards -p riot-rs-chips -p riot-rs-debug -p riot-rs-embassy -p riot-rs-macros -p riot-rs-random -p riot-rs-rt -p riot-rs-threads -p riot-rs-utils
- name: rustdoc
run: RUSTDOCFLAGS='-D warnings' cargo doc -p riot-rs --features no-boards,bench,external-interrupts,threading,random,csprng,hwrng
- name: rustfmt
run: cargo fmt --check --all
- uses: taiki-e/install-action@v2
with:
tool: cargo-binstall
- name: Install taplo
run: cargo binstall --no-confirm --no-symlinks --no-discover-github-token --force taplo-cli
- name: Check toml formatting
run: taplo fmt --check
# TODO: cargo-sort is disabled for now, as it won't stop formatting / failing perfectly sorted Cargo.toml files.
# - name: Install cargo-sort
# run: cargo install --git=https://github.com/DevinR528/cargo-sort --rev 55ec89082466f6bb246d870a8d56d166a8e1f08b cargo-sort
# - name: Check item order of Cargo.toml files
# run: cargo sort --check --grouped --workspace --no-format
- name: Ruff
uses: chartboost/ruff-action@v1
with:
args: format --check # Only check formatting for now
- name: typos
uses: crate-ci/[email protected]
- name: Check that the HTML support matrix is up to date
run: ./doc/gen_support_matrix_html.rs check doc/support_matrix.yml book/src/support_matrix.html
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
- name: Report nightly failure
if: failure() && github.event_name == 'schedule' && github.repository == 'future-proof-iot/RIOT-rs'
uses: s3krit/[email protected]
with:
room_id: ${{ secrets.MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: "The nightly build [failed](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})."
server: "matrix.org"