Skip to content

Commit 86b7ea7

Browse files
committed
{"schema":"cmsg/1","type":"chore","scope":"global","summary":"standardize template lint and ci workflow for vstyle","intent":"embed cargo vstyle lint tasks and split rust and toml checks in template ci","impact":"new repositories inherit vstyle lint integration and release binary installation in language checks","breaking":false,"risk":"low","refs":[]}
1 parent 20e76bc commit 86b7ea7

File tree

2 files changed

+124
-39
lines changed

2 files changed

+124
-39
lines changed

.github/workflows/language.yml

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ permissions:
66

77
on:
88
push:
9-
branches: [main]
9+
branches:
10+
- main
1011
paths-ignore:
1112
- '**/*.md'
1213
- '.gitignore'
1314
- 'docs/**'
1415
pull_request:
15-
branches: [main]
16+
branches:
17+
- main
1618
paths-ignore:
1719
- '**/*.md'
1820
- '.gitignore'
@@ -50,24 +52,57 @@ jobs:
5052
with:
5153
tool: cargo-make
5254

55+
- name: Install vibe-style (latest release)
56+
run: |
57+
set -euo pipefail
58+
VERSION="$(curl -fsSL https://api.github.com/repos/hack-ink/vibe-style/releases/latest | grep -oE '"tag_name": "v[^"]+"' | cut -d'"' -f4)"
59+
TARGET="x86_64-unknown-linux-gnu"
60+
ASSET="vibe-style-${TARGET}-${VERSION}.tgz"
61+
62+
curl -fsSLO "https://github.com/hack-ink/vibe-style/releases/download/${VERSION}/${ASSET}"
63+
tar -xzf "${ASSET}"
64+
65+
mkdir -p "$HOME/.cargo/bin"
66+
install -m 0755 "vibe-style-${TARGET}-${VERSION}/vstyle" "$HOME/.cargo/bin/vstyle"
67+
install -m 0755 "vibe-style-${TARGET}-${VERSION}/cargo-vstyle" "$HOME/.cargo/bin/cargo-vstyle"
68+
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
69+
70+
- name: Install nextest
71+
uses: taiki-e/install-action@v2
72+
with:
73+
tool: nextest
74+
5375
- name: Run lint
54-
run: cargo make lint-rust
76+
run: cargo make lint
5577

5678
- name: Run Rust format checks
5779
run: cargo make fmt-rust-check
5880

81+
- name: Run tests
82+
run: cargo make test-rust
83+
84+
toml:
85+
name: TOML checks
86+
runs-on: ubuntu-latest
87+
steps:
88+
- name: Fetch latest code
89+
uses: actions/checkout@v6
90+
91+
- name: Set up Rust toolchain
92+
uses: actions-rust-lang/setup-rust-toolchain@v1
93+
with:
94+
cache: true
95+
rustflags: ''
96+
97+
- name: Install cargo-make
98+
uses: taiki-e/install-action@v2
99+
with:
100+
tool: cargo-make
101+
59102
- name: Install taplo
60103
uses: taiki-e/install-action@v2
61104
with:
62105
tool: taplo
63106

64107
- name: Run TOML format checks
65108
run: cargo make fmt-toml-check
66-
67-
- name: Install nextest
68-
uses: taiki-e/install-action@v2
69-
with:
70-
tool: nextest
71-
72-
- name: Run tests
73-
run: cargo make test-rust

Makefile.toml

Lines changed: 78 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,70 @@
11
# Rust workspace tasks.
22

33
# Lint
4-
# | task | type | cwd |
5-
# | ------------- | --------- | --- |
6-
# | lint | composite | |
7-
# | lint-fix | composite | |
8-
# | lint-rust | command | |
9-
# | lint-fix-rust | extend | |
4+
# | task | type | cwd |
5+
# | --------------- | --------- | --- |
6+
# | lint | composite | |
7+
# | lint-fix | composite | |
8+
# | lint-rust | command | |
9+
# | lint-fix-rust | extend | |
10+
# | lint-vstyle | command | |
11+
# | lint-fix-vstyle | command | |
1012

1113
[tasks.lint]
1214
workspace = false
13-
dependencies = ["lint-rust"]
15+
dependencies = [
16+
"lint-rust",
17+
"lint-vstyle",
18+
]
1419

1520
[tasks.lint-fix]
1621
workspace = false
17-
dependencies = ["lint-fix-rust"]
22+
dependencies = [
23+
"lint-fix-rust",
24+
"lint-fix-vstyle",
25+
]
1826

1927
[tasks.lint-rust]
2028
workspace = false
2129
command = "cargo"
2230
args = [
23-
"clippy",
24-
"--workspace",
25-
"--all-targets",
26-
"--all-features",
27-
"--",
28-
"-D",
29-
"warnings",
31+
"clippy",
32+
"--workspace",
33+
"--all-targets",
34+
"--all-features",
35+
"--",
36+
"-D",
37+
"warnings",
3038
]
3139

3240
[tasks.lint-fix-rust]
3341
extend = "lint-rust"
3442
args = [
35-
"clippy",
36-
"--fix",
37-
"--allow-dirty",
38-
"--workspace",
39-
"--all-targets",
40-
"--all-features",
43+
"clippy",
44+
"--fix",
45+
"--allow-dirty",
46+
"--workspace",
47+
"--all-targets",
48+
"--all-features",
49+
]
50+
51+
[tasks.lint-vstyle]
52+
workspace = false
53+
command = "cargo"
54+
args = [
55+
"vstyle",
56+
"curate",
57+
"--workspace",
58+
]
59+
60+
[tasks.lint-fix-vstyle]
61+
workspace = false
62+
command = "cargo"
63+
args = [
64+
"vstyle",
65+
"tune",
66+
"--workspace",
67+
"--strict",
4168
]
4269

4370

@@ -49,12 +76,20 @@ args = [
4976

5077
[tasks.test]
5178
workspace = false
52-
dependencies = ["test-rust"]
79+
dependencies = [
80+
"test-rust",
81+
]
5382

5483
[tasks.test-rust]
5584
workspace = false
5685
command = "cargo"
57-
args = ["nextest", "run", "--workspace", "--all-targets", "--all-features"]
86+
args = [
87+
"nextest",
88+
"run",
89+
"--workspace",
90+
"--all-targets",
91+
"--all-features",
92+
]
5893

5994

6095
# Format
@@ -69,11 +104,17 @@ args = ["nextest", "run", "--workspace", "--all-targets", "--all-features"]
69104

70105
[tasks.fmt]
71106
workspace = false
72-
dependencies = ["fmt-rust", "fmt-toml"]
107+
dependencies = [
108+
"fmt-rust",
109+
"fmt-toml",
110+
]
73111

74112
[tasks.fmt-check]
75113
workspace = false
76-
dependencies = ["fmt-rust-check", "fmt-toml-check"]
114+
dependencies = [
115+
"fmt-rust-check",
116+
"fmt-toml-check",
117+
]
77118

78119
[tasks.fmt-rust]
79120
workspace = false
@@ -86,11 +127,16 @@ script = "cargo +nightly fmt --all -- --check"
86127
[tasks.fmt-toml]
87128
workspace = false
88129
command = "taplo"
89-
args = ["fmt"]
130+
args = [
131+
"fmt",
132+
]
90133

91134
[tasks.fmt-toml-check]
92135
extend = "fmt-toml"
93-
args = ["fmt", "--check"]
136+
args = [
137+
"fmt",
138+
"--check",
139+
]
94140

95141

96142
# Meta
@@ -100,4 +146,8 @@ args = ["fmt", "--check"]
100146

101147
[tasks.checks]
102148
workspace = false
103-
dependencies = ["lint", "test", "fmt-check"]
149+
dependencies = [
150+
"lint",
151+
"test",
152+
"fmt-check",
153+
]

0 commit comments

Comments
 (0)