[meld: 2/4] gitlab-ci: run checks in flatpak environment



commit f5221a4ad78a9f5fec2b2f47c3c68e85a92e7dc5
Author: Vasily Galkin <galkin-vv ya ru>
Date:   Fri Feb 21 03:41:49 2020 +0300

    gitlab-ci: run checks in flatpak environment
    
    This restores CI to green without switching to another docker image.
    The registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
    image disabled root access, so using dnf failed.
    All our non-dev dependencies are present in org.gnome.Sdk flatpak
    and all dev dependencies are python only.
    
    So using on org.gnome.Sdk flatpak + pip3 --user
    is a technically valid option that allows to continue using
    the same runtime image without mantaining meld-specific docker images
    or using images requering manual install of gnome deps.
    
    Also not using dnf at every ci build speeds up the check process.

 .gitlab-ci.yml       | 22 ++++++++++++----------
 dev-requirements.txt |  1 +
 2 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2a13bb83..c98264dd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -34,20 +34,22 @@ nightly:
   dependencies:
     - 'flatpak'
 
-lint:
+.pythonchecks:
   stage: check
+  tags: # test in the same org.gnome.Sdk environment that is used for creating flatpaks
+    - flatpak
   script:
-    - dnf install -y git
-    - pip3 install -r dev-requirements.txt
-    - pre-commit run --all-files --show-diff-on-failure
+    - flatpak run --share=network --filesystem=`pwd` --env=PATH=$PATH:/var/data/python/bin --command=sh 
org.gnome.Sdk -c 'pip3 install --user -r dev-requirements.txt; $PYTHON_CHECK_COMMAND'
+
+lint:
+  extends: .pythonchecks
+  variables:
+      PYTHON_CHECK_COMMAND: "pre-commit run --all-files --show-diff-on-failure"
 
 pytest:
-  stage: check
-  before_script:
-    - dnf update -y
-    - dnf install -y $DEPENDENCIES
-  script:
-    - py.test-3 test/
+  extends: .pythonchecks
+  variables:
+      PYTHON_CHECK_COMMAND: "pytest"
 
 .mingw-common:
   stage: build
diff --git a/dev-requirements.txt b/dev-requirements.txt
index 166923de..4ef1e4af 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -5,3 +5,4 @@ pep8-naming==0.4.1
 pre-commit==1.18.3
 pycodestyle==2.5.0
 pyflakes==2.1.0
+pytest==5.3.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]