view .gitlab-ci.yml @ 6847:f0a052aa924d

ci: run tests-py3 jobs on v2.0 images We can't use v1.0 images because they still have Python 3.7. Let's switch to using pip to install the extensions to avoid a SetuptoolsDeprecationWarning about running setup.py directly. This also avoid the warning about python_requires apparently. The "running as root" warning cannot be simply avoided by using a different CI image. We do have v2.1 images that default to ci-runner user, but no one forbids people from running the test locally as a root user, one way or another. Running pip as root shouldn't matter in this case, since it's not a real system install, so this particular warning is always irrelevant.
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 12 Sep 2024 16:41:22 +0400
parents 83a8122cfd8c
children 120f0ad4646c
line wrap: on
line source

.prepare_hg: &prepare_hg
    - hg pull -R /ci/repos/mercurial/ https://repo.mercurial-scm.org/hg
    - hg_branch=${HG_BRANCH:-$(tests/testlib/map-hg-rev.sh "$(hg identify --branch)")}
    - hg -R /ci/repos/mercurial/ update "$hg_branch"
    - hg_rev=$(hg log -R /ci/repos/mercurial/ -r . -T '{node}')
    - echo testing with mercurial branch="$hg_branch", revision="$hg_rev"

pytype:
    image: registry.heptapod.net/mercurial/ci-images/py3-hgext3rd:v2.0
    script:
        - *prepare_hg
        - hg clone /ci/repos/mercurial/ /tmp/mercurial-ci/ --noupdate --config phases.publish=no
        - hg -R /tmp/mercurial-ci/ update "$hg_rev"
        - make -C /tmp/mercurial-ci/ local PYTHON=$PYTHON
        - $PYTHON -m pip install --user --break-system-packages --upgrade pytype==2024.1.5
        - (cd /tmp/mercurial-ci/ && ./contrib/setup-pytype.sh)
        - pytype --version
        - pytype --keep-going --jobs auto -P /tmp/mercurial-ci/:hgext3rd hgext3rd
    when: manual

variables:
    PYTHON: python3
    RUNTEST_ARGS: ""
    TEST_HGMODULEPOLICY: "allow"

.runtests_template: &runtests
    image: registry.heptapod.net/mercurial/ci-images/py3-hgext3rd:v2.0
    before_script:
        - (cd tests; ls -1 test-check-*.t > /tmp/check-tests.txt)
    script:
        - *prepare_hg
        - ($PYTHON --version)
        - (cd tests; set -x; HGMODULEPOLICY="$TEST_HGMODULEPOLICY" $PYTHON /ci/repos/mercurial/tests/run-tests.py --color=always $RUNTEST_ARGS)

checks-py3:
    <<: *runtests
    image: registry.heptapod.net/mercurial/ci-images/py3-hgext3rd:v2.0
    variables:
        RUNTEST_ARGS: "--test-list /tmp/check-tests.txt"
        CI_CLEVER_CLOUD_FLAVOR: S

tests-py3-cext:
    <<: *runtests
    variables:
        RUNTEST_ARGS: "--no-rust --blacklist /tmp/check-tests.txt"
        TEST_HGMODULEPOLICY: "c"

tests-py3-pure:
    <<: *runtests
    variables:
        RUNTEST_ARGS: "--pure --blacklist /tmp/check-tests.txt"
        TEST_HGMODULEPOLICY: "py"

tests-py2-6.1:
    <<: *runtests
    image: registry.heptapod.net/mercurial/ci-images/py2-hgext3rd:v1.0
    variables:
        PYTHON: prlimit --nofile=1024:1024 python2
        RUNTEST_ARGS: "--no-rust --blacklist /tmp/check-tests.txt"
        TEST_HGMODULEPOLICY: "c"
        HG_BRANCH: 'max(tag("re:^6\.1"))'
    allow_failure: true

doc:
    image: registry.heptapod.net/mercurial/ci-images/py3-evolve-doc:v2.0
    script:
        - make doc
    variables:
        LANG: en_US.UTF-8
        PYTHONPATH: "/ci/repos/mercurial:$PYTHONPATH"
        CI_CLEVER_CLOUD_FLAVOR: S
    artifacts:
        paths:
            - html/*

sdist:
    stage: .post
    image: registry.heptapod.net/mercurial/ci-images/py3-hgext3rd
    script:
        - python3 setup.py sdist
    artifacts:
        paths:
            - dist/*
    only:
        - tags

.windows_runtests_template: &windows_runtests
    before_script:
        - C:/MinGW/msys/1.0/bin/sh.exe --login -c 'cd "$OLDPWD" && ls -1 tests/test-check-*.t > C:/Temp/check-tests.txt'
    script:
        - C:/MinGW/msys/1.0/bin/sh.exe --login -c 'cd "$OLDPWD" && tests/testlib/update-hg-repo.sh C:/Temp/hg'
        - >
          C:/MinGW/msys/1.0/bin/sh.exe --login -c '
          cd "$OLDPWD" &&
          evo_branch=$(hg identify --branch) &&
          hg_branch=${HG_BRANCH:-$(tests/testlib/map-hg-rev.sh "$evo_branch")} &&
          hg -R C:/Temp/hg update "$hg_branch" &&
          hg_rev=$(hg log -R C:/Temp/hg -r . -T "\{node\}") &&
          echo testing with mercurial branch="$hg_branch", revision="$hg_rev"'
        - Invoke-Expression "$Env:PYTHON --version"
        - echo "$Env:RUNTEST_ARGS"
        - C:/MinGW/msys/1.0/bin/sh.exe --login -c 'cd "$OLDPWD" && HGMODULEPOLICY="$TEST_HGMODULEPOLICY" $PYTHON C:/Temp/hg/tests/run-tests.py --color=always $RUNTEST_ARGS'

windows-py3:
    <<: *windows_runtests
    tags:
        - windows
    variables:
        PYTHON: py -3
        RUNTEST_ARGS: "--blacklist C:/Temp/check-tests.txt"
        TEST_HGMODULEPOLICY: "c"
    when: manual

deb:
    image: registry.heptapod.net/mercurial/ci-images/py3-hgext3rd:v2.0
    script:
        - apt-get update && apt-get -yq install devscripts equivs lintian --no-install-recommends
        - mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control
        - version=$($PYTHON setup.py --version)
        - debversion="$version+hg$(date +%Y%m%d)+$(hg log -r . -T '{node|short}')"
        - make deb-prepare
        - mkdir -p debs
        - mv ../mercurial-evolve_$version.orig debs/mercurial-evolve_$debversion.orig
        - cd debs/mercurial-evolve_$debversion.orig
        - debchange --newversion "$debversion-1" "automated build"
        - debuild --unsigned-source --unsigned-changes --build=binary
        - dpkg --contents ../mercurial-evolve_$debversion-1_all.deb
    variables:
        DEBEMAIL: evolve-testers@mercurial-scm.org
        DEBFULLNAME: Evolve CI Package Builder
        DEBIAN_FRONTEND: noninteractive
        DEB_BUILD_OPTIONS: nocheck nodoc
    artifacts:
        paths:
            - debs/*.build
            - debs/*.buildinfo
            - debs/*.changes
            - debs/*.deb
    when: manual