-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (45 loc) · 2.05 KB
/
Copy pathMakefile
File metadata and controls
58 lines (45 loc) · 2.05 KB
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
# This file is part of REANA.
# Copyright (C) 2022, 2025, 2026 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
SWAGGER := docker run --rm -it -e GOPATH=$(shell go env GOPATH):/go -v $(HOME):$(HOME) -w $(shell pwd) --pull always quay.io/goswagger/swagger
all: help
audit: # Run quality control checks.
go install honnef.co/go/tools/cmd/staticcheck@latest
go install golang.org/x/vuln/cmd/govulncheck@latest
go mod verify
go vet ./...
staticcheck ./cmd/... ./pkg/...
govulncheck ./...
build: # Build reana-client-go executable.
go build
clean: # Clean build.
rm -f reana-client-go
help: # Print usage help information.
@echo "Available commands:"
@echo
@grep -E '^[a-zA-Z_-]+:.*?# .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?# "}; {printf " \033[36m%-17s\033[0m %s\n", $$1, $$2}'
release: # Prepare standalone reana-client-go-* executables for release.
version=$(shell go run . version) && \
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o reana-client-go-$$version-darwin-amd64 && \
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o reana-client-go-$$version-darwin-arm64 && \
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o reana-client-go-$$version-linux-amd64 && \
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o reana-client-go-$$version-linux-arm64
swagger-generate-client: # Generate OpenAPI client.
$(SWAGGER) generate client -f "../reana-server/docs/openapi.json" -A api
swagger-validate-specs: # Validate OpenAPI specification.
$(SWAGGER) validate "../reana-server/docs/openapi.json"
test: # Run test suite.
go test -coverprofile coverage.txt ./cmd/... ./pkg/...
tidy: # Format code and tidy go.mod.
go install github.com/segmentio/golines@latest
go install golang.org/x/tools/cmd/goimports@latest
go fmt ./...
goimports -w .
golines -w -m 80 -t 4 .
go mod tidy
update: # Update go module dependencies.
go get -u
go mod tidy
.PHONY: all audit build clean help release swagger-generate-client swagger-validate-specs test tidy update