Skip to content

Commit

Permalink
CI: Add job for min versions (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-berchet committed Feb 28, 2023
1 parent 5363202 commit cd9768e
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 37 deletions.
3 changes: 2 additions & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changes here will be overwritten by Copier

_commit: 0.1.32
_commit: 0.1.38
_src_path: git@bbpgitlab.epfl.ch:neuromath/python-template.git
author_email: ''
author_name: Blue Brain Project, EPFL
Expand All @@ -21,6 +21,7 @@ ssh_url: git@github.com:BlueBrain/luigi-tools.git
support_py37: true
team_name: neuromath
tracker_url: https://github.com/BlueBrain/luigi-tools/issues
use_pyproject_toml: false
version: 0.0.20.dev0

# End of Copier answers
19 changes: 16 additions & 3 deletions .github/workflows/run-tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ jobs:
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
min_versions: ["min_versions", "latest_versions"]
exclude:
- min_versions: "min_versions"
include:
- python-version: "3.7"
min_versions: "min_versions"

steps:
- uses: actions/checkout@v3
Expand All @@ -40,14 +46,21 @@ jobs:
- name: Install dependencies and register dot plugin
run: |
sudo dot -c
python -m pip install --upgrade pip setuptools
pip install tox-gh-actions
- name: Clear results in tox environments
run: |
rm -rf .tox/*/tmp
- name: Run tox
- name: Run tox with latest versions
if: ${{ matrix.min_versions == 'latest_versions' }}
run: |
python -m pip install --upgrade pip setuptools
pip install tox-gh-actions
tox
- name: Run tox with min versions
if: ${{ matrix.min_versions == 'min_versions' }}
run: |
python -m pip install --upgrade pip setuptools
pip install tox
tox run -e min_versions
- name: JUnit Report Action
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/codespell-project/codespell
Expand Down
12 changes: 3 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# SETUPTOOLS
[build-system]
requires = [
"setuptools>=42",
"wheel",
"setuptools_scm[toml]>=3.4",
"setuptools>=45",
"setuptools_scm[toml]>=6.2",
]
build-backend = "setuptools.build_meta"

# SETUPTOOLS_SCM
[tool.setuptools_scm]
local_scheme = "no-local-version"

# BLACK
[tool.black]
line-length = 100
target-version = [
Expand All @@ -21,7 +18,6 @@ target-version = [
"py311",
]

# PYDOCSTYLE
[tool.pydocstyle]
# ignore the following:
# - D107: Missing docstring in __init__
Expand All @@ -30,13 +26,11 @@ add-ignore = [
]
convention = "google"

# ISORT
[tool.isort]
profile = "black"
line_length = 100
force_single_line = true

# PYTEST
[tool.pytest.ini_options]
testpaths = [
"tests",
Expand Down
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
from setuptools import setup

reqs = [
"luigi",
"jsonschema",
"typing-extensions",
"luigi>=3.1",
"jsonschema>=4.2",
"typing-extensions>=4",
]

doc_reqs = [
Expand All @@ -31,10 +31,10 @@
]

test_reqs = [
"mock",
"pytest",
"pytest-cov",
"pytest-html",
"mock>=3",
"pytest>=6",
"pytest-cov>=3",
"pytest-html>=2",
]

setup(
Expand Down
42 changes: 26 additions & 16 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ envlist =
check-packaging
lint
docs
min_versions
py{37,38,39,310,311}

minversion = 3.18
Expand All @@ -17,19 +18,25 @@ extras =
test
setenv =
COVERAGE_FILE = {env:COVERAGE_FILE:.coverage-{envname}}
commands = pytest \
--basetemp={envtmpdir} \
--cov={[base]name} \
--cov-branch \
--cov-fail-under=100 \
--no-cov-on-fail \
--cov-report term-missing \
--cov-report html:reports/coverage-{envname} \
--cov-report xml:reports/coverage-{envname}.xml \
--html reports/pytest-{envname}.html \
--junit-xml=reports/pytest-{envname}.xml \
--self-contained-html \
{posargs}
deps =
min_versions: Requirements-Builder
commands =
min_versions: requirements-builder --level=min --extras=test -o {envtmpdir}/requirements_min.txt setup.py
min_versions: pip install -r {envtmpdir}/requirements_min.txt
min_versions: pip freeze
pytest \
--basetemp={envtmpdir} \
--cov={[base]name} \
--cov-branch \
--cov-fail-under=100 \
--no-cov-on-fail \
--cov-report term-missing \
--cov-report html:reports/coverage-{envname} \
--cov-report xml:reports/coverage-{envname}.xml \
--html reports/pytest-{envname}.html \
--junit-xml=reports/pytest-{envname}.xml \
--self-contained-html \
{posargs}

[testenv:check-packaging]
skip_install = true
Expand All @@ -41,6 +48,9 @@ commands =
python -m build -o {envtmpdir}/dist
twine check {envtmpdir}/dist/*

[testenv:min_versions]
basepython = python3.7

[testenv:lint]
basepython = python3.8
deps =
Expand Down Expand Up @@ -73,8 +83,8 @@ commands = make html SPHINXOPTS=-W

[gh-actions]
python =
3.7: py37, check-packaging
3.8: py38, lint
3.7: py37, lint
3.8: py38
3.9: py39, docs
3.10: py310
3.10: py310, check-packaging
3.11: py311

0 comments on commit cd9768e

Please sign in to comment.