# 2020 Rackspace, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"): you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. app_name := DCM/discover version := v$(shell cat VERSION) hash := $(shell git rev-parse HEAD) timestamp := $(shell date -u '+%Y-%m-%d_%I:%M:%S%p') # Small function to run golint for the packages directories .PHONY: lint lint: ## Run golint on all sub-packages @echo "Running linters on all sub-packages\n" golangci-lint run .PHONY: check_for_pass check_for_pass: ifndef MAKE_PASS $(error MAKE_PASS environment variable not defined, please set with 'export MAKE_PASS=""') endif .PHONY: release release: ## Release a new version and build, tag. golangci-lint run rm -rf build/* git tag $(version) goreleaser --rm-dist .PHONY: testrelease testrelease: ## Test a release git tag $(version) goreleaser --rm-dist --snapshot git tag -d $(version) .PHONY: test # Test related actions # This action should run all tests related to gomigrate test: \ check_for_pass \ test_network \ test_cmdb \ test_ecm \ test_common ## Run all test coverage and post results to gh-pages .PHONY: test_network # Run test for the network package test_network: go test -v -short github.rackspace.com/$(app_name)/network .PHONY: test_cmdb # Run test for the cmdb package test_cmdb: go test -v -short github.rackspace.com/$(app_name)/cmdb .PHONY: test_ecm # Run test for the ecm package test_ecm: go test -v -short github.rackspace.com/$(app_name)/ecm .PHONY: test_common # Run test for the common package test_common: go test -v -short github.rackspace.com/$(app_name)/common