ci: only one job for clippy and rustdoc #393
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: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
merge_group: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
strategy: | |
fail-fast: false | |
matrix: | |
partition: [ "1/10", "2/10", "3/10", "4/10", "5/10", "6/10", "7/10", "8/10", "9/10", "10/10" ] | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Run sccache-cache | |
uses: mozilla-actions/sccache-action@v0.0.4 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
targets: thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi | |
- name: rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: "${{ matrix.partition }}" | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-binstall | |
- name: "installing prerequisites" | |
run: | | |
git config --global init.defaultBranch main | |
git config --global user.email "ci@riot-labs.de" | |
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 | |
- name: "riot-rs compilation test" | |
run: | | |
sccache --start-server || true # work around https://github.com/ninja-build/ninja/issues/2052 | |
laze build --partition hash:${{ matrix.partition }} --builders microbit-v2,nrf52840dk,rpi-pico,rpi-pico-w -g | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: clippy | |
- 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 -p riot-rs-embassy | |
# TODO: we'll eventually want to generate docs for riot-rs instead | |
# TODO: we'll eventually want to enable relevant features | |
- name: "rustdoc" | |
run: cargo rustdoc -p riot-rs-embassy -- -D warnings | |
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 |