|
| 1 | +# Copyright 2020 The Compose Specification Authors. |
| 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 | + |
1 | 15 | .DEFAULT_GOAL := help
|
2 | 16 |
|
| 17 | +PACKAGE=github.com/compose-spec/compose-ref |
| 18 | +IMAGE_PREFIX=composespec/compose-ref- |
| 19 | + |
| 20 | +GOFLAGS=-mod=vendor |
| 21 | + |
3 | 22 | .PHONY: build
|
4 | 23 | build: ## Build compose-ref binary
|
5 |
| - GOPRIVATE=github.com/compose-spec/compose-go go build compose-ref.go |
| 24 | + GOPRIVATE=$(PACKAGE) GOFLAGS=$(GOFLAGS) go build compose-ref.go |
6 | 25 |
|
7 | 26 | .PHONY: test
|
8 | 27 | test: ## Run tests
|
9 |
| - GOPRIVATE=github.com/compose-spec/compose-go go test ./... -v |
| 28 | + GOPRIVATE=$(PACKAGE) GOFLAGS=$(GOFLAGS) go test ./... -v |
10 | 29 |
|
11 | 30 | .PHONY: fmt
|
12 | 31 | fmt: ## Format go files
|
13 | 32 | @goimports -e -w ./
|
14 | 33 |
|
| 34 | +.PHONY: build-validate-image |
| 35 | +build-validate-image: |
| 36 | + docker build . -f ci/Dockerfile -t $(IMAGE_PREFIX)validate |
| 37 | + |
15 | 38 | .PHONY: lint
|
16 |
| -lint: ## Verify Go files |
17 |
| - golangci-lint run --config ./golangci.yml ./ |
| 39 | +lint: build-validate-image |
| 40 | + docker run --rm $(IMAGE_PREFIX)validate bash -c "golangci-lint run --config ./golangci.yml ./" |
| 41 | + |
| 42 | +.PHONY: check-license |
| 43 | +check-license: build-validate-image |
| 44 | + docker run --rm $(IMAGE_PREFIX)validate bash -c "./scripts/validate/fileheader" |
18 | 45 |
|
19 | 46 | .PHONY: setup
|
20 | 47 | setup: ## Setup the precommit hook
|
|
0 commit comments