# HG changeset patch
# User Georges Racinet <georges.racinet@octobus.net>
# Date 1592312778 -7200
#      Tue Jun 16 15:06:18 2020 +0200
# Node ID 49f3e4669fade8e41152c4f72587039ef982542c
# Parent  8d68dd9b3c1d73f9eefdfd76ba2acb29a547c534
heptapod-ci: adaptation to current base images

Using the ci-py-heptapod image is a simple choice to run
tests with the currently supported Mercurial version, obviously
the same as with py-heptapod.

pytest and pytest-cov are now provided by all the base images.

Doing the same initialisation for hg stable and hg default versions
as in py-heptapod.

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,8 +2,9 @@
   - lint
   - test
 
-before_script:
-   - pip3 install --user -r dev-requirements.txt
+variables:
+  EVOLVE_REPO_URL: https://mirror.octobus.net/evolve
+  EVOLVE_LOCAL_REPO: /ci/repos/evolve
 
 lint:
     stage: lint
@@ -12,29 +13,40 @@
     script:
       - flake8 --exclude stub hgitaly
 
-tests-5.2:
+tests-current:
   stage: test
-  image: octobus/ci-py3-hgext3rd:latest
+  image: octobus/ci-py-heptapod:py3
   script:
-    # should have a base image for that
-    - hg -R /ci/repos/mercurial up 5.2.1
-    - make -C /ci/repos/mercurial
-    - PYTHONPATH=/ci/repos/mercurial ~/.local/bin/pytest --cov hgitaly --cov-config=.coveragerc -v
+    - PYTHONPATH=/ci/repos/mercurial /usr/bin/pytest-3 --cov hgitaly --cov-config=.coveragerc -v
 
 tests-hg-stable:
   stage: test
   image: octobus/ci-py3-hgext3rd:latest
   script:
     - hg pull -R /ci/repos/mercurial/ --rev stable
-    - hg -R /ci/repos/mercurial up stable
-    - make -C /ci/repos/mercurial local PYTHON=python3
-    - PYTHONPATH=/ci/repos/mercurial ~/.local/bin/pytest --cov hgitaly --cov-config=.coveragerc -v
+    - hg -R /ci/repos/mercurial/ update stable
+    - hg -R /ci/repos/mercurial summary
+    - (cd /ci/repos/mercurial; make local PYTHON=python3)
+    - hg clone -r stable -u stable $EVOLVE_REPO_URL $EVOLVE_LOCAL_REPO
+    - pip3 install --user $EVOLVE_LOCAL_REPO
+    - pip3 freeze
+    - /ci/repos/mercurial/hg version --debug
+    - PYTHONPATH=/ci/repos/mercurial python3 -c "from mercurial import util; print(util.version())"
+    - PYTHONPATH=/ci/repos/mercurial PATH=$HOME/.local/bin:$PATH
+        pytest --cov hgitaly --cov-config=.coveragerc -v
 
 tests-hg-default:
   stage: test
   image: octobus/ci-py3-hgext3rd:latest
   script:
     - hg pull -R /ci/repos/mercurial/ --rev default
-    - hg -R /ci/repos/mercurial up default
-    - make -C /ci/repos/mercurial local PYTHON=python3
-    - PYTHONPATH=/ci/repos/mercurial ~/.local/bin/pytest --cov hgitaly --cov-config=.coveragerc -v
+    - hg -R /ci/repos/mercurial/ update default
+    - hg -R /ci/repos/mercurial summary
+    - (cd /ci/repos/mercurial; make local PYTHON=python3)
+    - hg clone -r default -u default $EVOLVE_REPO_URL $EVOLVE_LOCAL_REPO
+    - pip3 install --user $EVOLVE_LOCAL_REPO
+    - pip3 freeze
+    - /ci/repos/mercurial/hg version --debug
+    - PYTHONPATH=/ci/repos/mercurial python3 -c "from mercurial import util; print(util.version())"
+    - PYTHONPATH=/ci/repos/mercurial PATH=$HOME/.local/bin:$PATH
+        pytest --cov hgitaly --cov-config=.coveragerc -v