[CI] Add a gitlab-ci.yml to run unittests and flake8
authorSimon Chabot <simon.chabot@logilab.fr>
Tue, 01 Oct 2019 10:34:25 +0200
changeset 574 3c94c1911186
parent 573 e9fa03125af8
child 580 91b90f8ed0ab
[CI] Add a gitlab-ci.yml to run unittests and flake8
.gitlab-ci.yml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitlab-ci.yml	Tue Oct 01 10:34:25 2019 +0200
@@ -0,0 +1,45 @@
+image: debian:buster-slim
+
+stages:
+  - test
+
+test_flake8:
+    stage: test
+    # When heptapode clones the repository, the update is done on the default
+    # branch, but we want to go on the current topic, which is available in the
+    # $CI_COMMIT_REF_NAME variable. Let's go there :)
+    before_script:
+        - apt-get update && apt install -y gnupg wget
+        - wget https://apt.logilab.fr/key.asc -O - |
+          apt-key --keyring /etc/apt/trusted.gpg.d/logilab.gpg add -
+        - echo "deb http://apt.logilab.fr buster-backports main" >
+          /etc/apt/sources.list.d/logilab.list
+        - apt-get update &&
+          apt-get -t buster-backports install -y mercurial mercurial-evolve
+        - cd nazca
+        - hg --config "extensions.topic=" up -r ${CI_COMMIT_REF_NAME##*/}
+        - hg id  # make sure we are on the appropriate commit
+        - cd ../
+
+    script:
+        - apt-get update && apt-get install -y tox
+        - tox -e flake8
+
+test_py3:
+    stage: test
+    before_script:
+        - apt-get update && apt install -y gnupg wget
+        - wget https://apt.logilab.fr/key.asc -O - |
+          apt-key --keyring /etc/apt/trusted.gpg.d/logilab.gpg add -
+        - echo "deb http://apt.logilab.fr buster-backports main" >
+          /etc/apt/sources.list.d/logilab.list
+        - apt-get update &&
+          apt-get -t buster-backports install -y mercurial mercurial-evolve
+        - cd nazca
+        - hg --config "extensions.topic=" up -r ${CI_COMMIT_REF_NAME##*/}
+        - hg id
+        - cd ../
+
+    script:
+        - apt-get update && apt-get install -y tox gcc python3-dev
+        - tox -e py3