changeset 5371:02804d8bac31

ci: use a script template to pull and update /ci/repos/mercurial/
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 27 Jun 2020 01:33:31 +0800
parents 06b5e43ac29c
children ce5ebd9c859b
files .gitlab-ci.yml
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/.gitlab-ci.yml	Sun Jun 14 00:36:37 2020 +0800
+++ b/.gitlab-ci.yml	Sat Jun 27 01:33:31 2020 +0800
@@ -1,9 +1,12 @@
+.prepare_hg: &prepare_hg
+    - hg pull -R /ci/repos/mercurial/
+    - hg_rev=$(tests/testlib/map-hg-rev.sh "$(hg identify --branch)")
+    - hg -R /ci/repos/mercurial/ update "$hg_rev"
+
 pytype:
     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"
+        - *prepare_hg
         - pytype --version
         - jobs=$(python -c 'import multiprocessing; print multiprocessing.cpu_count()')
         - pytype -P /ci/repos/mercurial/:hgext3rd -k hgext3rd -x hgext3rd/evolve/thirdparty -j $jobs || true
@@ -20,9 +23,7 @@
     before_script:
         - (cd tests; ls -1 test-check-*.t > /tmp/check-tests.txt)
     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"
+        - *prepare_hg
         - ("$PYTHON" --version)
         - (cd tests; set -x; HGMODULEPOLICY="$TEST_HGMODULEPOLICY" "$PYTHON" /ci/repos/mercurial/tests/run-tests.py --color=always $RUNTEST_ARGS)