Skip to content

Commit 03376b9

Browse files
authored
Build and publish using github-ci (#42)
1 parent d75fadd commit 03376b9

File tree

5 files changed

+47
-57
lines changed

5 files changed

+47
-57
lines changed

.github/workflows/python-publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
deploy:
20+
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Set up Python
26+
uses: actions/setup-python@v3
27+
with:
28+
python-version: '3.x'
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install build
33+
- name: Build package
34+
run: python -m build
35+
- name: Publish package
36+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
37+
with:
38+
user: __token__
39+
password: ${{ secrets.PYPI_API_TOKEN }}
40+
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pylint
1+
name: Tox
22

33
on: [push]
44

@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: ["3.8", "3.9", "3.10"]
10+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
1111
steps:
1212
- uses: actions/checkout@v3
1313
- name: Set up Python ${{ matrix.python-version }}
@@ -17,7 +17,7 @@ jobs:
1717
- name: Install dependencies
1818
run: |
1919
python -m pip install --upgrade pip
20-
pip install pylint
21-
- name: Analysing the code with pylint
20+
pip install tox
21+
- name: Running tox
2222
run: |
23-
pylint --rcfile pylint.rc $(git ls-files '*.py')
23+
tox

.travis.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

README.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -482,16 +482,9 @@ small pbr python package which takes care of the versioning (among other things)
482482

483483
Publishing a New Release to PyPI
484484
--------------------------------
485-
This requires twine to be installed and the API token to publish to PyPI.
486-
After applying a new tag, build the new distribution on a Linux server then upload using twine:
487485

488-
.. code::
489-
490-
rm -f dist/*
491-
python setup.py sdist bdist_wheel
492-
twine upload dist/*
493-
494-
For username, use "__token__", then provide the api token (see https://packaging.python.org/en/latest/tutorials/packaging-projects/)
486+
To create a new release, apply a new release tag then create a new Release using github (this requires right permission).
487+
The github CI will build the distributions and push to PyPI.
495488

496489

497490
Licensing

setup.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,13 @@
11
'''
22
Setup
33
'''
4-
import sys
54
from setuptools import setup
65
from setuptools import Extension
7-
from setuptools.command.test import test
8-
9-
10-
class Tox(test):
11-
def initialize_options(self):
12-
test.initialize_options(self)
13-
self.tox_args = None # pylint: disable=attribute-defined-outside-init
14-
15-
def finalize_options(self):
16-
test.finalize_options(self)
17-
self.test_args = []
18-
self.test_suite = True # pylint: disable=attribute-defined-outside-init
19-
20-
def run_tests(self):
21-
import tox # pylint: disable=import-outside-toplevel
22-
sys.exit(tox.cmdline())
236

247

258
if __name__ == '__main__':
269
setup(setup_requires=['pbr'], pbr=True,
2710
keywords='hdrhistogram hdr histogram high dynamic range',
28-
tests_require=['tox'],
29-
cmdclass={'test': Tox},
3011
ext_modules=[Extension('pyhdrh',
3112
sources=['src/python-codec.c'])]
3213
)

0 commit comments

Comments
 (0)