From abc97aa96f314ca7c78cf061c507066854e81854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABlle=20Huisman?= Date: Mon, 25 Aug 2025 19:24:07 +0200 Subject: [PATCH] ci: improve workflows --- .github/workflows/ci.yml | 43 ++++++++++++++++--- .github/workflows/website.yml | 3 +- .pre-commit-config.yaml | 37 +++++++++++++--- .prettierrc.json | 3 +- Cargo.lock | 2 - Cargo.toml | 2 +- deny.toml | 21 +++++++++ packages/floating-ui-examples/Cargo.toml | 4 +- packages/radix-primitives-examples/Cargo.toml | 8 ++-- 9 files changed, 96 insertions(+), 27 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/.github/workflows/website.yml b/.github/workflows/website.yml index 2c86267..1748579 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -25,7 +25,6 @@ jobs: - name: Set up Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: - components: clippy, rustfmt target: wasm32-unknown-unknown - name: Install Cargo Binary Install @@ -35,7 +34,7 @@ jobs: run: cargo binstall --force -y trunk - name: Install Node.js dependencies - run: npm install + run: npm ci - name: Build run: npm run build diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6bd2161..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.3.3 + - 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 e792bd8..ac12772 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1567,7 +1567,6 @@ version = "0.0.1" dependencies = [ "console_error_panic_hook", "console_log", - "convert_case 0.8.0", "leptos", "log", "radix-leptos-avatar", @@ -1577,7 +1576,6 @@ dependencies = [ "radix-leptos-progress", "radix-leptos-switch", "radix-leptos-toggle", - "tailwind_fuse", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 5f5f15a..12ef7b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/RustForWeb/slides" version = "0.0.1" [workspace.dependencies] -console_log = "1.0.0" console_error_panic_hook = "0.1.7" +console_log = "1.0.0" log = "0.4.22" tailwind_fuse = "0.3.1" diff --git a/deny.toml b/deny.toml new file mode 100644 index 0000000..b26c570 --- /dev/null +++ b/deny.toml @@ -0,0 +1,21 @@ +[graph] +all-features = true + +[advisories] +ignore = [ + { id = "RUSTSEC-2024-0370", reason = "No safe upgrade is available `proc-macro-error`." }, + { id = "RUSTSEC-2024-0436", reason = "No maintained version available for `paste`." }, +] + +[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" diff --git a/packages/floating-ui-examples/Cargo.toml b/packages/floating-ui-examples/Cargo.toml index ca0527c..1030be1 100644 --- a/packages/floating-ui-examples/Cargo.toml +++ b/packages/floating-ui-examples/Cargo.toml @@ -10,10 +10,10 @@ repository.workspace = true version.workspace = true [dependencies] -console_log.workspace = true console_error_panic_hook.workspace = true +console_log.workspace = true convert_case = "0.8.0" floating-ui-leptos = "0.1.3" -leptos = {version = "0.6.15", features = ["csr"]} +leptos = { version = "0.6.15", features = ["csr"] } log.workspace = true tailwind_fuse.workspace = true diff --git a/packages/radix-primitives-examples/Cargo.toml b/packages/radix-primitives-examples/Cargo.toml index 144b526..5685a5d 100644 --- a/packages/radix-primitives-examples/Cargo.toml +++ b/packages/radix-primitives-examples/Cargo.toml @@ -10,9 +10,10 @@ repository.workspace = true version.workspace = true [dependencies] -console_log.workspace = true console_error_panic_hook.workspace = true -convert_case = "0.8.0" +console_log.workspace = true +leptos = { version = "0.6.15", features = ["csr"] } +log.workspace = true radix-leptos-avatar = "0.0.2" radix-leptos-checkbox = "0.0.2" radix-leptos-icons = "0.0.2" @@ -20,6 +21,3 @@ radix-leptos-label = "0.0.2" radix-leptos-progress = "0.0.2" radix-leptos-switch = "0.0.2" radix-leptos-toggle = "0.0.2" -leptos = { version = "0.6.15", features = ["csr"] } -log.workspace = true -tailwind_fuse.workspace = true