Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,55 +32,55 @@ jobs:
- name: Install dependencies
run: pip install tox
- name: Run tests
run: tox -e py
run: tox run -e py

tests-misc:
runs-on: ubuntu-latest
strategy:
matrix:
env: [generate-integration-files, type, lint, format]
env:
- build
- format
- generate-integration-files
- lint
- type
steps:
- uses: actions/checkout@v5
with:
# build env: fetch all commits for version computation
fetch-depth: ${{ matrix.env == 'build' && '0' || '1' }}
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install dependencies
run: pip install tox
- name: Run ${{ matrix.env }}
run: tox -e ${{ matrix.env }}

build:
needs: [tests-py, tests-misc]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
# fetch all commits for setuptools_scm
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Build
run: python setup.py sdist bdist_wheel
- name: Save build artifacts
run: tox run -e ${{ matrix.env }}
- if: ${{ matrix.env == 'build' }}
name: Save ${{ matrix.env }} artifacts
uses: actions/upload-artifact@v4
with:
name: dist
name: ${{ matrix.env }}
path: dist

publish:
if: startsWith(github.ref, 'refs/tags')
needs: build
needs:
- tests-py
- tests-misc
runs-on: ubuntu-latest
environment: publish
permissions:
id-token: write # This permission is mandatory for trusted publishing
steps:
- name: Restore build artifacts
uses: actions/download-artifact@v5
with:
name: dist
name: build
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}
verbose: true
print-hash: true
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ adheres to [Semantic Versioning](https://semver.org/).
- Freeze dev dependencies versions
- Update GitHub actions dependencies
- Add tests for PyPy 3.10 and 3.11
- Improve tox & CI pipelines

## [0.5.0] - 2023-02-27

Expand Down
21 changes: 10 additions & 11 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# install + dependencies
-e .

# typing
mypy==1.0.1
# build
build==1.3.0

# tests
pytest==7.2.1
pytest-cov==4.0.0
# format
black==23.1.0
isort==5.12.0

# lint
pylint==2.16.2

# format
black==23.1.0
isort==5.12.0
# typing
mypy==1.0.1

# publish
setuptools_scm==7.1.0
wheel==0.38.4
# tests
pytest==7.2.1
pytest-cov==4.0.0
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ package_dir = =src
packages = xz
python_requires = >=3.9
setup_requires =
setuptools_scm
wheel
setuptools_scm==7.1.0
44 changes: 28 additions & 16 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# for moving this file into pyproject.toml, see https://github.com/tox-dev/tox/issues/999

[tox]
envlist =
py, py39, py310, py311, pypy3
generate-integration-files, type, lint, format
build, format, generate-integration-files, lint, type

[testenv]
package = wheel
wheel_build_env = .pkg # reuse same wheel across envs
deps =
pytest==7.2.1
pytest-cov==4.0.0
Expand All @@ -15,6 +19,24 @@ commands =
pytest {posargs:-vv --cov-fail-under=100}
py: -coverage html

[testenv:build]
basepython = python3.11
skip_install = true
deps =
build==1.3.0
commands =
python -m build

[testenv:format]
basepython = python3.11
skip_install = true
deps =
black==23.1.0
isort==5.12.0
commands =
black {posargs:--check --diff} src tests
isort {posargs:--check --diff} src tests

[testenv:generate-integration-files]
basepython = python3.11
deps =
Expand All @@ -26,15 +48,6 @@ setenv =
PYTHONDEVMODE = 1
commands = pytest -vv -m generate_integration_files --generate-integration-files

[testenv:type]
basepython = python3.11
deps =
mypy==1.0.1
pytest==7.2.1 # for typing
commands =
mypy
mypy --namespace-packages --explicit-package-bases tests

[testenv:lint]
basepython = python3.11
deps =
Expand All @@ -44,12 +57,11 @@ commands =
pylint src
pylint -d duplicate-code,too-many-statements,use-implicit-booleaness-not-comparison tests

[testenv:format]
[testenv:type]
basepython = python3.11
skip_install = true
deps =
black==23.1.0
isort==5.12.0
mypy==1.0.1
pytest==7.2.1 # for typing
commands =
black {posargs:--check --diff} src tests
isort {posargs:--check --diff} src tests
mypy
mypy --namespace-packages --explicit-package-bases tests