Skip to content

Commit 9406fa7

Browse files
committed
Add GitHub actions for CI and deployments
1 parent af71483 commit 9406fa7

File tree

3 files changed

+85
-1
lines changed

3 files changed

+85
-1
lines changed

.github/workflows/python-package.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python package
5+
6+
on: [push, pull_request]
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: ["2.7", "3.x"]
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
cache: 'pip'
24+
cache-dependency-path: '**/setup.py'
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip setuptools wheel
28+
python -m pip install .[test,dist]
29+
- name: Test with pytest
30+
run: |
31+
pytest -v

.github/workflows/python-publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
strategy:
23+
fail-fast: false
24+
matrix:
25+
python-version: ["2.7", "3.x"]
26+
27+
steps:
28+
- uses: actions/checkout@v3
29+
- name: Set up Python
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip setuptools wheel
36+
python -m pip install build
37+
- name: Build 2.7 package
38+
if: ${{ matrix.python-version == '2.7' }}
39+
run: python -m build --wheel
40+
- name: Build package
41+
if: ${{ matrix.python-version != '2.7' }}
42+
run: python -m build
43+
# - name: Publish package to TestPyPI
44+
# uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
45+
# with:
46+
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
47+
# repository_url: https://test.pypi.org/legacy/
48+
- name: Publish package
49+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
50+
with:
51+
user: __token__
52+
password: ${{ secrets.PYPI_API_TOKEN }}

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
'Programming Language :: Python :: 3.8',
105105
'Programming Language :: Python :: 3.9',
106106
'Programming Language :: Python :: 3.10',
107+
'Programming Language :: Python :: 3.11',
107108
#'Programming Language :: Python :: 3 :: Only',
108109
],
109110

@@ -159,7 +160,7 @@
159160
# projects.
160161
extras_require={ # Optional
161162
'dist': ['build'],
162-
'dev': ['pylint', 'flake8', 'mypy'],
163+
'lint': ['pylint', 'flake8', 'mypy'],
163164
'test': ['pytest', 'coverage', 'pytest-cov', 'pytest-mock', 'attrs'],
164165
},
165166

0 commit comments

Comments
 (0)