[tor-commits] [sbws/maint-1.1] fix: CI: Add .gitlab-ci.yml to run tests in Gitlab

juga at torproject.org juga at torproject.org
Wed Jul 22 14:50:20 UTC 2020


commit 8f633943f07ed71982cc95279fe1410012bafbeb
Author: juga0 <juga at riseup.net>
Date:   Wed Jul 15 09:25:33 2020 +0000

    fix: CI: Add .gitlab-ci.yml to run tests in Gitlab
    
    Closes: #40007
---
 .gitlab-ci.yml | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tox.ini        |   8 ++--
 2 files changed, 120 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..9b4fe40
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,115 @@
+variables:
+    BASE_IMAGE: python:3.7
+    RELEASE: tor-nightly-master-buster
+    # Without version, the default available in the Debian repository will be
+    # installed.
+    # Specifying which version starts with will install the highest that start
+    # with that version.
+    TOR: tor=*
+    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
+
+cache:
+  paths:
+    - .cache/pip
+
+image: $BASE_IMAGE
+
+before_script:
+  - "wget https://deb.torproject.org/torproject.org/\
+    A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc"
+  - cat A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc  | apt-key add -
+  - echo deb [signed-by=A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89]
+    http://deb.torproject.org/torproject.org $RELEASE
+    main >> /etc/apt/sources.list
+  - apt update -yqq
+  - apt install -yqq $TOR
+  - pip install tox
+  - python --version
+  - tor --version
+
+after_script:
+  - tox -e stats
+
+python36tor035:
+  variables:
+    BASE_IMAGE: python:3.6
+    RELEASE: tor-nightly-0.3.5.x-buster
+    TOR: tor=0.3.5*
+  image: $BASE_IMAGE
+  script:
+    - tox -e py36
+    - tox -e integration
+
+python36tor041:
+  variables:
+    BASE_IMAGE: python:3.6
+    RELEASE: tor-nightly-0.4.1.x-buster
+    TOR: tor=0.4.1*
+  image: $BASE_IMAGE
+  script:
+  - tox -e py36
+  - tox -e integration
+
+python36tor042:
+  variables:
+    BASE_IMAGE: python:3.6
+    RELEASE: tor-nightly-0.4.2.x-buster
+    TOR: tor=0.4.2*
+  image: $BASE_IMAGE
+  script:
+  - tox -e py36
+  - tox -e integration
+
+python36torstable:
+  variables:
+    BASE_IMAGE: python:3.6
+    RELEASE: buster
+    TOR: tor
+  image: $BASE_IMAGE
+  script:
+  - tox -e py36
+  - tox -e integration
+
+python37:
+  # This will overwrite the default before_script, so need to repeat the
+  # commands
+  before_script:
+    - "wget https://deb.torproject.org/torproject.org/\
+      A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc"
+    - cat A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc  | apt-key add -
+    - echo deb [signed-by=A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89]
+      http://deb.torproject.org/torproject.org $RELEASE
+      main >> /etc/apt/sources.list
+    - apt update -yqq
+    - apt install -yqq $TOR
+    - pip install tox
+    - python --version
+    - tor --version
+    # To build the docs
+    - apt install -yqq texlive-latex-extra
+    - apt install -yqq dvipng
+  image: $BASE_IMAGE
+  script:
+  - tox -e inst
+  - tox -e setup
+  - tox -e py37
+  - tox -e integration
+  - tox -e lint
+  - tox -e doc
+
+python38:
+  variables:
+    BASE_IMAGE: python:3.8
+  image: $BASE_IMAGE
+  script:
+  - tox -e py38
+  - tox -e integration
+
+python39:
+  variables:
+    BASE_IMAGE: python:3.9-rc-buster
+  image: $BASE_IMAGE
+  script:
+  - tox -e py39
+  - tox -e integration
+  allow_failure: true
diff --git a/tox.ini b/tox.ini
index f9d712f..f0aadaf 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
 [tox]
 skip_missing_interpreters = True
-envlist = py{36, 37, 38, 39, nightly}, inst, setup, unit, integration, lint, stats, doc
+envlist = py{36, 37, 38, 39}, inst, setup, integration, lint, stats, doc
 
 [travis]
 python =
@@ -10,7 +10,7 @@ python =
     3.9-dev: py39, inst, setup, unit, integration, lint, doc
     nightly: pynightly, inst, setup, unit, integration, lint, doc
 
-[testenv]
+; [testenv]
 # install_command can be removed when --process-dependency-links is not
 # needed anymore, and this section commented
 # install_command = pip install {opts} {packages}
@@ -32,7 +32,7 @@ skip_install = True
 commands = python setup.py install
 recreate = True
 
-[testenv:unit]
+[testenv]
 deps = .[test]
 commands =
     coverage run -a --rcfile={toxinidir}/.coveragerc --source=sbws -m pytest \
@@ -49,6 +49,8 @@ whitelist_externals =
     mkdir
     rm
 commands =
+    # For some reason .[test] is not copying config.* files
+    pip install .
     cp -af {toxinidir}/tests/integration/net {envtmpdir}
     bash {envtmpdir}/net/start.sh
     bash -c "time python3 {envtmpdir}/net/wait.py {envtmpdir}/net/{auth,relay,exit}*"





More information about the tor-commits mailing list