From ba6d0881d7eb72405378dc5752cca52d01f94844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABlle=20Huisman?= Date: Mon, 25 Aug 2025 19:23:16 +0200 Subject: [PATCH] ci: improve workflows --- .github/workflows/ci.yml | 43 +++++++++++++++++++++++++++++++------- .pre-commit-config.yaml | 38 ++++++++++++++++++++++++++------- .prettierrc.json | 3 +-- Cargo.lock | 45 ++++++++++++++++++++++++++++++++++++++-- deny.toml | 23 ++++++++++++++++++++ 5 files changed, 134 insertions(+), 18 deletions(-) create mode 100644 deny.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3434796..1c426fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,14 +9,14 @@ on: permissions: contents: read -env: - RUSTFLAGS: '-Dwarnings' - jobs: - test: - name: Test + lint: + name: Lint runs-on: ubuntu-latest + env: + RUSTFLAGS: '-Dwarnings' + steps: - name: Checkout uses: actions/checkout@v5 @@ -27,11 +27,40 @@ jobs: components: clippy, rustfmt target: wasm32-unknown-unknown - - name: Check formatting - run: cargo fmt --all --check + - name: Install Cargo Binary Install + uses: cargo-bins/cargo-binstall@main + + - name: Install crates + run: cargo binstall -y --force cargo-deny cargo-machete cargo-sort - name: Lint run: cargo clippy --all-features --locked + - name: Check dependencies + run: cargo deny check + + - name: Check unused dependencies + run: cargo machete + + - name: Check manifest formatting + run: cargo sort --workspace --check + + - name: Check formatting + run: cargo fmt --all --check + + test: + name: Test + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Set up Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: clippy, rustfmt + target: wasm32-unknown-unknown + - name: Test run: cargo test --all-features --locked --release diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 428f42f..7d8ba4f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,15 +1,39 @@ repos: + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.1.0 + hooks: + - id: prettier + language: node + additional_dependencies: + - prettier@^3.6.2 + - repo: https://github.com/doublify/pre-commit-rust rev: v1.0 hooks: - id: fmt - id: clippy - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.1.0 + - repo: https://github.com/EmbarkStudios/cargo-deny + rev: 0.18.4 hooks: - - id: prettier - language: node - additional_dependencies: - - prettier@^3.2.5 - - prettier-plugin-tailwindcss@^0.6.0 + - id: cargo-deny + + # - repo: https://github.com/bnjbvr/cargo-machete + # rev: ba1bcd4 + # hooks: + # - id: cargo-machete + - repo: local + hooks: + - id: cargo-machete + name: cargo-machete + language: rust + entry: cargo machete + types: [file, toml] + files: Cargo\.(toml|lock) + pass_filenames: false + + - repo: https://github.com/DevinR528/cargo-sort + rev: v2.0.1 + hooks: + - id: cargo-sort + args: ['--workspace'] diff --git a/.prettierrc.json b/.prettierrc.json index 7fd3381..76bf1ca 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -2,6 +2,5 @@ "bracketSpacing": false, "printWidth": 120, "singleQuote": true, - "tabWidth": 4, - "trailingComma": "none" + "tabWidth": 4 } diff --git a/Cargo.lock b/Cargo.lock index df53ff4..9b1bdb1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,6 +53,12 @@ dependencies = [ "serde", ] +[[package]] +name = "bitflags" +version = "2.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d" + [[package]] name = "bumpalo" version = "3.17.0" @@ -598,6 +604,17 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "io-uring" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b" +dependencies = [ + "bitflags", + "cfg-if", + "libc", +] + [[package]] name = "itoa" version = "1.0.15" @@ -641,6 +658,17 @@ dependencies = [ "adler2", ] +[[package]] +name = "mio" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + [[package]] name = "num_cpus" version = "1.16.0" @@ -930,12 +958,16 @@ dependencies = [ [[package]] name = "tokio" -version = "1.44.1" +version = "1.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a" +checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" dependencies = [ "backtrace", + "io-uring", + "libc", + "mio", "pin-project-lite", + "slab", ] [[package]] @@ -1096,6 +1128,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-targets" version = "0.52.6" diff --git a/deny.toml b/deny.toml new file mode 100644 index 0000000..2e3b7c4 --- /dev/null +++ b/deny.toml @@ -0,0 +1,23 @@ +[graph] +all-features = true + +[advisories] +ignore = [ + { id = "RUSTSEC-2024-0370", reason = "No safe upgrade is available `proc-macro-error`." }, +] + +[bans] +allow-wildcard-paths = true +multiple-versions = "allow" +wildcards = "deny" + +[licenses] +allow = ["Apache-2.0", "BSL-1.0", "MIT", "Unicode-3.0", "Zlib"] +confidence-threshold = 1.0 + +[sources] +unknown-git = "deny" +unknown-registry = "deny" + +[sources.allow-org] +github = ["RustForWeb"]