-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
285 lines (236 loc) · 7.26 KB
/
Copy pathjustfile
File metadata and controls
285 lines (236 loc) · 7.26 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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# ArcGIS Rust SDK - Justfile
# Standard development recipes
# Default recipe - show available commands
default:
@just --list
# Install development tools (cargo-dist, omnibor, cargo-audit, cargo-watch, cargo-release)
setup:
#!/usr/bin/env bash
echo "Installing development tools..."
# Check and install cargo-dist
if command -v cargo-dist &> /dev/null; then
echo "✓ cargo-dist already installed"
else
echo "Installing cargo-dist..."
cargo install cargo-dist
fi
# Check and install omnibor
if command -v omnibor &> /dev/null; then
echo "✓ omnibor already installed"
else
echo "Installing omnibor-cli..."
cargo install omnibor-cli
fi
# Check and install cargo-audit
if command -v cargo-audit &> /dev/null; then
echo "✓ cargo-audit already installed"
else
echo "Installing cargo-audit..."
cargo install cargo-audit
fi
# Check and install cargo-watch
if command -v cargo-watch &> /dev/null; then
echo "✓ cargo-watch already installed"
else
echo "Installing cargo-watch..."
cargo install cargo-watch
fi
# Check and install cargo-release
if command -v cargo-release &> /dev/null; then
echo "✓ cargo-release already installed"
else
echo "Installing cargo-release..."
cargo install cargo-release
fi
echo ""
echo "✓ All development tools installed"
echo ""
echo "Next steps:"
echo " 1. Run 'just build' to build the project"
echo " 2. Run 'just test' to run tests"
echo " 3. Run 'just check-all' to run all checks"
# Run basic compilation check
check package="":
#!/usr/bin/env bash
if [ -z "{{package}}" ]; then
cargo check
else
cargo check -p {{package}}
fi
# Run tests for a specific package
test-package package="":
#!/usr/bin/env bash
if [ -z "{{package}}" ]; then
cargo test
else
cargo test -p {{package}}
fi
# Run all checks: clippy, fmt, and test
check-all package="":
#!/usr/bin/env bash
set -o pipefail
# Generate timestamped log file in /tmp
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
LOGFILE="/tmp/arcgis-check-all_${TIMESTAMP}.log"
# Track overall status
HAD_ERRORS=0
echo "Logging to: $LOGFILE"
echo "========================================" | tee "$LOGFILE"
echo "check-all run started at $(date)" | tee -a "$LOGFILE"
echo "========================================" | tee -a "$LOGFILE"
echo "" | tee -a "$LOGFILE"
# Run clippy
echo "Running clippy..." | tee -a "$LOGFILE"
if [ -z "{{package}}" ]; then
if ! cargo clippy --all-targets --all-features -- -D warnings 2>&1 | tee -a "$LOGFILE"; then
HAD_ERRORS=1
fi
else
if ! cargo clippy -p {{package}} --all-targets --all-features -- -D warnings 2>&1 | tee -a "$LOGFILE"; then
HAD_ERRORS=1
fi
fi
echo "" | tee -a "$LOGFILE"
# Check formatting
echo "Checking formatting..." | tee -a "$LOGFILE"
if ! cargo fmt --all -- --check 2>&1 | tee -a "$LOGFILE"; then
HAD_ERRORS=1
fi
echo "" | tee -a "$LOGFILE"
# Run tests
echo "Running tests..." | tee -a "$LOGFILE"
if [ -z "{{package}}" ]; then
if ! cargo test 2>&1 | tee -a "$LOGFILE"; then
HAD_ERRORS=1
fi
else
if ! cargo test -p {{package}} 2>&1 | tee -a "$LOGFILE"; then
HAD_ERRORS=1
fi
fi
echo "" | tee -a "$LOGFILE"
# Final status
echo "========================================" | tee -a "$LOGFILE"
echo "check-all run completed at $(date)" | tee -a "$LOGFILE"
echo "========================================" | tee -a "$LOGFILE"
if [ $HAD_ERRORS -eq 1 ]; then
echo ""
echo "❌ Checks failed. Full output logged to:"
echo " $LOGFILE"
echo ""
exit 1
else
echo ""
echo "✓ All checks passed"
echo ""
fi
# Run clippy
clippy:
cargo clippy --all-targets --all-features -- -D warnings
# Check code formatting
fmt-check:
cargo fmt --all -- --check
# Format code
fmt:
cargo fmt --all
# Build the project
build:
cargo build
# Build with release optimizations
build-release:
cargo build --release
# Run all tests (unit tests only, not integration)
test:
cargo test --lib
# Run all tests including doc tests
test-all:
cargo test
# Run integration tests (requires .env with credentials)
test-integration:
cargo test --test integration_basic --features api
# Run API tests (rate-limited, use sparingly)
test-api:
@echo "⚠️ API tests hit live ArcGIS services - use sparingly!"
cargo test --features api
# Build and open documentation
doc:
cargo doc --no-deps --all-features --open
# Check all feature combinations
check-features:
#!/usr/bin/env bash
cargo hack check
# Run security audit
audit:
cargo audit
# Update dependencies
update-deps:
cargo update
# Clean build artifacts
clean:
cargo clean
# Run all pre-commit checks
pre-commit: check-all
@echo "✓ All pre-commit checks passed"
# Run all pre-merge checks (comprehensive validation before merging to main)
pre-merge: check-all check-features audit
@echo "Running public tests..."
cargo test --features test-public
@echo "✓ All pre-merge checks passed"
# Run all pre-publish checks (comprehensive validation before releasing)
pre-publish: pre-merge security dist-check publish-dry-run
@echo "✓ All pre-publish checks passed"
@echo ""
@echo "Ready for release! Next steps:"
@echo " 1. Review: just dist-plan"
@echo " 2. Test build: just dist-build"
@echo " 3. Publish: cargo release"
# Watch for changes and run tests
watch:
cargo watch -x test
# Check MSRV (Minimum Supported Rust Version)
msrv:
cargo +1.85 check
# Run benchmarks (when they exist)
bench:
cargo bench
# Verify the crate can be published
publish-dry-run:
cargo publish --dry-run
# Check if cargo-dist is installed
_check-dist:
#!/usr/bin/env bash
if ! command -v cargo-dist &> /dev/null; then
echo "❌ cargo-dist not found"
echo "Install with: cargo install cargo-dist"
exit 1
fi
# Check if omnibor is installed
_check-omnibor:
#!/usr/bin/env bash
if ! command -v omnibor &> /dev/null; then
echo "❌ omnibor not found"
echo "Install with: cargo install omnibor-cli"
exit 1
fi
# Initialize cargo-dist (first-time setup)
dist-init: _check-dist
cargo dist init
# Generate release artifacts
dist-build: _check-dist
cargo dist build
# Check release configuration
dist-check: _check-dist
cargo dist plan --output-format=json
# Plan release (show what would be released)
dist-plan: _check-dist
cargo dist plan
# Generate CI workflow for releases
dist-generate: _check-dist
cargo dist generate-ci
# Generate omnibor artifact tree (software bill of materials)
omnibor: _check-omnibor
@echo "Generating OmniBOR artifact identifiers..."
omnibor id create target/release/ 2>/dev/null || omnibor id create target/debug/ 2>/dev/null || echo "⚠️ No build artifacts found. Run 'just build' or 'just build-release' first."
# Run all security checks
security: audit omnibor
@echo "✓ Security checks passed"