diff options
author | bnewbold <bnewbold@robocracy.org> | 2023-03-27 08:16:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-27 10:16:17 -0500 |
commit | 2789d5c05647e3d6d6ae5d6e226b4218ed4a16d1 (patch) | |
tree | fb266710c9865130c2d10e389c6429802fd8515c /bskyweb/Makefile | |
parent | 4fbe0e267ccf0adfcdd8b0c66107f1e1717ca31a (diff) | |
download | voidsky-2789d5c05647e3d6d6ae5d6e226b4218ed4a16d1.tar.zst |
Basic golang CI setup (#360)
* bskyweb: Makefile and dev env This matches the setup for local dev testing in atproto and indigo repos. * gitignore: don't ignore self and .github/ * CI: golang build+test and lint actions * bskyweb: better use of godotenv A recent change from indigo. * prettier: ignore top-level app.json * CI: bump from golang 1.19 to 1.20 * bskyweb: update to golang 1.20
Diffstat (limited to 'bskyweb/Makefile')
-rw-r--r-- | bskyweb/Makefile | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/bskyweb/Makefile b/bskyweb/Makefile new file mode 100644 index 000000000..957f043f5 --- /dev/null +++ b/bskyweb/Makefile @@ -0,0 +1,42 @@ + +SHELL = /bin/bash +.SHELLFLAGS = -o pipefail -c + +.PHONY: help +help: ## Print info about all commands + @echo "Commands:" + @echo + @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[01;32m%-20s\033[0m %s\n", $$1, $$2}' + +.PHONY: build +build: ## Build all executables + go build ./cmd/bskyweb + +.PHONY: test +test: ## Run all tests + go test ./... + +.PHONY: coverage-html +coverage-html: ## Generate test coverage report and open in browser + go test ./... -coverpkg=./... -coverprofile=test-coverage.out + go tool cover -html=test-coverage.out + +.PHONY: lint +lint: ## Verify code style and run static checks + go vet ./... + test -z $(gofmt -l ./...) + +.PHONY: fmt +fmt: ## Run syntax re-formatting (modify in place) + go fmt ./... + +.PHONY: check +check: ## Compile everything, checking syntax (does not output binaries) + go build ./... + +.env: + if [ ! -f ".env" ]; then cp example.dev.env .env; fi + +.PHONY: run-dev-bskyweb +run-dev-bskyweb: .env ## Runs 'bskyweb' for local dev + GOLOG_LOG_LEVEL=info go run ./cmd/bskyweb serve |