From f021cb5970bc19fc09a92492a864ccba6f87bd4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABlle=20Huisman?= Date: Mon, 25 Aug 2025 19:30:14 +0200 Subject: [PATCH] ci: improve workflows --- .github/workflows/ci.yml | 43 +++++++++++++++++++++++++++------ .pre-commit-config.yaml | 37 +++++++++++++++++++++++----- .prettierrc.json | 3 +-- Cargo.lock | 1 - deny.toml | 18 ++++++++++++++ packages/aria-hidden/Cargo.toml | 1 - 6 files changed, 86 insertions(+), 17 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 5e063bb..7d8ba4f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +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 + - 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 e458eaa..872b57c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,7 +27,6 @@ dependencies = [ name = "aria-hidden" version = "0.0.1" dependencies = [ - "once_cell", "web-sys", ] diff --git a/deny.toml b/deny.toml new file mode 100644 index 0000000..dd0a7df --- /dev/null +++ b/deny.toml @@ -0,0 +1,18 @@ +[graph] +all-features = true + +[advisories] +ignore = [] + +[bans] +allow-wildcard-paths = true +multiple-versions = "allow" +wildcards = "deny" + +[licenses] +allow = ["Apache-2.0", "BSD-2-Clause", "MIT", "Unicode-3.0"] +confidence-threshold = 1.0 + +[sources] +unknown-git = "deny" +unknown-registry = "deny" diff --git a/packages/aria-hidden/Cargo.toml b/packages/aria-hidden/Cargo.toml index 060b8ce..8050fe4 100644 --- a/packages/aria-hidden/Cargo.toml +++ b/packages/aria-hidden/Cargo.toml @@ -9,7 +9,6 @@ license.workspace = true repository.workspace = true [dependencies] -once_cell = "1.19.0" web-sys = { workspace = true, features = [ "Document", "Element",