Use tox for testing inside a container #1884
|
@ -1,61 +1,35 @@
|
||||||
FROM ubuntu:bionic AS base
|
FROM ubuntu:bionic
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
ENV TRAVIS_SKIP_APT_UPDATE 1
|
|
||||||
|
|
||||||
ENV LANG en_US.UTF-8
|
|
||||||
ENV LANGUAGE en_US:en
|
|
||||||
ENV LC_ALL en_US.UTF-8
|
|
||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
|
|
||||||
RUN apt-get install -yq --no-install-suggests --no-install-recommends \
|
RUN apt-get install -yq --no-install-suggests --no-install-recommends \
|
||||||
software-properties-common
|
software-properties-common
|
||||||
|
|
||||||
RUN dpkg --add-architecture i386
|
# RUN dpkg --add-architecture i386
|
||||||
|
|
||||||
RUN add-apt-repository ppa:deadsnakes/ppa
|
|
||||||
|
|
||||||
RUN apt-get -y install sudo
|
|
||||||
|
|
||||||
RUN apt-get install -yq --no-install-suggests --no-install-recommends \
|
RUN apt-get install -yq --no-install-suggests --no-install-recommends \
|
||||||
# travis xenial bionic
|
# General build depends for xenial and bionic
|
||||||
python-setuptools libssl-dev libpq-dev python-prctl python-dev \
|
build-essential libcap-dev libssl-dev python-all-dev python-setuptools \
|
||||||
python-dev python-virtualenv python-pip virtualenv \
|
|
||||||
# dpkg
|
|
||||||
python-minimal python-setuptools python-all python openssl libssl-dev \
|
|
||||||
dh-apparmor debhelper dh-python python-msgpack python-qt4 python-stdeb \
|
|
||||||
python-all-dev python-crypto python-psutil \
|
|
||||||
fakeroot python-pytest \
|
|
||||||
# Code quality
|
|
||||||
pylint python-pycodestyle python3-pycodestyle pycodestyle python-flake8 \
|
|
||||||
python3-flake8 flake8 python-pyflakes python3-pyflakes pyflakes pyflakes3 \
|
|
||||||
curl \
|
|
||||||
# Wine
|
|
||||||
python python-pip wget wine-stable winetricks mingw-w64 wine32 wine64 xvfb \
|
|
||||||
# Buildbot
|
# Buildbot
|
||||||
python3-dev libffi-dev python3-setuptools \
|
libffi-dev python3-dev python3-pip python3.8 python3.8-dev python3.8-venv \
|
||||||
python3-pip \
|
# Testing environment
|
||||||
# python 3.7
|
language-pack-en \
|
||||||
python3.7 python3.7-dev \
|
python-pip qtbase5-dev qt5-default tor xvfb \
|
||||||
# .travis.yml
|
# stdeb
|
||||||
build-essential libcap-dev tor \
|
debhelper dh-apparmor dh-python fakeroot wget \
|
||||||
language-pack-en
|
python-msgpack python-qt4 python-six
|
||||||
|
# Wine
|
||||||
|
# wine-stable winetricks mingw-w64 wine32 wine64
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
RUN rm -rf /var/lib/apt/lists/*
|
RUN rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
#####################################################################################################
|
|
||||||
|
|
||||||
FROM base AS travis
|
|
||||||
|
|
||||||
# travis2bash
|
|
||||||
RUN wget -O /usr/local/bin/travis2bash.sh https://git.bitmessage.org/Bitmessage/buildbot-scripts/raw/branch/master/travis2bash.sh
|
|
||||||
RUN chmod +x /usr/local/bin/travis2bash.sh
|
|
||||||
|
|
||||||
RUN useradd -m -U builder
|
RUN useradd -m -U builder
|
||||||
RUN echo 'builder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
|
||||||
|
RUN python3.8 -m pip install setuptools wheel
|
||||||
|
RUN python3.8 -m pip install --upgrade pip tox virtualenv
|
||||||
|
|
||||||
# copy sources
|
# copy sources
|
||||||
COPY . /home/builder/src
|
COPY . /home/builder/src
|
||||||
|
@ -63,25 +37,10 @@ RUN chown -R builder.builder /home/builder/src
|
||||||
|
|
||||||
USER builder
|
USER builder
|
||||||
|
|
||||||
|
ENV LANG en_US.UTF-8
|
||||||
|
ENV LANGUAGE en_US:en
|
||||||
|
ENV LC_ALL en_US.UTF-8
|
||||||
|
|
||||||
WORKDIR /home/builder/src
|
WORKDIR /home/builder/src
|
||||||
|
|
||||||
ENTRYPOINT /usr/local/bin/travis2bash.sh
|
CMD ["tox"]
|
||||||
|
|
||||||
#####################################################################################################
|
|
||||||
|
|
||||||
FROM base AS buildbot
|
|
||||||
|
|
||||||
# travis2bash
|
|
||||||
RUN wget -O /usr/local/bin/travis2bash.sh https://git.bitmessage.org/Bitmessage/buildbot-scripts/raw/branch/master/travis2bash.sh
|
|
||||||
RUN chmod +x /usr/local/bin/travis2bash.sh
|
|
||||||
|
|
||||||
# copy entrypoint
|
|
||||||
COPY packages/docker/buildbot-entrypoint.sh entrypoint.sh
|
|
||||||
RUN chmod +x entrypoint.sh
|
|
||||||
|
|
||||||
RUN useradd -m -U buildbot
|
|
||||||
RUN echo 'buildbot ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
|
||||||
|
|
||||||
USER buildbot
|
|
||||||
|
|
||||||
ENTRYPOINT /entrypoint.sh "$BUILDMASTER" "$WORKERNAME" "$WORKERPASS"
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
docker build --target travis -t pybm -f packages/docker/Dockerfile.bionic .
|
docker build -t pybm-test -f packages/docker/Dockerfile.bionic .
|
||||||
docker run pybm
|
docker run --rm -t pybm-test
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ max-line-length = 119
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 119
|
max-line-length = 119
|
||||||
|
exclude = bitmessagecli.py,bitmessagecurses,bitmessageqt,tests,umsgpack
|
||||||
ignore = E722,F841,W503
|
ignore = E722,F841,W503
|
||||||
# E722: pylint is preferred for bare-except
|
# E722: pylint is preferred for bare-except
|
||||||
# F841: pylint is preferred for unused-variable
|
# F841: pylint is preferred for unused-variable
|
||||||
|
|
12
tox.ini
12
tox.ini
|
@ -23,8 +23,16 @@ skip_install = true
|
||||||
commands = python pybitmessage/bitmessagemain.py -t
|
commands = python pybitmessage/bitmessagemain.py -t
|
||||||
|
|
||||||
[testenv:reset]
|
[testenv:reset]
|
||||||
deps = coverage
|
deps =
|
||||||
commands = coverage erase
|
coverage
|
||||||
|
bandit
|
||||||
|
flake8
|
||||||
|
commands =
|
||||||
|
coverage erase
|
||||||
|
bandit -r --exit-zero -s B105,B301,B411,B413,B608 \
|
||||||
|
-x checkdeps.*,bitmessagecurses,bitmessageqt,tests pybitmessage
|
||||||
|
flake8 pybitmessage --count --select=E9,F63,F7,F82 \
|
||||||
|
--show-source --statistics
|
||||||
|
|
||||||
[testenv:stats]
|
[testenv:stats]
|
||||||
deps = coverage
|
deps = coverage
|
||||||
|
|
Reference in New Issue
Block a user