Debian Codegraph @

Makefile

raw
1 # Copyright 2023 The Archivista Contributors
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Nothing to be run by default as the CodeQL autobuild tries to run make
16 # See https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages#autobuild-for-go
17 all: help
18
19 run-dev: ## Run the dev server
20 @echo "Running dev server. It will refresh automatically when you change code."
21 @docker compose -f compose-dev.yml up --remove-orphans
22
23
24 .PHONY: stop
25 stop: ## Stop the dev server
26 @docker compose -f compose-dev.yml down -v
27
28
29 .PHONY: clean
30 clean: ## Clean up the dev server
31 $(MAKE) stop
32 @docker compose -f compose-dev.yml rm --force
33 @docker rmi archivista-archivista --force
34
35
36 .PHONY: test
37 test: ## Run tests
38 @go test ./... -covermode atomic -coverprofile=cover.out -v
39
40 .PHONY: coverage
41 coverage: ## Show html coverage
42 @go tool cover -html=cover.out
43
44
45 .PHONY: lint
46 lint: ## Run linter
47 @golangci-lint run
48 @go fmt ./...
49 @go vet ./...
50
51
52 .PHONY: docs
53 docs: ## Generate swagger docs
54 @go install github.com/swaggo/swag/cmd/[email protected]
55 @swag init -o docs -d pkg/server -g server.go -pd
56
57 .PHONY: db-migrations
58 db-migrations: ## Run the migrations for the database
59 @go generate ./...
60 @atlas migrate diff mysql --dir "file://ent/migrate/migrations/mysql" --to "ent://ent/schema" --dev-url "docker://mysql/8/dev"
61 @atlas migrate diff pgsql --dir "file://ent/migrate/migrations/pgsql" --to "ent://ent/schema" --dev-url "docker://postgres/16/dev?search_path=public"
62
63
64 help: ## Show this help
65 @grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'