ci #2140
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
# SPDX-License-Identifier: MIT | |
name: ci | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: "0 4 * * *" | |
permissions: | |
contents: read | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
name: Build and run tests (rust ${{ matrix.rust }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
rust: | |
- stable | |
- beta | |
- nightly | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install linux-modules-extra-$(uname -r) | |
uses: tecolicom/actions-use-apt-tools@main | |
with: | |
tools: linux-modules-extra-$(uname -r) | |
- name: Insert required modules | |
run: | | |
sudo depmod | |
sudo modprobe -v zram | |
sudo modprobe -v zstd | |
- name: Install Rust | |
run: | | |
rm -f ~/.cargo/bin/*fmt ~/.cargo/bin/rust-analyzer | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
- name: Install toolchain | |
run: | | |
rustup toolchain install ${{ matrix.rust }} | |
rustup default ${{ matrix.rust }} | |
- name: Build | |
run: make program CARGOFLAGS="--verbose" | |
- name: Run tests | |
run: make check CARGOFLAGS="--verbose" | |
rustfmt: | |
name: rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
run: | | |
rm -f ~/.cargo/bin/*fmt ~/.cargo/bin/rust-analyzer | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
- name: Install toolchain | |
run: | | |
rustup toolchain install stable | |
rustup default stable | |
- name: Check formatting | |
run: cargo fmt -- --check | |
clippy: | |
name: clippy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
run: | | |
rm -f ~/.cargo/bin/*fmt ~/.cargo/bin/rust-analyzer | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
- name: Install toolchain | |
run: | | |
rustup toolchain install nightly | |
rustup default nightly | |
- name: Validate clippy | |
run: make clippy CARGOFLAGS="-- -D warnings" |