2021-11-20 14:31:10 +00:00
|
|
|
dev:
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euxo pipefail
|
|
|
|
export ACME_API=https://acme.mock.directory
|
|
|
|
export ACME_ACCEPT_TERMS=true
|
|
|
|
export PAGES_DOMAIN=localhost.mock.directory
|
|
|
|
export RAW_DOMAIN=raw.localhost.mock.directory
|
|
|
|
export PORT=4430
|
2021-12-10 13:32:14 +00:00
|
|
|
go run . --verbose
|
2021-11-20 20:43:12 +00:00
|
|
|
|
|
|
|
build:
|
|
|
|
CGO_ENABLED=0 go build -ldflags '-s -w' -v -o build/codeberg-pages-server ./
|
2022-05-10 16:13:14 +00:00
|
|
|
|
2022-06-14 18:35:11 +00:00
|
|
|
build-tag VERSION:
|
|
|
|
CGO_ENABLED=0 go build -ldflags '-s -w -X "codeberg.org/codeberg/pages/server/version.Version={{VERSION}}"' -v -o build/codeberg-pages-server ./
|
|
|
|
|
2022-05-10 16:13:14 +00:00
|
|
|
lint: tool-golangci tool-gofumpt
|
|
|
|
[ $(gofumpt -extra -l . | wc -l) != 0 ] && { echo 'code not formated'; exit 1; }; \
|
2022-06-11 21:17:43 +00:00
|
|
|
golangci-lint run --timeout 5m --build-tags integration
|
2022-05-10 16:13:14 +00:00
|
|
|
|
2022-06-11 21:02:06 +00:00
|
|
|
fmt: tool-gofumpt
|
|
|
|
gofumpt -w --extra .
|
|
|
|
|
2022-07-15 19:21:26 +00:00
|
|
|
clean:
|
|
|
|
go clean ./...
|
|
|
|
rm -rf build/
|
|
|
|
|
2022-05-10 16:13:14 +00:00
|
|
|
tool-golangci:
|
|
|
|
@hash golangci-lint> /dev/null 2>&1; if [ $? -ne 0 ]; then \
|
2022-05-30 21:55:37 +00:00
|
|
|
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest; \
|
2022-05-10 16:13:14 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
tool-gofumpt:
|
|
|
|
@hash gofumpt> /dev/null 2>&1; if [ $? -ne 0 ]; then \
|
|
|
|
go install mvdan.cc/gofumpt@latest; \
|
|
|
|
fi
|
2022-06-13 12:43:49 +00:00
|
|
|
|
|
|
|
test:
|
|
|
|
go test -race codeberg.org/codeberg/pages/server/...
|
|
|
|
|
2022-06-14 18:35:11 +00:00
|
|
|
test-run TEST:
|
|
|
|
go test -race -run "^{{TEST}}$" codeberg.org/codeberg/pages/server/...
|
|
|
|
|
2022-06-13 12:43:49 +00:00
|
|
|
integration:
|
|
|
|
go test -race -tags integration codeberg.org/codeberg/pages/integration/...
|
2022-06-14 18:35:11 +00:00
|
|
|
|
|
|
|
integration-run TEST:
|
|
|
|
go test -race -tags integration -run "^{{TEST}}$" codeberg.org/codeberg/pages/integration/...
|