1- name : Python application
1+ name : " python tests+artifacts+release "
22
33on :
44 pull_request :
55 push :
6- branches : [main]
6+ branches :
7+ - main
8+ tags :
9+ - " v*"
10+ release :
11+ types : [published]
12+
713
814jobs :
15+ dist :
16+ runs-on : ubuntu-latest
17+ name : Python sdist/wheel
18+ steps :
19+ - uses : actions/checkout@v1
20+ - uses : actions/setup-python@v2
21+ with :
22+ python-version : " 3.9"
23+ - name : Install dependencies
24+ run : |
25+ python -m pip install --upgrade pip
26+ pip install --upgrade wheel setuptools build
27+
28+ - name : Build package
29+ run : python -m build -o dist/
30+ - uses : actions/upload-artifact@v2
31+ with :
32+ name : dist
33+ path : dist
34+
935 test :
1036 runs-on : ubuntu-latest
37+ needs : [dist]
1138 strategy :
1239 matrix :
1340 # todo: extract from source
14- python-version : [2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9]
15- install-style : [full, editable]
16-
41+ python-version : [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, "3.10-dev"]
42+ install-from : ["dist/*.whl"]
43+ include :
44+ - python-version : 3.9
45+ install-from : " -e ."
46+ - python-version : 3.9
47+ install-from : " ."
48+ - python-version : 3.9
49+ install-from : " dist/*.tar.gz"
1750 steps :
1851 - uses : actions/checkout@v1
1952 - name : Set up Python ${{ matrix.python-version }}
@@ -25,14 +58,41 @@ jobs:
2558 python -m pip install --upgrade pip
2659 pip install -U setuptools setuptools_scm
2760 pip install pytest
28-
61+ - uses : actions/download-artifact@v2
62+ with :
63+ name : dist
64+ path : dist
2965 - name : install editable
30- run : pip install -e .
31- if : matrix.install-style=='editable'
32- - name : install full
33- run : pip install .
34-
35- if : matrix.install-style=='full'
36-
66+ run : pip install ${{ matrix.install-from }}
3767 - name : pytest
3868 run : pytest
69+
70+
71+ dist_check :
72+ runs-on : ubuntu-latest
73+ needs : [dist]
74+ steps :
75+ - uses : actions/setup-python@v2
76+ with :
77+ python-version : " 3.9"
78+ - uses : actions/download-artifact@v2
79+ with :
80+ name : dist
81+ path : dist
82+ - run : pipx run twine check --strict dist/*
83+
84+ dist_upload :
85+
86+ runs-on : ubuntu-latest
87+ if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
88+ needs : [dist_check, test]
89+ steps :
90+ - uses : actions/download-artifact@v2
91+ with :
92+ name : dist
93+ path : dist
94+ - name : Publish package to PyPI
95+ uses : pypa/gh-action-pypi-publish@master
96+ with :
97+ user : __token__
98+ password : ${{ secrets.pypi_token }}
0 commit comments