diff --git a/.gitignore b/.gitignore index d41c78c..542143f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ *.egg-info *.pyc __pycache__/ +/test-reports/ diff --git a/Makefile b/Makefile index b93c9b0..5c1213c 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,14 @@ all: chore -chore: requirements.txt requirements-dev.txt +chore: requirements.txt requirements-dev.txt bitbucket-pipelines.yaml Pipfile.lock: Pipfile python3 -m pipenv lock -v +bitbucket-pipelines.yml: bitbucket-pipelines.yml.m4 + m4 $@.m4 > $@ + requirements-dev.txt: Pipfile.lock python3 -m pipenv requirements --exclude-markers --dev-only > requirements-dev.txt diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 6977040..fd8d371 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -1,4 +1,4 @@ -image: administratrix/cicd:latest +image: byteb4rb1e/build-python313 definitions: caches: venv: @@ -24,20 +24,20 @@ definitions: script: - .venv/bin/python3 -m pipenv run make test-reports/static - step: &test-unit - name: test-unit - caches: - - venv artifacts: - test-reports/* script: + - python3 -m venv --system-site-packages .venv + - .venv/bin/python3 -m pip install pipenv + - .venv/bin/python3 -m pipenv run sh configure - .venv/bin/python3 -m pipenv run make test-reports/unit - step: &test-integration - name: test-integration - caches: - - venv artifacts: - test-reports/* script: + - python3 -m venv --system-site-packages .venv + - .venv/bin/python3 -m pip install pipenv + - .venv/bin/python3 -m pipenv run sh configure - .venv/bin/python3 -m pipenv run make test-reports/integration - step: &doc name: doc @@ -57,6 +57,22 @@ definitions: script: - make clean - .venv/bin/python3 -m pipenv run make dist + - step: &publish + name: publish + caches: + - venv + artifacts: + - dist/* + script: + - echo "publish" + - step: &archive + name: archive + caches: + - venv + artifacts: + - dist/* + script: + - echo "archive" - step: &chore name: chore caches: @@ -85,24 +101,103 @@ pipelines: - step: *test-static - step: *dist branches: - dev: + master: - step: *configure - parallel: steps: - step: *test-static - - step: *test-unit - - step: *test-integration + - step: + <<: *test-unit + image: byteb4rb1e/build-python39 + name: test-unit-python39 + - step: + <<: *test-unit + image: byteb4rb1e/build-python310 + name: test-unit-python310 + - step: + <<: *test-unit + image: byteb4rb1e/build-python311 + name: test-unit-python311 + - step: + <<: *test-unit + image: byteb4rb1e/build-python312 + name: test-unit-python312 + - step: + <<: *test-unit + image: byteb4rb1e/build-python313 + name: test-unit-python313 + - step: + <<: *test-integration + image: byteb4rb1e/build-python39 + name: test-integration-python39 + - step: + <<: *test-integration + image: byteb4rb1e/build-python310 + name: test-integration-python310 + - step: + <<: *test-integration + image: byteb4rb1e/build-python311 + name: test-integration-python311 + - step: + <<: *test-integration + image: byteb4rb1e/build-python312 + name: test-integration-python312 + - step: + <<: *test-integration + image: byteb4rb1e/build-python313 + name: test-integration-python313 + - step: *dist + - step: *archive - parallel: steps: - step: *doc - - step: *dist - master: + - step: *publish + pullrequests: + "{master,dev}": - step: *configure - parallel: steps: - step: *test-static - - step: *test-unit - - step: *test-integration + - step: + <<: *test-unit + image: byteb4rb1e/build-python39 + name: test-unit-python39 + - step: + <<: *test-unit + image: byteb4rb1e/build-python310 + name: test-unit-python310 + - step: + <<: *test-unit + image: byteb4rb1e/build-python311 + name: test-unit-python311 + - step: + <<: *test-unit + image: byteb4rb1e/build-python312 + name: test-unit-python312 + - step: + <<: *test-unit + image: byteb4rb1e/build-python313 + name: test-unit-python313 + - step: + <<: *test-integration + image: byteb4rb1e/build-python39 + name: test-integration-python39 + - step: + <<: *test-integration + image: byteb4rb1e/build-python310 + name: test-integration-python310 + - step: + <<: *test-integration + image: byteb4rb1e/build-python311 + name: test-integration-python311 + - step: + <<: *test-integration + image: byteb4rb1e/build-python312 + name: test-integration-python312 + - step: + <<: *test-integration + image: byteb4rb1e/build-python313 + name: test-integration-python313 - parallel: steps: - step: *doc diff --git a/bitbucket-pipelines.yml.m4 b/bitbucket-pipelines.yml.m4 new file mode 100644 index 0000000..972b870 --- /dev/null +++ b/bitbucket-pipelines.yml.m4 @@ -0,0 +1,166 @@ +image: byteb4rb1e/build-python313 +define(`bootstrappipenv', patsubst( +`- python3 -m venv --system-site-packages .venv +- .venv/bin/python3 -m pip install pipenv', `^', $1))dnl +definitions: + caches: + venv: + path: .venv + steps: + - step: &configure + name: configure + caches: + - venv + artifacts: + - config.log + - config.status + script: +bootstrappipenv(` ') + - .venv/bin/python3 -m pipenv run sh configure + - step: &test-static + name: test-static + caches: + - venv + artifacts: + - test-reports/* + script: + - .venv/bin/python3 -m pipenv run make test-reports/static + - step: &test-unit + artifacts: + - test-reports/* + script: +bootstrappipenv(` ') + - .venv/bin/python3 -m pipenv run sh configure + - .venv/bin/python3 -m pipenv run make test-reports/unit + - step: &test-integration + artifacts: + - test-reports/* + script: +bootstrappipenv(` ') + - .venv/bin/python3 -m pipenv run sh configure + - .venv/bin/python3 -m pipenv run make test-reports/integration + - step: &doc + name: doc + caches: + - venv + artifacts: + - build/doc/** + script: + - make clean + - .venv/bin/python3 -m pipenv run make build/doc + - step: &dist + name: dist + caches: + - venv + artifacts: + - dist/* + script: + - make clean + - .venv/bin/python3 -m pipenv run make dist + - step: &publish + name: publish + caches: + - venv + artifacts: + - dist/* + script: + - echo "publish" + - step: &archive + name: archive + caches: + - venv + artifacts: + - dist/* + script: + - echo "archive" + - step: &chore + name: chore + caches: + - venv + artifacts: + - requirements.txt + - requirements-dev.txt + - Pipfile.lock + script: + - make clean + - .venv/bin/python3 -m pipenv run make chore + # TODO: this is good, but rather useless yet as the chore + # target only regenerates requirements.txt and + # requirements-dev.txt from Pipfile.lock, but it does not test + # the sync between Pipfile and Pipfile.lock, as the locking + # mechanism of pipenv currently is platform-dependent, i.e., it + # is not possible to define a minimum Python version and expect + # pipenv to find the right versions of dependencies compatible + # with all specified platforms. +# - git diff --exit-code +undefine(`bootstrappipenv')dnl +define(`allteststeps', patsubst( +`- parallel: + steps: + - step: *test-static + - step: + <<: *test-unit + image: byteb4rb1e/build-python39 + name: test-unit-python39 + - step: + <<: *test-unit + image: byteb4rb1e/build-python310 + name: test-unit-python310 + - step: + <<: *test-unit + image: byteb4rb1e/build-python311 + name: test-unit-python311 + - step: + <<: *test-unit + image: byteb4rb1e/build-python312 + name: test-unit-python312 + - step: + <<: *test-unit + image: byteb4rb1e/build-python313 + name: test-unit-python313 + - step: + <<: *test-integration + image: byteb4rb1e/build-python39 + name: test-integration-python39 + - step: + <<: *test-integration + image: byteb4rb1e/build-python310 + name: test-integration-python310 + - step: + <<: *test-integration + image: byteb4rb1e/build-python311 + name: test-integration-python311 + - step: + <<: *test-integration + image: byteb4rb1e/build-python312 + name: test-integration-python312 + - step: + <<: *test-integration + image: byteb4rb1e/build-python313 + name: test-integration-python313', `^', $1))dnl +pipelines: + default: + - step: *configure + - parallel: + steps: + - step: *test-static + - step: *dist + branches: + master: + - step: *configure +allteststeps(` ') + - step: *dist + - step: *archive + - parallel: + steps: + - step: *doc + - step: *publish + pullrequests: + "{master,dev}": + - step: *configure +allteststeps(` ') + - parallel: + steps: + - step: *doc + - step: *dist +undefine(`allteststeps')dnl diff --git a/tox.ini b/tox.ini index baaccd7..425059b 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,6 @@ env_list = py3{8-12}-sphinx{5-8}-{integration} lint format - audit [testenv] deps = @@ -23,7 +22,7 @@ commands = [testenv:audit] description = run type check on code base -labels = static +labels = audit deps = pip-audit commands = @@ -38,15 +37,16 @@ commands = autopep8 --recursive --diff --exit-code src/ autopep8 --recursive --diff --exit-code tests/ -[testenv:py3{8-13}-unit] +[testenv:py3{9-13}-unit] description = run type check on code base labels = unit deps = {[testenv]deps} + pytest commands = - python3 -m unittest discover tests/unit + pytest tests/unit --junitxml=test-reports/{env_name}.xml -[testenv:py3{8-13}-sphinx{5-8}-integration] +[testenv:py3{9-13}-sphinx{5-7}-integration] description = run type check on code base labels = integration deps = @@ -54,6 +54,16 @@ deps = sphinx5: sphinx>=5.0,<=6.0 sphinx6: sphinx>=6.0,<=7.0 sphinx7: sphinx>=7.0,<=8.0 - sphinx8: sphinx>=8.0,<=9.0 + pytest commands = - python3 -m unittest discover tests/integration + pytest tests/integration --junitxml=test-reports/{env_name}.xml + +[testenv:py3{10-13}-sphinx8-integration] +description = run type check on code base +labels = integration +deps = + {[testenv]deps} + sphinx8: sphinx>=8.0,<=9.0 + pytest +commands = + pytest tests/integration --junitxml=test-reports/{env_name}.xml