From 0dc011684d329a3df91348f916beecd634cfac5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Thu, 9 Nov 2023 16:41:01 +0100 Subject: [PATCH] Use docker-in-docker to run tests Cortesy @maisim. This commit allow to use docker-in-docker to run tests. Also it will run the tests on python version defined in the PYTHON_VERSION array. The tox.ini file is not needed anymore. Test locally can be run on the user python version, and check against several python version will be done by the CI. Notice the ODOO_RPC_URL environment variable which allow to mock the RPC request to the right url. This tests needs to be run on custom privileged runner. ! Using gitlab runner does not work ! --- .gitlab-ci.yml | 33 ++++++++++++++++++++++----------- tox.ini | 10 ---------- 2 files changed, 22 insertions(+), 21 deletions(-) delete mode 100644 tox.ini diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ab730fc..cea8cbb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,24 +15,35 @@ pre-commit: - pre-commit run --all --show-diff-on-failure --verbose --color always pytest: + image: + name: python:$PYTHON_VERSION stage: test tags: - - shell + - cie-oow-dind-runner only: - merge_requests - "main" + services: + - name: docker:dind + alias: dind + variables: + ODOO_RPC_URL: dind + DOCKER_HOST: tcp://dind:2375/ + DOCKER_DRIVER: overlay2 + DOCKER_TLS_CERTDIR: "" coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+)\%/' - script: - - python3 -m venv ./.gitlab-ci-venv - - source ./.gitlab-ci-venv/bin/activate - # - pip install --upgrade pip + before_script: - pip install poetry - - poetry --version - - poetry install -v - - echo $PATH - - echo $PYTHONPATH - - poetry run pytest --version - - poetry run pytest --verbosity=2 --exitfirst --cov odoo_openupgrade_wizard + - export PATH="$HOME/.local/bin:$PATH" + - poetry install --all-extras + script: + - poetry run pytest -vv -x --cov=odoo_openupgrade_wizard + parallel: + matrix: + - PYTHON_VERSION: + - "3.7" + - "3.8" + - "3.9" build: stage: build diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 923f2ed..0000000 --- a/tox.ini +++ /dev/null @@ -1,10 +0,0 @@ -[tox] -isolated_build = true -skipsdist = True -envlist = py36, py37, py38, py39 - -[testenv] -whitelist_externals = poetry -commands = - poetry install -v - poetry run pytest -vv