diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf273e1..7791786 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v2 - name: Lint - run: make lint + run: DOCKER_BUILDKIT=1 make lint - name: Build run: make build diff --git a/Makefile b/Makefile index 7364ee1..c2abfc0 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ .DEFAULT_GOAL := help PACKAGE=github.com/compose-spec/compose-ref +IMAGE_PREFIX=composespec/compose-ref- GOFLAGS=-mod=vendor @@ -16,9 +17,13 @@ test: ## Run tests fmt: ## Format go files @goimports -e -w ./ +.PHONY: build-validate-image +build-validate-image: + docker build . -f ci/Dockerfile -t $(IMAGE_PREFIX)validate + .PHONY: lint -lint: ## Verify Go files - golangci-lint run --config ./golangci.yml ./ +lint: build-validate-image + docker run --rm $(IMAGE_PREFIX)validate bash -c "golangci-lint run --config ./golangci.yml ./" .PHONY: setup setup: ## Setup the precommit hook diff --git a/ci/Dockerfile b/ci/Dockerfile new file mode 100644 index 0000000..cfc9652 --- /dev/null +++ b/ci/Dockerfile @@ -0,0 +1,9 @@ +FROM golang:1.14 + +WORKDIR /go/src + +ARG GOLANGCILINT_VERSION=v1.24.0 +RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCILINT_VERSION} + +ENV GOFLAGS=-mod=vendor +COPY . .