Skip to content

Commit a2db751

Browse files
ci: improve workflows (#47)
1 parent d55053f commit a2db751

File tree

6 files changed

+89
-25
lines changed

6 files changed

+89
-25
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 13 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,18 +27,40 @@ jobs:
2727
components: clippy, rustfmt
2828
target: wasm32-unknown-unknown
2929

30-
- name: Install Cargo packages
31-
run: cargo install wasm-pack
30+
- name: Install Cargo Binary Install
31+
uses: cargo-bins/cargo-binstall@main
3232

33-
- name: Check formatting
34-
run: cargo fmt --all --check
33+
- name: Install crates
34+
run: cargo binstall -y --force cargo-deny cargo-machete cargo-sort
3535

3636
- name: Lint
3737
run: cargo clippy --all-features --locked
3838

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+
3965
- name: Test
4066
run: cargo test --all-features --locked --release
41-
42-
- name: Test in Browser
43-
run: wasm-pack test --headless --release --chrome --firefox
44-
working-directory: packages/dom

.github/workflows/website.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ jobs:
1919
- name: Set up Rust toolchain
2020
uses: actions-rust-lang/setup-rust-toolchain@v1
2121
with:
22-
components: clippy, rustfmt
2322
target: wasm32-unknown-unknown
2423

2524
- name: Install Cargo Binary Install
@@ -44,7 +43,6 @@ jobs:
4443
- name: Set up Rust toolchain
4544
uses: actions-rust-lang/setup-rust-toolchain@v1
4645
with:
47-
components: clippy, rustfmt
4846
target: wasm32-unknown-unknown
4947

5048
- name: Install Cargo Binary Install
@@ -54,7 +52,7 @@ jobs:
5452
run: cargo binstall --force -y mdbook mdbook-tabs mdbook-trunk trunk
5553

5654
- name: Install Node.js dependencies
57-
run: npm install
55+
run: npm ci
5856

5957
- name: Build Book
6058
run: mdbook 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.2.5
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.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ version = "0.0.1"
1313
log = "0.4.22"
1414
regex = "1.10.6"
1515
thiserror = "2.0.0"
16-
web-sys = "0.3.70"
1716
wasm-bindgen = "0.2.93"
1817
wasm-bindgen-test = "0.3.42"
18+
web-sys = "0.3.70"

deny.toml

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

0 commit comments

Comments
 (0)