forked from reown-com/blockchain-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
144 lines (117 loc) · 3.18 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
binary-crate := "."
set dotenv-load
export JUST_ROOT := justfile_directory()
# 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
# Note: Currently broken as lack of test-localhost feature will run integration tests against staging and this uses a different env variable
# This is redundnat with test-all or the integration tests run in CI anyway and will be cleaned up later
# test:
# @echo '==> Testing project (default)'
# cargo +nightly test
# Run project test suite
test-all:
@echo '==> Testing project (all features)'
cargo +nightly test --all-features
# Clean build artifacts
clean:
@echo '==> Cleaning project target/*'
cargo clean
# Lint the project for any quality issues
lint: check fmt clippy commit-check
amigood: lint test-all
# Run project linter
clippy:
#!/bin/bash
set -euo pipefail
if command -v cargo-clippy >/dev/null; then
echo '==> Running clippy'
cargo +nightly clippy --all-features --tests -- -D clippy::all
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 +nightly fmt
else
echo '==> rustfmt not found in PATH, skipping'
fi
if command -v terraform -version >/dev/null; then
echo '==> Running terraform fmt'
terraform -chdir=terraform fmt -recursive
else
echo '==> terraform not found in PATH, skipping'
fi
# Run commit checker
commit-check:
#!/bin/bash
set -euo pipefail
# FIXME commit check doesn't exist in CI & no tagging takes place (see #53)
# 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
lint-tf: tf-validate tf-fmt tfsec tflint
# Check Terraform formating
tf-fmt:
#!/bin/bash
set -euo pipefail
if command -v terraform >/dev/null; then
echo '==> Running terraform fmt'
terraform -chdir=terraform fmt -check -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 fmt'
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
cd ecs; tflint
cd ../monitoring; tflint
cd ../private_zone; tflint
cd ../redis; tflint
else
echo '==> tflint not found in PATH, skipping'
fi