variables:
- $SKIP_CI == "1"
-manager: # TODO better CI integration
+manager:
stage: test
+ needs: []
trigger:
include: manager/.gitlab-ci.yml
strategy: depend
--- /dev/null
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+FROM fedora:35
+MAINTAINER Knot Resolver <knot-resolver@labs.nic.cz>
+
+WORKDIR /root
+CMD ["/bin/bash"]
+ENV PATH="/root/.local/bin:${PATH}"
+
+# Install Python
+RUN dnf install -y git diffutils python3.6 python3.7 python3.8 python3.9 python3.10 python3-gobject pkg-config cairo-devel gcc python3-devel gobject-introspection-devel cairo-gobject-devel which \
+ && dnf clean all
+
+# Install Poetry
+RUN python3 -m pip install -U pip \
+ && curl -sSL https://install.python-poetry.org | python3 - \
+ # not exactly required, but helpful
+ && python3 -m pip install poethepoet
stages:
- check
- - packaging
default:
- image: registry.nic.cz/knot/knot-resolver-manager/knot-manager:ci
+ image: registry.nic.cz/knot/knot-resolver/ci/manager:knot-$KNOT_VERSION
before_script:
- - pushd manager
- # make sure Poetry is in $PATH
- - source $HOME/.poetry/env
- # there is already a pyproject.toml with installed dependencies in the root
- # it has its own virtualenv and we want to use that env in a different directory
- # so let's create a new one and replace it by the already existing one
- # we don't care about destroying the environment in process, because it's going to be discarded anyway
- - poetry env use $(which python3.6); ourpath=$(poetry env info -p); upperpath=$( (cd ..; poetry env info -p) ); rm -rf "$ourpath"; cp -a "$upperpath" "$ourpath"
- # the virtualenv we recycled might be slightly out of date. Let's quickly update it
+ - cd manager
+ - poetry env use $PYTHON_INTERPRETER
- poetry install
- # fix podman; see https://gitlab.nic.cz/labs/lxc-gitlab-runner#nesting-with-podman
- - unset TMPDIR
tags:
- - lxc
+ - docker
+ - linux
- amd64
-lint:
+lint:py3.10:
stage: check
script:
- poe check
+ variables:
+ PYTHON_INTERPRETER: python3.10
-test:
+
+.unit: &unit
stage: check
script:
- poe test
reports:
cobertura: coverage.xml
-integration:
- stage: check
- script:
- - poe integration
+unit:py3.6:
+ <<: *unit
+ variables:
+ PYTHON_INTERPRETER: python3.6
+unit:py3.7:
+ <<: *unit
+ variables:
+ PYTHON_INTERPRETER: python3.7
-package-debian-10:
- when: manual
- stage: packaging
- image: registry.nic.cz/labs/lxc-gitlab-runner/debian-10
- before_script:
- - pushd manager
- script:
- - bash scripts/make-package.sh
- artifacts:
- paths:
- - knot-resolver/pkg/pkgs/
- - knot-resolver/pkg/srcpkgs/
- expire_in: 1 week
+unit:py3.8:
+ <<: *unit
+ variables:
+ PYTHON_INTERPRETER: python3.8
-package-fedora-34:
- when: manual
- stage: packaging
- image: registry.nic.cz/labs/lxc-gitlab-runner/fedora-34
- before_script:
- - pushd manager
- script:
- - bash scripts/make-package.sh
- artifacts:
- paths:
- - knot-resolver/pkg/pkgs/
- - knot-resolver/pkg/srcpkgs/
- expire_in: 1 week
+unit:py3.9:
+ <<: *unit
+ variables:
+ PYTHON_INTERPRETER: python3.9
+
+unit:py3.10:
+ <<: *unit
+ variables:
+ PYTHON_INTERPRETER: python3.10
+++ /dev/null
-FROM registry.nic.cz/labs/lxc-gitlab-runner/fedora-34:podman
-
-# Install Python and NodeJS
-RUN dnf install -y python3.6 nodejs python3-gobject pkg-config cairo-devel gcc python3-devel gobject-introspection-devel cairo-gobject-devel which \
- && dnf clean all
-
-# Install Poetry
-RUN python3 -m pip install -U pip \
- && curl -sSL https://install.python-poetry.org | python3 - \
- && source $HOME/.poetry/env \
- # not exactly required, but helpful
- && python3 -m pip install poethepoet
-
-# force Poetry to use local .venv/ directory that we can cache
-ENV POETRY_NO_INTERACTION=1 \
- # python:
- PYTHONFAULTHANDLER=1 \
- PYTHONUNBUFFERED=1 \
- PYTHONHASHSEED=random \
- PYTHONDONTWRITEBYTECODE=1
-
-RUN dnf install -y knot-resolver procps-ng
-
-# How does this work?
-# ===================
-#
-# NPM dependencies are installed globally. There is no problem with that.
-#
-# Python dependencies are however installed into a virtualenv created by Poetry. Why you might ask?
-# Because we can't change the default python interpreter without virtualenv. This creates a problem,
-# that the virtualenv is created for a directory different than the one, where CI will run.
-#
-# Yup, that's a slight issue, that has to be fixed before running anything. This migration step is however
-# quick. It's just copying files locally and there's not a ton of them. This virtualenv migration step is
-# therefore done every time a CI job starts.
-#
-# How does it speed up CI?
-# ========================
-#
-# We do not have to install the dependencies every single time. They are cached in the container itself and
-# we can rebuild it only when it's definition or the list of dependencies changes.
-
-COPY pyproject.toml poetry.lock package.json .
-RUN source $HOME/.poetry/env \
- && poetry config --list \
- && poetry env use $(which python3.6) \
- && poetry env info \
- && poetry install --no-interaction --no-ansi \
- && npm install -g $(python -c "import json; print(*(k for k in json.loads(open('package.json').read())['dependencies']))")