From 9ccbec5f93e804e3e48fb0fd26ddb1e6cb33b395 Mon Sep 17 00:00:00 2001 From: T6 Date: Thu, 12 Sep 2024 19:14:00 -0400 Subject: [PATCH] configure ci (#21) --- .github/workflows/checks.yml | 77 ++++++++++++++++++++++++++++++++++++ cli/src/ivy_cli.rs | 3 +- cspell.json | 1 + ivm/src/stats.rs | 3 +- rust-toolchain.toml | 4 ++ 5 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/checks.yml create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 00000000..b01fe57c --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,77 @@ +name: Checks + +on: + pull_request: + merge_group: + push: + branches: + - main + +jobs: + check: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v3 + - uses: dsherret/rust-toolchain-file@v1 + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-check-${{ hashFiles('**/Cargo.lock') }} + - run: RUSTFLAGS="-D warnings" cargo check --all-targets + + clippy: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v3 + - uses: dsherret/rust-toolchain-file@v1 + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.lock') }} + - run: RUSTFLAGS="-D warnings" cargo clippy --all-targets + + test: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v3 + - uses: dsherret/rust-toolchain-file@v1 + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }} + - run: SNAP_CHECK=1 cargo test + + fmt: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v3 + - uses: dsherret/rust-toolchain-file@v1 + - run: cargo fmt --check + + cspell: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v3 + - uses: streetsidesoftware/cspell-action@v5 + with: + incremental_files_only: false + config: ./cspell.json + files: | + **/*.rs + **/*.md + **/*.vi + **/*.iv diff --git a/cli/src/ivy_cli.rs b/cli/src/ivy_cli.rs index 49e01c04..2f687dc9 100644 --- a/cli/src/ivy_cli.rs +++ b/cli/src/ivy_cli.rs @@ -1,5 +1,4 @@ -use std::fs; -use std::path::PathBuf; +use std::{fs, path::PathBuf}; use anyhow::Result; use clap::{Args, Parser}; diff --git a/cspell.json b/cspell.json index e088aa11..dbb80aec 100644 --- a/cspell.json +++ b/cspell.json @@ -24,6 +24,7 @@ "nonoverlapping", "readback", "repr", + "rotr", "scrutinee", "sixel", "strs" diff --git a/ivm/src/stats.rs b/ivm/src/stats.rs index 95ca05de..5e0dbd97 100644 --- a/ivm/src/stats.rs +++ b/ivm/src/stats.rs @@ -1,6 +1,5 @@ use core::{ - fmt::{self, Debug}, - fmt::{Display, Write}, + fmt::{self, Debug, Display, Write}, str, time::Duration, }; diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 00000000..dd87ef59 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +profile = "minimal" +channel = "nightly-2024-09-01" +components = ["rustfmt", "clippy", "miri"]