-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
130 lines (107 loc) · 4.31 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
# https://github.com/casey/just
# list things
default: list
# List the options
list:
just --list
# Build the docker image locally using buildx
docker_buildx:
docker buildx build \
--tag ghcr.io/yaleman/goatns:latest \
--tag ghcr.io/yaleman/goatns:$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "goatns") | .version') \
--tag ghcr.io/yaleman/goatns:$(git rev-parse HEAD) \
--label org.opencontainers.image.source=https://github.com/yaleman/goatns \
--label org.opencontainers.image.revision=$(git rev-parse HEAD) \
--label org.opencontainers.image.created=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
.
# Build the docker image locally
docker_build:
docker build \
--tag ghcr.io/yaleman/goatns:latest \
--tag ghcr.io/yaleman/goatns:$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "goatns") | .version') \
--tag ghcr.io/yaleman/goatns:$(git rev-parse HEAD) \
--label org.opencontainers.image.source=https://github.com/yaleman/goatns \
--label org.opencontainers.image.revision=$(git rev-parse HEAD) \
--label org.opencontainers.image.created=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
.
# Publish multi-arch docker image to ghcr.io
docker_publish:
docker buildx build \
--platform linux/amd64,linux/arm64 \
--tag ghcr.io/yaleman/goatns:latest \
--tag ghcr.io/yaleman/goatns:$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "goatns") | .version') \
--tag ghcr.io/yaleman/goatns:$(git rev-parse HEAD) \
--label org.opencontainers.image.source=https://github.com/yaleman/goatns \
--label org.opencontainers.image.revision=$(git rev-parse HEAD) \
--label org.opencontainers.image.created=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--push \
.
# Serve the book
book:
cd docs && mdbook serve
# Run a local debug instance
run:
cargo run
# Run all the checks
check: codespell clippy test doc_check
# Spell check the things
codespell:
codespell -c \
--ignore-words .codespell_ignore \
--skip='./Makefile' \
--skip='./target' \
--skip='./Cargo.lock' \
--skip='./tarpaulin-report.html' \
--skip='./static_files/*' \
--skip='./docs/*,./.git' \
--skip='./plugins/*'
# Ask the clip for the judgement
clippy:
cargo clippy --all-features
test:
cargo test
# Things to do before a release
release_prep: check doc semgrep
cargo deny check
cargo build --release
# Semgrep things
semgrep:
semgrep ci --config auto $OUTPUT \
--exclude-rule "yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha.third-party-action-not-pinned-to-commit-sha" \
--exclude-rule "generic.html-templates.security.var-in-script-tag.var-in-script-tag" \
--exclude-rule "javascript.express.security.audit.xss.mustache.var-in-href.var-in-href" \
--exclude-rule "python.django.security.django-no-csrf-token.django-no-csrf-token" \
--exclude-rule "python.django.security.audit.xss.template-href-var.template-href-var" \
--exclude-rule "python.django.security.audit.xss.var-in-script-tag.var-in-script-tag" \
--exclude-rule "python.flask.security.xss.audit.template-href-var.template-href-var" \
--exclude-rule "python.flask.security.xss.audit.template-href-var.template-href-var"
# Build the rustdocs
doc:
cargo doc --document-private-items
# Run cargo tarpaulin
coverage:
cargo tarpaulin --out Html
@echo "Coverage file at file://$(PWD)/tarpaulin-report.html"
# Run cargo tarpaulin and upload to coveralls
coveralls:
cargo tarpaulin --coveralls $COVERALLS_REPO_TOKEN
# Check docs format
doc_check:
find . -type f \
-not -path './target/*' \
-not -path './docs/*' \
-not -path '*/.venv/*' -not -path './vendor/*'\
-not -path '*/.*/*' \
-name \*.md \
-exec deno fmt --check --options-line-width=100 "{}" +
# Fix docs formatting
doc_fix:
find . -type f -not -path './target/*' -not -path '*/.venv/*' -not -path './vendor/*'\
-name \*.md \
-exec deno fmt --options-line-width=100 "{}" +
# Run trivy on the image
trivy_image:
trivy image ghcr.io/yaleman/goatns:latest --scanners misconfig,vuln,secret
# Run trivy on the repo
trivy_repo:
trivy repo $(pwd) --skip-dirs 'target/**' --skip-files .envrc -d