changeset 5341:efb8ae4419b2

ci: use a template + variables for defining tests
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 22 May 2020 08:39:51 +0800
parents 995ed7aac8a6
children 4a958a7bb138
files .gitlab-ci.yml
diffstat 1 files changed, 24 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/.gitlab-ci.yml	Sun May 24 13:43:53 2020 +0800
+++ b/.gitlab-ci.yml	Fri May 22 08:39:51 2020 +0800
@@ -13,37 +13,39 @@
         - pytype -P /ci/repos/mercurial/:hgext3rd -k hgext3rd -x hgext3rd/evolve/thirdparty -j $jobs || true
     when: manual
 
-tests-py2-cext:
-    image: octobus/ci-py2-hgext3rd
-    script:
-        - hg pull -R /ci/repos/mercurial/
-        - hg_rev=$(tests/testlib/map-hg-rev.sh "$(hg log -r . -T '{branch}')")
-        - hg -R /ci/repos/mercurial/ update "$hg_rev"
-        - (cd tests; /ci/repos/mercurial/tests/run-tests.py --color=always)
+variables:
+    PY: py2
+    PYTHON: python
+    RUNTEST_ARGS: ""
 
-tests-py2-pure:
-    image: octobus/ci-py2-hgext3rd
+.runtests_template: &runtests
+    image: octobus/ci-$PY-hgext3rd
     script:
         - hg pull -R /ci/repos/mercurial/
         - hg_rev=$(tests/testlib/map-hg-rev.sh "$(hg log -r . -T '{branch}')")
         - hg -R /ci/repos/mercurial/ update "$hg_rev"
-        - (cd tests; /ci/repos/mercurial/tests/run-tests.py --color=always --pure)
+        - (cd tests; "$PYTHON" /ci/repos/mercurial/tests/run-tests.py --color=always $RUNTEST_ARGS)
+
+tests-py2-cext:
+    <<: *runtests
+
+tests-py2-pure:
+    <<: *runtests
+    variables:
+        RUNTEST_ARGS: "--pure"
 
 tests-py3-cext:
-    image: octobus/ci-py3-hgext3rd
-    script:
-        - hg pull -R /ci/repos/mercurial/
-        - hg_rev=$(tests/testlib/map-hg-rev.sh "$(hg log -r . -T '{branch}')")
-        - hg -R /ci/repos/mercurial/ update "$hg_rev"
-        - (cd tests; python3 /ci/repos/mercurial/tests/run-tests.py --color=always)
+    <<: *runtests
+    variables:
+        PY: py3
+        PYTHON: python3
 
 tests-py3-pure:
-    image: octobus/ci-py3-hgext3rd
-    script:
-        - hg pull -R /ci/repos/mercurial/
-        - hg_rev=$(tests/testlib/map-hg-rev.sh "$(hg log -r . -T '{branch}')")
-        - hg -R /ci/repos/mercurial/ update "$hg_rev"
-        - (cd tests; python3 /ci/repos/mercurial/tests/run-tests.py --color=always --pure)
+    <<: *runtests
+    variables:
+        PY: py3
+        PYTHON: python3
+        RUNTEST_ARGS: "--pure"
 
 doc:
     image: octobus/ci-py2-evolve-doc