Merge pull request #16 from blogh/ci-release
* add release related scripts in tox.ini * update setup.py * add a ci to publish when we release => push a tag "v*" * update CONTRIBUTING.md
This commit is contained in:
commit
29ce7eb36f
28
.github/workflows/publish.yml
vendored
Normal file
28
.github/workflows/publish.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
name: Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.10'
|
||||||
|
- name: Install
|
||||||
|
run: python -m pip install setuptools wheel twine
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
python setup.py check
|
||||||
|
python setup.py sdist bdist_wheel
|
||||||
|
python -m twine check dist/*
|
||||||
|
- name: Publish
|
||||||
|
run: python -m twine upload dist/*
|
||||||
|
env:
|
||||||
|
TWINE_USERNAME: __token__
|
||||||
|
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
@ -21,7 +21,8 @@ from the repo:
|
||||||
```
|
```
|
||||||
$ python3 -m venv .venv
|
$ python3 -m venv .venv
|
||||||
$ . .venv/bin/activate
|
$ . .venv/bin/activate
|
||||||
(.venv) $ pip3 install .[dev,test]
|
(.venv) $ pip3 install .[test]
|
||||||
|
(.venv) $ pip3 install -r requirements-dev.txt
|
||||||
(.venv) $ check_patroni
|
(.venv) $ check_patroni
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -48,4 +49,26 @@ The `README.md` can be geneated with `./docs/make_readme.sh`.
|
||||||
## Executing Tests
|
## Executing Tests
|
||||||
|
|
||||||
The pytests are in `./tests` and use a moker to provide a json response instead
|
The pytests are in `./tests` and use a moker to provide a json response instead
|
||||||
of having to call the patroni API.
|
of having to call the patroni API. To manually run the tests use one of these
|
||||||
|
commands :
|
||||||
|
|
||||||
|
```
|
||||||
|
pytest ./tests # just the tests
|
||||||
|
tox # pytests for all supported version of python + mypy + flake8
|
||||||
|
tox -e py # pytests + mypy + flake8 or the default version of python
|
||||||
|
```
|
||||||
|
|
||||||
|
The tests are executed automatically for each PR using the ci (see
|
||||||
|
`.github/workflow/lint.yml` and `.github/workflow/tests.yml`).
|
||||||
|
|
||||||
|
## Release
|
||||||
|
|
||||||
|
The package is generated and uploaded to pypi when a `v*` tag is created (see
|
||||||
|
`.github/workflow/publish.yml`).
|
||||||
|
|
||||||
|
Alternatively, the release can be done manually with:
|
||||||
|
|
||||||
|
```
|
||||||
|
tox -e build
|
||||||
|
tox -e upload
|
||||||
|
```
|
||||||
|
|
9
MANIFEST.in
Normal file
9
MANIFEST.in
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
include *.md
|
||||||
|
include mypy.ini
|
||||||
|
include pytest.ini
|
||||||
|
include tox.ini
|
||||||
|
include .flake8
|
||||||
|
include pyproject.toml
|
||||||
|
recursive-include docs *.sh
|
||||||
|
recursive-include tests *.json
|
||||||
|
recursive-include tests *.py
|
3
pyproject.toml
Normal file
3
pyproject.toml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[build-system]
|
||||||
|
requires = ["setuptools", "setuptools-scm"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
7
setup.py
7
setup.py
|
@ -44,13 +44,6 @@ setup(
|
||||||
"click >= 8.0.1",
|
"click >= 8.0.1",
|
||||||
],
|
],
|
||||||
extras_require={
|
extras_require={
|
||||||
"dev": [
|
|
||||||
"wheel",
|
|
||||||
"black",
|
|
||||||
"check-manifest",
|
|
||||||
"flake8",
|
|
||||||
"mypy == 0.961",
|
|
||||||
],
|
|
||||||
"test": [
|
"test": [
|
||||||
"pytest",
|
"pytest",
|
||||||
"pytest-mock",
|
"pytest-mock",
|
||||||
|
|
25
tox.ini
25
tox.ini
|
@ -3,7 +3,9 @@ envlist = lint, mypy, py36, py37, py38, py39, py310
|
||||||
skip_missing_interpreters = True
|
skip_missing_interpreters = True
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
extras = test
|
deps =
|
||||||
|
pytest
|
||||||
|
pytest-mock
|
||||||
commands =
|
commands =
|
||||||
pytest {toxinidir}/check_patroni {toxinidir}/tests {posargs:-vv}
|
pytest {toxinidir}/check_patroni {toxinidir}/tests {posargs:-vv}
|
||||||
|
|
||||||
|
@ -21,3 +23,24 @@ deps =
|
||||||
mypy == 0.961
|
mypy == 0.961
|
||||||
commands =
|
commands =
|
||||||
mypy {toxinidir}/check_patroni
|
mypy {toxinidir}/check_patroni
|
||||||
|
|
||||||
|
[testenv:build]
|
||||||
|
deps =
|
||||||
|
wheel
|
||||||
|
setuptools
|
||||||
|
twine
|
||||||
|
allowlist_externals =
|
||||||
|
rm
|
||||||
|
commands =
|
||||||
|
rm --verbose --recursive --force {toxinidir}/dist/
|
||||||
|
python setup.py check
|
||||||
|
python setup.py sdist bdist_wheel
|
||||||
|
python -m twine check dist/*
|
||||||
|
|
||||||
|
[testenv:upload]
|
||||||
|
# requires a check_patroni section in ~/.pypirc
|
||||||
|
skip_install = True
|
||||||
|
deps =
|
||||||
|
twine
|
||||||
|
commands =
|
||||||
|
python -m twine upload --repository check_patroni dist/*
|
||||||
|
|
Loading…
Reference in a new issue