Skip to content

Commit

Permalink
cleanup makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
neolynx committed Oct 6, 2024
1 parent 60df287 commit 8478986
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 67 deletions.
43 changes: 25 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,28 @@ swagger-install:
# Install swag
@test -f $(BINPATH)/swag || go install github.com/swaggo/swag/cmd/swag@latest
# Create docs/swagger.conf
@cp docs/swagger.conf.tpl docs/swagger.conf
@echo "// @version $(VERSION)" >> docs/swagger.conf
cp docs/swagger.conf.tpl docs/swagger.conf
echo "// @version $(VERSION)" >> docs/swagger.conf

swagger: swagger-install
# Generating swagger docs
@PATH=$(BINPATH)/:$(PATH) swag init -q --markdownFiles docs --generalInfo docs/swagger.conf
@PATH=$(BINPATH)/:$(PATH) swag init --markdownFiles docs --generalInfo docs/swagger.conf
# GOOS=linux GOARCH=amd64 go install github.com/swaggo/swag/cmd/swag@latest

etcd-install:
# Install etcd
test -d /srv/etcd || system/t13_etcd/install-etcd.sh

flake8: ## run flake8 on system test python files
flake8 system/

lint:
# Install golangci-lint
go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
# Running lint
@PATH=$(BINPATH)/:$(PATH) golangci-lint run


build: prepare swagger ## Build aptly
go build -o build/aptly

Expand All @@ -65,13 +79,6 @@ install:
go generate
@out=`mktemp`; if ! go install -v > $$out 2>&1; then cat $$out; rm -f $$out; echo "\nBuild failed\n"; exit 1; else rm -f $$out; fi

etcd-install:
# install etcd
test -d /srv/etcd || system/t13_etcd/install-etcd.sh

flake8: ## run flake8 on system test python files
flake8 system/

test: prepare swagger etcd-install ## Run unit tests
@echo "\e[33m\e[1mStarting etcd ...\e[0m"
@mkdir -p /tmp/etcd-data; system/t13_etcd/start-etcd.sh > /tmp/etcd-data/etcd.log 2>&1 &
Expand Down Expand Up @@ -145,28 +152,28 @@ docker-image: ## Build aptly-dev docker image
@docker build -f system/Dockerfile . -t aptly-dev

docker-build: ## Build aptly in docker container
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/run-aptly-cmd make build
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper build

docker-shell: ## Run aptly and other commands in docker container
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/run-aptly-cmd
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper || true

docker-deb: ## Build debian packages in docker container
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/build-deb
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper dpkg

docker-unit-tests: ## Run unit tests in docker container
@docker run -it --rm -v ${PWD}:/app aptly-dev /app/system/run-unit-tests
docker-unit-test: ## Run unit tests in docker container
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper test

docker-system-tests: ## Run system tests in docker container (add TEST=t04_mirror or TEST=UpdateMirror26Test to run only specific tests)
docker-system-test: ## Run system tests in docker container (add TEST=t04_mirror or TEST=UpdateMirror26Test to run only specific tests)
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper system-test $(TEST)

docker-server: ## Run development server (auto recompiling) on http://localhost:3142
@docker run -it --rm -p 3142:3142 -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper server

docker-lint: ## Run golangci-lint in docker container
@docker run -it --rm -v ${PWD}:/app -e GOLANGCI_LINT_VERSION=$(GOLANGCI_LINT_VERSION) aptly-dev /app/system/run-golangci-lint
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper lint

docker-binaries: ## Build binary releases (FreeBSD, MacOS, Linux tar) in docker container
@docker run -it --rm -v ${PWD}:/app aptly-dev /app/system/build-binaries
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper binaries

mem.png: mem.dat mem.gp
gnuplot mem.gp
Expand Down
9 changes: 0 additions & 9 deletions system/build-binaries

This file was deleted.

8 changes: 5 additions & 3 deletions system/docker-wrapper
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/sh -e

# make sure files are written with correct user ownership
usermod -u `stat -c %u /work/src` aptly >/dev/null
chown -R `stat -c %u /work/src` /var/lib/aptly

if [ -z "$@" ]; then
echo Error: no make target specified
exit 1
cmd="bash"
else
cmd="make $@"
fi

cd /work/src
su aptly -c "GOPATH=$PWD/.go make $@"
sudo -u aptly GOPATH=/work/src/.go $cmd
10 changes: 0 additions & 10 deletions system/run-aptly-cmd

This file was deleted.

6 changes: 0 additions & 6 deletions system/run-golangci-lint

This file was deleted.

10 changes: 0 additions & 10 deletions system/run-system-tests

This file was deleted.

11 changes: 0 additions & 11 deletions system/run-unit-tests

This file was deleted.

0 comments on commit 8478986

Please sign in to comment.