-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
238 lines (201 loc) · 7.99 KB
/
justfile
File metadata and controls
238 lines (201 loc) · 7.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# Zackstrap Project Justfile
# Just is a command runner - https://github.com/casey/just
default:
just info
# Development
rust-version:
just info
cargo-build:
cargo build
cargo-build-release:
cargo build --release
release-build:
@echo "Building release version..."
@if ! cargo get version >/dev/null 2>&1; then \
echo "cargo-get not found, installing tools..."; \
just install-tools; \
fi
@echo "Building version: $(cargo get version 2>/dev/null || echo 'unknown')"
cargo build --release
@echo "Creating release directory..."
mkdir -p dist
@echo "Copying binary to dist/..."
cp target/release/zackstrap dist/
@echo "Creating zipfile..."
cd dist && zip -r "zackstrap-$(cargo get version 2>/dev/null || echo 'unknown')-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m).zip" zackstrap
@echo "Release build complete!"
@echo "Binary: dist/zackstrap"
@echo "Zipfile: dist/zackstrap-$(cargo get version 2>/dev/null || echo 'unknown')-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m).zip"
test:
cargo test
test-coverage:
cargo install cargo-tarpaulin --version 0.32.8
cargo tarpaulin --out Html
check:
cargo check
fmt:
cargo fmt --all
fmt-check:
cargo fmt --all -- --check
clippy:
cargo clippy --all-targets --all-features -- -D warnings
clean:
cargo clean
# CI/CD Stages
# Note: These commands require 'just' to be installed in CI
# The CI workflows automatically install 'just' using taiki-e/install-action@just
ci-lint-format:
@echo "Running lint and format checks..."
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
ci-test:
@echo "Running tests and coverage..."
cargo test --all-features
cargo tarpaulin --out Xml --output-dir coverage
ci-local:
@echo "Running full local CI pipeline..."
just ci-lint-format
just ci-test
# Quick checks
quick-check:
@echo "Quick code check..."
cargo check --all-targets --all-features
quick-fmt:
@echo "Formatting code..."
cargo fmt --all
quick-lint:
@echo "Running clippy..."
cargo clippy --all-targets --all-features -- -D warnings
# Pre-commit checks
pre-commit:
@echo "Running pre-commit checks..."
just quick-fmt
just quick-lint
just quick-check
# Development tools
install-tools:
@echo "Installing development tools..."
cargo install cargo-get || echo "cargo-get already installed"
cargo install cargo-set-version || echo "cargo-set-version already installed"
cargo install cargo-audit || echo "cargo-audit already installed"
cargo install cargo-outdated || echo "cargo-outdated already installed"
cargo install cargo-watch || echo "cargo-watch already installed"
cargo install cargo-tarpaulin --version 0.32.8 || echo "cargo-tarpaulin already installed"
check-deps:
@echo "Checking dependencies..."
cargo outdated || echo "Dependencies check completed (some may be outdated)"
check-deps-json:
@echo "Checking dependencies and saving to JSON..."
cargo outdated --format json > outdated-deps.json || echo "Dependencies check completed (some may be outdated)"
@echo "Results saved to outdated-deps.json"
check-deps-table:
@echo "Checking dependencies in table format..."
cargo outdated --format list || echo "Dependencies check completed (some may be outdated)"
check-tools:
@echo "Development Tools Status:"
@echo "========================"
@echo "cargo-get: $(cargo get --version 2>/dev/null || echo 'not installed')"
@echo "cargo-set-version: $(cargo set-version --version 2>/dev/null || echo 'not installed')"
@echo "cargo-audit: $(cargo audit --version 2>/dev/null || echo 'not installed')"
@echo "cargo-outdated: $(cargo outdated --version 2>/dev/null || echo 'not installed')"
@echo "cargo-watch: $(cargo watch --version 2>/dev/null || echo 'not installed')"
@echo "cargo-tarpaulin: $(cargo tarpaulin --version 2>/dev/null || echo 'not installed')"
# Release
release-patch:
@echo "Creating patch release..."
cargo set-version --bump patch
git add Cargo.toml Cargo.lock
git commit -m "Bump version for patch release"
@if ! cargo get --version >/dev/null 2>&1; then \
echo "cargo-get not found, installing tools..."; \
just install-tools; \
fi
@VERSION=$$(cargo get --version 2>/dev/null || echo "unknown"); \
git tag -a "v$$VERSION" -m "Release v$$VERSION"
git push origin main
git push origin "v$$VERSION"
release-minor:
@echo "Creating minor release..."
cargo set-version --bump minor
git add Cargo.toml Cargo.lock
git commit -m "Bump version for minor release"
@if ! cargo get --version >/dev/null 2>&1; then \
echo "cargo-get not found, installing tools..."; \
just install-tools; \
fi
@VERSION=$$(cargo get --version 2>/dev/null || echo "unknown"); \
git tag -a "v$$VERSION" -m "Release v$$VERSION"
git push origin main
git push origin "v$$VERSION"
release-major:
@echo "Creating major release..."
cargo set-version --bump major
git add Cargo.toml Cargo.lock
git commit -m "Bump version for major release"
@if ! cargo get version >/dev/null 2>&1; then \
echo "cargo-get not found, installing tools..."; \
just install-tools; \
fi
@VERSION=$$(cargo get version 2>/dev/null || echo "unknown"); \
git tag -a "v$$VERSION" -m "Release v$$VERSION"
git push origin main
git push origin "v$$VERSION"
# Cache management
clear-cache:
@echo "Clearing all caches..."
@echo "Clearing cargo cache..."
@rm -rf ~/.cargo/registry ~/.cargo/git target
@echo "Clearing development tools cache..."
@rm -rf ~/.cargo/bin
@echo "Clearing just cache..."
@rm -rf ~/.local/bin
@echo "✅ All caches cleared!"
clear-cache-cargo:
@echo "Clearing cargo cache..."
@rm -rf ~/.cargo/registry ~/.cargo/git target
@echo "✅ Cargo cache cleared!"
clear-cache-tools:
@echo "Clearing development tools cache..."
@rm -rf ~/.cargo/bin
@echo "✅ Development tools cache cleared!"
clear-cache-just:
@echo "Clearing just cache..."
@rm -rf ~/.local/bin
@echo "✅ Just cache cleared!"
cache-status:
@echo "Cache Status"
@echo "============"
@echo "Cargo registry: $(du -sh ~/.cargo/registry 2>/dev/null || echo 'not found')"
@echo "Cargo git: $(du -sh ~/.cargo/git 2>/dev/null || echo 'not found')"
@echo "Target directory: $(du -sh target 2>/dev/null || echo 'not found')"
@echo "Cargo bin: $(du -sh ~/.cargo/bin 2>/dev/null || echo 'not found')"
@echo "Just bin: $(du -sh ~/.local/bin 2>/dev/null || echo 'not found')"
@echo ""
@echo "Development Tools:"
@echo "cargo-get: $(cargo get --version 2>/dev/null || echo 'not installed')"
@echo "cargo-set-version: $(cargo set-version --version 2>/dev/null || echo 'not installed')"
@echo "cargo-audit: $(cargo audit --version 2>/dev/null || echo 'not installed')"
@echo "cargo-outdated: $(cargo outdated --version 2>/dev/null || echo 'not installed')"
@echo "cargo-watch: $(cargo watch --version 2>/dev/null || echo 'not installed')"
@echo "cargo-tarpaulin: $(cargo tarpaulin --version 2>/dev/null || echo 'not installed')"
# Project info
info:
@echo "Zackstrap Project Information"
@echo "============================"
@echo "Rust version: $(rustc --version)"
@echo "Cargo version: $(cargo --version)"
@echo "Just version: $(just --version)"
@if ! cargo get --version >/dev/null 2>&1; then \
echo "cargo-get not found, installing tools..."; \
just install-tools; \
fi
@echo "Current version: $(cargo get --version 2>/dev/null || echo 'unknown')"
@echo ""
@echo "Development Tools Status:"
@echo "========================"
@echo "cargo-get: $(cargo get --version 2>/dev/null || echo 'not installed')"
@echo "cargo-set-version: $(cargo set-version --version 2>/dev/null || echo 'not installed')"
@echo "cargo-audit: $(cargo audit --version 2>/dev/null || echo 'not installed')"
@echo "cargo-outdated: $(cargo outdated --version 2>/dev/null || echo 'not installed')"
@echo "cargo-watch: $(cargo watch --version 2>/dev/null || echo 'not installed')"
@echo "cargo-tarpaulin: $(cargo tarpaulin --version 2>/dev/null || echo 'not installed')"