Skip to content

Commit

Permalink
Add special handling for installing linter in CI
Browse files Browse the repository at this point in the history
Don't download the linter unless a special CI env setting is set. Also
use a different cache to avoid permissions issues with the rootfs in
CI.

Signed-off-by: William Douglas <[email protected]>
  • Loading branch information
bryteise committed Jan 30, 2024
1 parent 2aa8ed1 commit 9fdf6db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,18 @@ checkcoverage:
go test -cover ${GO_PACKAGE_PREFIX}/... -coverprofile=coverage.out
go tool cover -html=coverage.out

.PHONY: llint
llint:
@if [ ! -z "${CI_ONLY}" ]; \
then echo 1; \
fi

.PHONY: lint
lint:
@if ! $(gopath)/bin/golangci-lint --version &>/dev/null; then \
@if [ ! -z "${CI_ONLY}" ]; then \
echo "Installing linters..."; \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(gopath)/bin v1.55.2; \
export GOLANGCI_LINT_CACHE=/tmp/.golangci-lint
fi
@$(gopath)/bin/golangci-lint run --deadline=10m --tests --disable-all \
--enable=misspell \
Expand Down
1 change: 1 addition & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ cd /home/clr/mixer-tools

run_precheck() {
make && sudo -E make install
export CI_ONLY=1
make lint && make check
}

Expand Down

0 comments on commit 9fdf6db

Please sign in to comment.