changeset 6649:da3fd8644ad9

contrib: add a Dockerfile to run pytype using our CI setup locally
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 05 Jan 2024 13:58:25 -0300
parents 9ceca9a4fb52
children 9c329a7a5922
files contrib/docker/pytype/Dockerfile contrib/docker/pytype/README.rst contrib/docker/pytype/entrypoint.sh
diffstat 3 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/docker/pytype/Dockerfile	Fri Jan 05 13:58:25 2024 -0300
@@ -0,0 +1,14 @@
+FROM registry.heptapod.net/mercurial/ci-images/py3-hgext3rd:v2.0
+
+USER ci-runner
+
+ENV PATH=/home/ci-runner/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ENV PYTHONPATH=/home/ci-runner/.local/lib/python3.11/site-packages
+
+RUN python3 -m pip install --user --break-system-packages --upgrade pytype==2023.11.21
+
+ADD --chown=ci-runner entrypoint.sh /home/ci-runner/entrypoint.sh
+
+RUN chmod -R a=rwX /home/ci-runner/.local/ /home/ci-runner/entrypoint.sh
+
+CMD /home/ci-runner/entrypoint.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/docker/pytype/README.rst	Fri Jan 05 13:58:25 2024 -0300
@@ -0,0 +1,10 @@
+Pytype in Docker
+================
+
+To build the container::
+
+  $ docker build --tag evolve-pytype-checker "$(hg root)/contrib/docker/pytype/"
+
+To check the code with pytype::
+
+  $ docker run --rm -it -u "$(id -u):$(id -g)" -v "$(hg root):/tmp/evolve-ci" -v "/path/to/mercurial-repo:/tmp/mercurial-ci" evolve-pytype-checker
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/docker/pytype/entrypoint.sh	Fri Jan 05 13:58:25 2024 -0300
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+cd /tmp/mercurial-ci/
+make local
+./contrib/setup-pytype.sh
+
+cd /tmp/evolve-ci/
+pytype --version
+pytype --keep-going --jobs auto -P /tmp/mercurial-ci/:hgext3rd hgext3rd