Skip to content

Commit d6aea13

Browse files
committed
add workflow
1 parent 6031416 commit d6aea13

File tree

2 files changed

+79
-1
lines changed

2 files changed

+79
-1
lines changed

.github/workflows/pytest.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Python package
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: ["main"]
7+
pull_request:
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: [3.7, 3.8, 3.9, "3.10"]
17+
fail-fast: false
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
29+
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
30+
- name: Install
31+
run: |
32+
make install
33+
- name: Lint with flake8
34+
run: |
35+
# stop the build if there are Python syntax errors or undefined names
36+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
37+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
38+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
39+
- name: Run unit tests
40+
run: |
41+
make test
42+
43+
deploy:
44+
name: "Deploy to PyPI"
45+
runs-on: ubuntu-latest
46+
if: github.event_name == 'release'
47+
needs: [build]
48+
steps:
49+
- uses: actions/checkout@v2
50+
- name: "Set up Python 3.8"
51+
uses: actions/setup-python@v2
52+
with:
53+
python-version: "3.8"
54+
- name: Install dependencies
55+
run: |
56+
python -m pip install --upgrade pip
57+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
58+
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
59+
- name: "Build Package"
60+
run: |
61+
make dist
62+
63+
# test deploy ----
64+
- name: "Test Deploy to PyPI"
65+
uses: pypa/gh-action-pypi-publish@release/v1
66+
if: startsWith(github.event.release.name, 'TEST')
67+
with:
68+
user: __token__
69+
password: ${{ secrets.PYPI_TEST_API_TOKEN }}
70+
repository_url: https://test.pypi.org/legacy/
71+
72+
## prod deploy ----
73+
- name: "Deploy to PyPI"
74+
uses: pypa/gh-action-pypi-publish@master
75+
if: startsWith(github.event.release.name, 'shinywidgets')
76+
with:
77+
user: __token__
78+
password: ${{ secrets.PYPI_API_TOKEN }}

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ classifiers =
1313
Intended Audience :: Developers
1414
License :: OSI Approved :: MIT License
1515
Natural Language :: English
16-
Programming Language :: Python :: 3
1716
Programming Language :: Python :: 3.7
1817
Programming Language :: Python :: 3.8
1918
Programming Language :: Python :: 3.9
19+
Programming Language :: Python :: 3.10
2020
project_urls =
2121
Bug Tracker = https://github.com/rstudio/py-shinywidgets/issues
2222
Documentation = https://github.com/rstudio/py-shinywidgets/

0 commit comments

Comments
 (0)