Skip to content

build: use the inherited edition value (#580) #40

build: use the inherited edition value (#580)

build: use the inherited edition value (#580) #40

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
merge_group:
concurrency:
group: ${{ github.head_ref || github.run_id }}-main
cancel-in-progress: true
jobs:
cargo-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- id: get_toolchain
run: echo "toolchain=$(scripts/rust-toolchain.sh)" >> $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: |
RUSTFLAGS='-D warnings' cargo test \
--no-default-features \
--features "
external-interrupts,
i2c,
no-boards,
spi,
" \
-p ariel-os \
-p ariel-os-embassy \
-p ariel-os-embassy-common \
-p ariel-os-identity \
-p ariel-os-macros \
-p ariel-os-runqueue \
-p ariel-os-threads \
cargo test \
-p coapcore \
-p rbi \
-p ringbuffer \
# We need to set `RUSTDOCFLAGS` as well in the following jobs, because it
# is used for doc tests.
- name: cargo test for RP
run: |
RUSTDOCFLAGS='--cfg context="rp2040"' RUSTFLAGS='-D warnings --cfg context="rp2040"' cargo test \
--features "
embassy-rp/rp2040,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-rp
- name: cargo test for nRF
run: |
RUSTDOCFLAGS='--cfg context="nrf52840"' RUSTFLAGS='-D warnings --cfg context="nrf52840"' cargo test \
--features "
embassy-nrf/nrf52840,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-nrf
- name: cargo test for STM32
run: |
RUSTDOCFLAGS='--cfg context="stm32wb55rgvx"' RUSTFLAGS='-D warnings --cfg context="stm32wb55rgvx"' cargo test \
--features "
embassy-stm32/stm32wb55rg,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-stm32
lint:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
# "Obfuscate" the search query with concatenation so it does not self-trigger.
- name: Check for leftover occurrences of the old project name
run: set +e; grep -ri "riot"".rs" --line-number --exclude-dir=.git; test $? -eq 1
- id: get_toolchain
run: echo "toolchain=$(scripts/rust-toolchain.sh)" >> $GITHUB_OUTPUT
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.get_toolchain.outputs.toolchain }}
# Required for checking ariel-os-esp
targets: riscv32imac-unknown-none-elf
components: clippy, rustfmt
- name: rust cache
uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: cargo-binstall
# Should run as soon as possible to avoid using unwanted crates
# `--force`ing is required as the installed binary could have been
# restored from cache.
- name: cargo-deny
run: |
cargo binstall --no-confirm --no-discover-github-token --force cargo-deny
cargo deny check bans licenses sources
# Must run after the cargo-deny job as it requires the downloaded
# cargo-deny binary.
- name: cargo-deny advisories
run: cargo deny check advisories
# Prevent sudden announcement of a new advisory from failing CI
continue-on-error: true
# 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 "
csprng,
external-interrupts,
hwrng,
i2c,
net,
no-boards,
spi,
storage,
usb,
usb-ethernet,
"
-p ariel-os
-p ariel-os-boards
-p ariel-os-chips
-p ariel-os-coap
-p ariel-os-debug
-p ariel-os-embassy
-p ariel-os-embassy-common
-p ariel-os-hal
-p ariel-os-identity
-p ariel-os-macros
-p ariel-os-random
-p ariel-os-rt
-p ariel-os-storage
-p ariel-os-threads
-p ariel-os-utils
--
--deny warnings
- run: echo 'RUSTFLAGS=--cfg context="esp32c6"' >> $GITHUB_ENV
- name: clippy for ESP32
uses: clechasseur/rs-clippy-check@v3
with:
args: |
--verbose
--locked
--target=riscv32imac-unknown-none-elf
--features "
esp-hal-embassy/esp32c6,
esp-hal/esp32c6,
external-interrupts,
i2c,
spi,
"
-p ariel-os-esp
--
--deny warnings
- run: echo 'RUSTFLAGS=--cfg context="rp2040"' >> $GITHUB_ENV
- name: clippy for RP
uses: clechasseur/rs-clippy-check@v3
with:
args: |
--verbose
--locked
--features "
embassy-rp/rp2040,
external-interrupts,
i2c,
spi,
"
-p ariel-os-rp
--
--deny warnings
- run: echo 'RUSTFLAGS=--cfg context="nrf52840"' >> $GITHUB_ENV
- name: clippy for nRF
uses: clechasseur/rs-clippy-check@v3
with:
args: |
--verbose
--locked
--features "
embassy-nrf/nrf52840,
external-interrupts,
i2c,
spi,
"
-p ariel-os-nrf
--
--deny warnings
- run: echo 'RUSTFLAGS=--cfg context="stm32wb55rgvx"' >> $GITHUB_ENV
- name: clippy for STM32
uses: clechasseur/rs-clippy-check@v3
with:
args: |
--verbose
--locked
--features "
embassy-stm32/stm32wb55rg,
external-interrupts,
i2c,
spi,
"
-p ariel-os-stm32
--
--deny warnings
# Reset `RUSTFLAGS`
- run: echo 'RUSTFLAGS=' >> $GITHUB_ENV
- name: rustdoc
run: |
RUSTDOCFLAGS='-D warnings' cargo doc \
-p ariel-os \
--features "
bench,
coap,
csprng,
executor-thread,
external-interrupts,
hwrng,
i2c,
net,
no-boards,
random,
ariel-os-coap/doc,
spi,
storage,
threading,
usb,
usb-hid,
"
- name: rustdoc for ESP32
run: |
RUSTDOCFLAGS='-D warnings --cfg context="esp32c6"' cargo doc \
--target=riscv32imac-unknown-none-elf \
--features "
esp-hal-embassy/esp32c6,
esp-hal/esp32c6,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-esp
- name: rustdoc for RP
run: |
RUSTDOCFLAGS='-D warnings --cfg context="rp2040"' cargo doc \
--features "
embassy-rp/rp2040,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-rp
- name: rustdoc for nRF
run: |
RUSTDOCFLAGS='-D warnings --cfg context="nrf52840"' cargo doc \
--features "
embassy-nrf/nrf52840,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-nrf
- name: rustdoc for STM32
run: |
RUSTDOCFLAGS='-D warnings --cfg context="stm32wb55rgvx"' cargo doc \
--features "
embassy-stm32/stm32wb55rg,
external-interrupts,
i2c,
spi,
" \
-p ariel-os-stm32
- name: rustfmt
run: cargo fmt --check --all
- name: yamllint
uses: karancode/yamllint-github-action@master
with:
yamllint_comment: true # Insert inline PR comments
yamllint_strict: true # Set error code on warnings
- 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