improve Makefile

- simplify Makefile
- improve devserver
- improve make clean
This commit is contained in:
André Roth
2024-10-04 01:12:12 +02:00
parent 4658bec08b
commit 98c82a3684
13 changed files with 116 additions and 184 deletions
+5 -5
View File
@@ -4,22 +4,22 @@ RUN echo deb http://deb.debian.org/debian bookworm-backports main > /etc/apt/sou
RUN apt-get update -y && apt-get install -y --no-install-recommends curl gnupg apg bzip2 xz-utils ca-certificates \
golang/bookworm-backports golang-go/bookworm-backports golang-doc/bookworm-backports golang-src/bookworm-backports \
make git python3 python3-requests-unixsocket python3-termcolor python3-swiftclient python3-boto python3-azure-storage g++ python3-etcd3 python3-plyvel graphviz devscripts sudo dh-golang binutils-i686-linux-gnu binutils-aarch64-linux-gnu binutils-arm-linux-gnueabihf bash-completion zip && \
make git python3 python3-requests-unixsocket python3-termcolor python3-swiftclient python3-boto python3-azure-storage \
g++ python3-etcd3 python3-plyvel graphviz devscripts sudo dh-golang binutils-i686-linux-gnu binutils-aarch64-linux-gnu \
binutils-arm-linux-gnueabihf bash-completion zip ruby3.1-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN useradd -m --shell /bin/sh --home-dir /var/lib/aptly aptly
RUN sed -i 's/#force_color_prompt=yes/force_color_prompt=yes/' /var/lib/aptly/.bashrc
RUN mkdir /work
WORKDIR /work
WORKDIR /work/src
RUN chown aptly /work
RUN cd /var/lib/aptly; git clone https://github.com/aptly-dev/aptly-fixture-db.git
RUN cd /var/lib/aptly; git clone https://github.com/aptly-dev/aptly-fixture-pool.git
RUN cd /var/lib/aptly; curl -O http://repo.aptly.info/system-tests/etcd.db.xz; xz -d etcd.db.xz
RUN cd /var/lib/aptly; curl -O http://repo.aptly.info/system-tests/etcd.db.xz && xz -d etcd.db.xz
RUN echo "aptly ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/aptly
ADD system/t13_etcd/install-etcd.sh /src/
RUN /src/install-etcd.sh
RUN rm -rf /src
CMD /app/system/run-system-tests
-9
View File
@@ -1,9 +0,0 @@
#!/bin/sh
# cleanup
rm -rf /app/build/tmp
usermod -u `stat -c %u /app` aptly >/dev/null
chown -R `stat -c %u /app` /var/lib/aptly
su - aptly -c "cd /app; export GOPATH=/app/.go; make binaries"
+1 -1
View File
@@ -7,7 +7,7 @@ su aptly -c 'set -e; cd /work/src;
GOPATH=$PWD/.go go generate -v
# install and initialize swagger
GOPATH=$PWD/.go go install github.com/swaggo/swag/cmd/swag@latest
PATH=$PWD/.go/bin:$PATH swag init
PATH=$PWD/.go/bin:$PATH swag init -q --markdownFiles docs
git checkout debian/changelog
DEBEMAIL="CI <runner@github>" dch -v `make version` "CI build"
dpkg-buildpackage -us -uc -b -d
+7 -4
View File
@@ -1,12 +1,15 @@
#!/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
args="$@"
if [ -z "$args" ]; then
cmd="bash"
else
cmd="make $@"
fi
cd /work/src
su aptly -c "GOPATH=$PWD/.go make $@"
sudo -u aptly PATH=$PATH:/work/src/build GOPATH=/work/src/.go $cmd
-10
View File
@@ -1,10 +0,0 @@
#!/bin/sh
cmd=$@
test -z "$cmd" && cmd="bash"
usermod -u `stat -c %u /work/src` aptly >/dev/null
chown -R `stat -c %u /work/src` /var/lib/aptly
cd /work/src
exec sudo -u aptly PATH=$PATH:/work/src/build GOPATH=/work/src/.go $cmd
-6
View File
@@ -1,6 +0,0 @@
#!/bin/sh -e
usermod -u `stat -c %u /app` aptly >/dev/null
chown -R `stat -c %u /app` /var/lib/aptly
su aptly -c "set -e; cd /app; export GOPATH=/app/.go; go install github.com/golangci/golangci-lint/cmd/golangci-lint@$GOLANGCI_LINT_VERSION; PATH=\$PATH:/app/.go/bin golangci-lint run"
-10
View File
@@ -1,10 +0,0 @@
#!/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
su - aptly -c "cd /app; export GOPATH=/app/.go; make docker-test TEST=$@"
-11
View File
@@ -1,11 +0,0 @@
#!/bin/sh
# cleanup
rm -rf /app/tmp
rm -rf /tmp/aptly*
mkdir -p /srv
usermod -u `stat -c %u /app` aptly >/dev/null
chown -R `stat -c %u /app` /var/lib/aptly /srv
su - aptly -c "cd /app; export export GOPATH=/app/.go; go mod tidy; make test"
+4 -6
View File
@@ -184,12 +184,10 @@ def run(include_long_tests=False, capture_results=False, tests=None, filters=Non
if __name__ == "__main__":
if 'APTLY_VERSION' not in os.environ:
try:
os.environ['APTLY_VERSION'] = os.popen(
"make version").read().strip()
except BaseException as e:
print("Failed to capture current version: ", e)
try:
os.environ['APTLY_VERSION'] = os.popen("make -s version").read().strip()
except BaseException as e:
print("Failed to capture current version: ", e)
if sys.version_info < PYTHON_MINIMUM_VERSION:
raise RuntimeError(f'Tests require Python {PYTHON_MINIMUM_VERSION} or higher.')