forked from reanahub/reana-client-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (39 loc) · 1.87 KB
/
Makefile
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
#!/bin/bash
#
# This file is part of REANA.
# Copyright (C) 2022 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) quay.io/goswagger/swagger
all: build
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/...
update: # Update go module dependencies.
go get -u
go mod tidy
lint: # Run lint checks
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run --enable=gofmt --enable=goimports
golines: # Run line size checks
go install github.com/segmentio/golines@latest
golines --dry-run ./
.PHONY: all build clean help release swagger-generate-client swagger-validate-specs test update lint golines