1# SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
 2#
 3# SPDX-License-Identifier: CC0-1.0
 4
 5default: fmt lint staticcheck test vuln reuse
 6
 7fmt:
 8    # Formatting all Go source code
 9    go install mvdan.cc/gofumpt@latest
10    gofumpt -l -w .
11    # Formatting all web source code
12    npx prettier --write "**/*.html.tmpl" 
13
14lint:
15    # Linting Go source code
16    golangci-lint run
17
18staticcheck:
19    # Performing static analysis
20    go install honnef.co/go/tools/cmd/staticcheck@latest
21    staticcheck ./...
22
23test:
24    # Running tests
25    go test -v ./...
26
27vuln:
28    # Checking for vulnerabilities
29    go install golang.org/x/vuln/cmd/govulncheck@latest
30    govulncheck ./...
31
32reuse:
33    # Linting licenses and copyright headers
34    reuse lint
35
36build:
37    # Building Willow
38    CGO_ENABLED=0 go build -o willow -ldflags "-s -w -X main.version=`git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g'`" ./cmd
39
40clean:
41    # Cleaning up
42    rm -rf willow out/
43
44clean-all:
45    # Removing build artifacts, willow.sqlite, config.toml, and data/ directory
46
47    rm -rf willow out willow.sqlite config.toml data