mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
docker-lint: use go 1.19 compatible golangci-lint version
- use same user in docker container - use GOPATH in source dir to prevent downloading all dependencies on each run - add make clean
This commit is contained in:
2
.github/workflows/golangci-lint.yml
vendored
2
.github/workflows/golangci-lint.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
||||
# Require: The version of golangci-lint to use.
|
||||
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
|
||||
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
|
||||
version: v1.56.2
|
||||
version: v1.54.1
|
||||
|
||||
# Optional: working directory, useful for monorepos
|
||||
# working-directory: somedir
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -50,3 +50,5 @@ pgp/keyrings/aptly2*.gpg~
|
||||
pgp/keyrings/.#*
|
||||
|
||||
*.creds
|
||||
|
||||
.go/
|
||||
|
||||
12
Makefile
12
Makefile
@@ -7,7 +7,7 @@ PYTHON?=python3
|
||||
TESTS?=
|
||||
BINPATH?=$(GOPATH)/bin
|
||||
RUN_LONG_TESTS?=yes
|
||||
GOLANGCI_LINT_VERSION=v1.56.2
|
||||
GOLANGCI_LINT_VERSION=v1.54.1 # version supporting go 1.19
|
||||
COVERAGE_DIR?=$(shell mktemp -d)
|
||||
# Uncomment to update test outputs
|
||||
# CAPTURE := "--capture"
|
||||
@@ -128,9 +128,13 @@ docker-system-tests: ## Run system tests in docker container (add TEST=t04_mirr
|
||||
@docker run -it --rm -v ${PWD}:/app aptly-dev /app/system/run-system-tests $(TEST)
|
||||
|
||||
docker-lint: ## Run golangci-lint in docker container
|
||||
@docker run -it --rm -v ~/.cache/golangci-lint/$(GOLANGCI_LINT_VERSION):/root/.cache -v ${PWD}:/app -w /app golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) sh -c "go mod tidy; go generate; golangci-lint run"
|
||||
@docker run -it --rm -v ${PWD}:/app -e GOLANGCI_LINT_VERSION=$(GOLANGCI_LINT_VERSION) aptly-dev /app/system/run-golangci-lint
|
||||
|
||||
flake8:
|
||||
flake8: ## run flak8 on system tests
|
||||
flake8 system
|
||||
|
||||
.PHONY: help man modules version release goxc docker-build-aptly-dev docker-system-tests docker-unit-tests docker-lint docker-build build docker-aptly
|
||||
clean: ## remove local build and module cache
|
||||
test -f .go/ && chmod u+w -R .go/; rm -rf .go/
|
||||
rm -rf build/
|
||||
|
||||
.PHONY: help man modules version release goxc docker-build-aptly-dev docker-system-tests docker-unit-tests docker-lint docker-build build docker-aptly clean
|
||||
|
||||
17
system/run-golangci-lint
Executable file
17
system/run-golangci-lint
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
# cleanup
|
||||
rm -rf /app/tmp
|
||||
rm -rf /tmp/aptly*
|
||||
|
||||
usermod -u `stat -c %u /app` aptly >/dev/null
|
||||
chown -R `stat -c %u /app` /var/lib/aptly
|
||||
|
||||
# use same /home/runner dir as in github workflow
|
||||
chown -R `stat -c %u /app` /home/runner
|
||||
|
||||
cmd=$@
|
||||
if [ -z "$cmd" ]; then
|
||||
cmd="bash"
|
||||
fi
|
||||
su aptly -c "cd /app; GOPATH=/app/.go go install github.com/golangci/golangci-lint/cmd/golangci-lint@$GOLANGCI_LINT_VERSION; PATH=\$PATH:/app/.go/bin golangci-lint run"
|
||||
Reference in New Issue
Block a user