Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Commit

Permalink
Containerize lint
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Crone <[email protected]>
  • Loading branch information
chris-crone committed Mar 18, 2020
1 parent ce0b659 commit 1a1f0c1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DEFAULT_GOAL := help

PACKAGE=github.com/compose-spec/compose-ref
IMAGE_PREFIX=composespec/compose-ref-

GOFLAGS=-mod=vendor

Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 . .

0 comments on commit 1a1f0c1

Please sign in to comment.