-
Notifications
You must be signed in to change notification settings - Fork 8
/
justfile
193 lines (156 loc) · 4.76 KB
/
justfile
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
# Default to listing recipes
_default:
@just --list --list-prefix ' > '
# Fast check project for errors
check:
@echo '==> Checking project for compile errors'
cargo check
# Build service for development
build:
@echo '==> Building project'
cargo build
# Run the service
run: build
@echo '==> Running project (ctrl+c to exit)'
cargo run
# Run project test suite, skipping storage tests
test:
@echo '==> Testing project (default)'
cargo test
# Run project test suite, including storage tests (requires storage docker services to be running)
test-all:
@echo '==> Testing project (all features)'
cargo test --all-features
# Run test from project documentation
test-doc:
@echo '==> Testing project docs'
cargo test --doc
# Clean build artifacts
clean:
@echo '==> Cleaning project target/*'
cargo clean
fmt-imports:
#!/bin/bash
set -euo pipefail
if command -v cargo-fmt >/dev/null; then
echo '==> Running rustfmt'
cargo +nightly fmt -- --config group_imports=StdExternalCrate,imports_granularity=One
else
echo '==> rustfmt not found in PATH, skipping'
fi
# Build docker image
build-docker:
@echo '=> Build keys-server docker image'
docker-compose -f ./ops/docker-compose.keyserver.yml -f ./ops/docker-compose.storage.yml build keyserver
# Start keys-server & storage services on docker
run-docker:
@echo '==> Start services on docker'
docker-compose -f ./ops/docker-compose.keyserver.yml -f ./ops/docker-compose.storage.yml up -d
# Stop keys-server & storage services on docker
stop-docker:
@echo '==> Stop services on docker'
docker-compose -f ./ops/docker-compose.keyserver.yml -f ./ops/docker-compose.storage.yml down
# Clean up docker keys-server & storage services
clean-docker:
@echo '==> Clean services on docker'
docker-compose -f ./ops/docker-compose.keyserver.yml -f ./ops/docker-compose.storage.yml stop
docker-compose -f ./ops/docker-compose.keyserver.yml -f ./ops/docker-compose.storage.yml rm -f
# Start storage services on docker
run-storage-docker:
@echo '==> Start storage services on docker'
docker-compose -f ./ops/docker-compose.storage.yml up -d
# Stop storage services on docker
stop-storage-docker:
@echo '==> Stop storage services on docker'
docker-compose -f ./ops/docker-compose.storage.yml down
# Clean up docker storage services
clean-storage-docker:
@echo '==> Clean storage services on docker'
docker-compose -f ./ops/docker-compose.storage.yml stop
docker-compose -f ./ops/docker-compose.storage.yml rm -f
# Restart keys-server on docker
restart-keyserver-docker:
@echo '==> Restart keys-server service on docker'
docker-compose -f ./ops/docker-compose.keyserver.yml -f ./ops/docker-compose.storage.yml up -d --build --force-recreate --no-deps keyserver
# Make sure we are running the right submodule versions
update-submodules:
git submodule update --init --recursive
# Lint the project for any quality issues
lint: clippy fmt commit-check
unit: update-submodules lint test test-all test-doc tf-lint
devloop: unit fmt-imports
# Run project linter
clippy:
#!/bin/bash
set -euo pipefail
if command -v cargo-clippy >/dev/null; then
echo '==> Running clippy'
cargo clippy --all-features --tests -- -D clippy::all -W clippy::style
else
echo '==> clippy not found in PATH, skipping'
fi
# Run code formatting check
fmt:
#!/bin/bash
set -euo pipefail
if command -v cargo-fmt >/dev/null; then
echo '==> Running rustfmt'
cargo fmt
else
echo '==> rustfmt not found in PATH, skipping'
fi
# Run commit checker
commit-check:
#!/bin/bash
set -euo pipefail
if command -v cog >/dev/null; then
echo '==> Running cog check'
cog check --from-latest-tag
else
echo '==> cog not found in PATH, skipping'
fi
tf-lint: tf-validate tf-fmt tfsec tflint
# Check Terraform formating
tf-fmt:
#!/bin/bash
set -euo pipefail
if command -v terraform >/dev/null; then
echo '==> Checking terraform fmt'
terraform -chdir=terraform fmt -recursive
else
echo '==> Terraform not found in PATH, skipping'
fi
tf-validate:
#!/bin/bash
set -euo pipefail
if command -v terraform >/dev/null; then
echo '==> Running terraform validate'
terraform -chdir=terraform validate
else
echo '==> Terraform not found in PATH, skipping'
fi
# Check Terraform for potential security issues
tfsec:
#!/bin/bash
set -euo pipefail
if command -v tfsec >/dev/null; then
echo '==> Running tfsec'
cd terraform
tfsec
else
echo '==> tfsec not found in PATH, skipping'
fi
# Run Terraform linter
tflint:
#!/bin/bash
set -euo pipefail
if command -v tflint >/dev/null; then
echo '==> Running tflint'
cd terraform
tflint
tflint ./ecs
tflint ./monitoring
tflint ./docdb
else
echo '==> tflint not found in PATH, skipping'
fi