From e59b19d6e33714250d046e2eeaeb14df01a22345 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 18 Jan 2022 22:44:09 +0100 Subject: [PATCH] Switch to nox testing and python containers Switched to basic python containers, onto which the ci steps simply install poetry. This takes a little more processing time during pipeline running (~16s per step), but also gives much more flexibility in container usage. Switching to nox for test automation across multiple python versions. Fixing mypy library stubs missing for some imported libraries. --- .woodpecker.yml | 38 +++++++++++++++++++++++--------------- noxfile.py | 2 +- pyproject.toml | 10 ++++++++++ 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index f11b3a3..946ad62 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,34 +1,42 @@ # branches: main pipeline: - unit_tests: - image: mquade/poetry:3.9-1.1.11 - commands: - - poetry config virtualenvs.create false - - poetry install - - pytest - code_lint: - image: mquade/poetry:3.9-1.1.11 + image: python commands: - - poetry config virtualenvs.create false + - pip install poetry - poetry install - pip install black - - black . + - echo "----------------- running lint ------------------" + - python --version && poetry --version && black --version + - poetry run black . + + unit_tests: + image: thekevjames/nox + commands: + - pip install poetry + - poetry install + - echo "----------------- running tests ------------------" + - python --version && poetry --version && nox --version + - poetry run nox static_analysis: - image: mquade/poetry:3.9-1.1.11 + image: python commands: - - poetry config virtualenvs.create false + - pip install poetry - poetry install - pip install mypy - - mypy . + - echo "----------------- running analysis ------------------" + - python --version && poetry --version && mypy --version + - poetry run mypy . build_dist: - image: mquade/poetry:3.9-1.1.11 + image: python commands: - - poetry config virtualenvs.create false + - pip install poetry - poetry install + - echo "----------------- running analysis ------------------" + - python --version && poetry --version - poetry build when: branch: main diff --git a/noxfile.py b/noxfile.py index 17d9d37..f056b7a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,4 +1,4 @@ -import nox # type: ignore +import nox @nox.session(python=["3.7", "3.8", "3.9"]) diff --git a/pyproject.toml b/pyproject.toml index c0716f4..468c0db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,3 +38,13 @@ show_missing = true [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" + +[[tool.mypy.overrides]] +module = [ + "click", + "click.testing", + "pytest", + "nox", + "importlib-metadata" +] +ignore_missing_imports = true