Skip to content

Commit 10a3318

Browse files
ci: improve workflows (#100)
1 parent 5a2909d commit 10a3318

File tree

9 files changed

+96
-27
lines changed

9 files changed

+96
-27
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ on:
99
permissions:
1010
contents: read
1111

12-
env:
13-
RUSTFLAGS: '-Dwarnings'
14-
1512
jobs:
16-
test:
17-
name: Test
13+
lint:
14+
name: Lint
1815
runs-on: ubuntu-latest
1916

17+
env:
18+
RUSTFLAGS: '-Dwarnings'
19+
2020
steps:
2121
- name: Checkout
2222
uses: actions/checkout@v5
@@ -27,11 +27,40 @@ jobs:
2727
components: clippy, rustfmt
2828
target: wasm32-unknown-unknown
2929

30-
- name: Check formatting
31-
run: cargo fmt --all --check
30+
- name: Install Cargo Binary Install
31+
uses: cargo-bins/cargo-binstall@main
32+
33+
- name: Install crates
34+
run: cargo binstall -y --force cargo-deny cargo-machete cargo-sort
3235

3336
- name: Lint
3437
run: cargo clippy --all-features --locked
3538

39+
- name: Check dependencies
40+
run: cargo deny check
41+
42+
- name: Check unused dependencies
43+
run: cargo machete
44+
45+
- name: Check manifest formatting
46+
run: cargo sort --workspace --check
47+
48+
- name: Check formatting
49+
run: cargo fmt --all --check
50+
51+
test:
52+
name: Test
53+
runs-on: ubuntu-latest
54+
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@v5
58+
59+
- name: Set up Rust toolchain
60+
uses: actions-rust-lang/setup-rust-toolchain@v1
61+
with:
62+
components: clippy, rustfmt
63+
target: wasm32-unknown-unknown
64+
3665
- name: Test
3766
run: cargo test --all-features --locked --release

.github/workflows/website.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
- name: Set up Rust toolchain
2626
uses: actions-rust-lang/setup-rust-toolchain@v1
2727
with:
28-
components: clippy, rustfmt
2928
target: wasm32-unknown-unknown
3029

3130
- name: Install Cargo Binary Install
@@ -35,7 +34,7 @@ jobs:
3534
run: cargo binstall --force -y trunk
3635

3736
- name: Install Node.js dependencies
38-
run: npm install
37+
run: npm ci
3938

4039
- name: Build
4140
run: npm run build

.pre-commit-config.yaml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,39 @@
11
repos:
2+
- repo: https://github.com/pre-commit/mirrors-prettier
3+
rev: v3.1.0
4+
hooks:
5+
- id: prettier
6+
language: node
7+
additional_dependencies:
8+
- prettier@^3.6.2
9+
210
- repo: https://github.com/doublify/pre-commit-rust
311
rev: v1.0
412
hooks:
513
- id: fmt
614
- id: clippy
715

8-
- repo: https://github.com/pre-commit/mirrors-prettier
9-
rev: v3.1.0
16+
- repo: https://github.com/EmbarkStudios/cargo-deny
17+
rev: 0.18.4
1018
hooks:
11-
- id: prettier
12-
language: node
13-
additional_dependencies:
14-
- prettier@^3.3.3
19+
- id: cargo-deny
20+
21+
# - repo: https://github.com/bnjbvr/cargo-machete
22+
# rev: ba1bcd4
23+
# hooks:
24+
# - id: cargo-machete
25+
- repo: local
26+
hooks:
27+
- id: cargo-machete
28+
name: cargo-machete
29+
language: rust
30+
entry: cargo machete
31+
types: [file, toml]
32+
files: Cargo\.(toml|lock)
33+
pass_filenames: false
34+
35+
- repo: https://github.com/DevinR528/cargo-sort
36+
rev: v2.0.1
37+
hooks:
38+
- id: cargo-sort
39+
args: ['--workspace']

.prettierrc.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
"bracketSpacing": false,
33
"printWidth": 120,
44
"singleQuote": true,
5-
"tabWidth": 4,
6-
"trailingComma": "none"
5+
"tabWidth": 4
76
}

Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repository = "https://github.com/RustForWeb/slides"
1010
version = "0.0.1"
1111

1212
[workspace.dependencies]
13-
console_log = "1.0.0"
1413
console_error_panic_hook = "0.1.7"
14+
console_log = "1.0.0"
1515
log = "0.4.22"
1616
tailwind_fuse = "0.3.1"

deny.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[graph]
2+
all-features = true
3+
4+
[advisories]
5+
ignore = [
6+
{ id = "RUSTSEC-2024-0370", reason = "No safe upgrade is available `proc-macro-error`." },
7+
{ id = "RUSTSEC-2024-0436", reason = "No maintained version available for `paste`." },
8+
]
9+
10+
[bans]
11+
allow-wildcard-paths = true
12+
multiple-versions = "allow"
13+
wildcards = "deny"
14+
15+
[licenses]
16+
allow = ["Apache-2.0", "BSL-1.0", "MIT", "Unicode-3.0", "Zlib"]
17+
confidence-threshold = 1.0
18+
19+
[sources]
20+
unknown-git = "deny"
21+
unknown-registry = "deny"

packages/floating-ui-examples/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ repository.workspace = true
1010
version.workspace = true
1111

1212
[dependencies]
13-
console_log.workspace = true
1413
console_error_panic_hook.workspace = true
14+
console_log.workspace = true
1515
convert_case = "0.8.0"
1616
floating-ui-leptos = "0.1.3"
17-
leptos = {version = "0.6.15", features = ["csr"]}
17+
leptos = { version = "0.6.15", features = ["csr"] }
1818
log.workspace = true
1919
tailwind_fuse.workspace = true

packages/radix-primitives-examples/Cargo.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@ repository.workspace = true
1010
version.workspace = true
1111

1212
[dependencies]
13-
console_log.workspace = true
1413
console_error_panic_hook.workspace = true
15-
convert_case = "0.8.0"
14+
console_log.workspace = true
15+
leptos = { version = "0.6.15", features = ["csr"] }
16+
log.workspace = true
1617
radix-leptos-avatar = "0.0.2"
1718
radix-leptos-checkbox = "0.0.2"
1819
radix-leptos-icons = "0.0.2"
1920
radix-leptos-label = "0.0.2"
2021
radix-leptos-progress = "0.0.2"
2122
radix-leptos-switch = "0.0.2"
2223
radix-leptos-toggle = "0.0.2"
23-
leptos = { version = "0.6.15", features = ["csr"] }
24-
log.workspace = true
25-
tailwind_fuse.workspace = true

0 commit comments

Comments
 (0)