1
- name : Python application
1
+ name : " python tests+artifacts+release "
2
2
3
3
on :
4
4
pull_request :
5
5
push :
6
- branches : [main]
6
+ branches :
7
+ - main
8
+ tags :
9
+ - " v*"
10
+ release :
11
+ types : [published]
12
+
7
13
8
14
jobs :
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
+
9
35
test :
10
36
runs-on : ubuntu-latest
37
+ needs : [dist]
11
38
strategy :
12
39
matrix :
13
40
# 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"
17
50
steps :
18
51
- uses : actions/checkout@v1
19
52
- name : Set up Python ${{ matrix.python-version }}
@@ -25,14 +58,41 @@ jobs:
25
58
python -m pip install --upgrade pip
26
59
pip install -U setuptools setuptools_scm
27
60
pip install pytest
28
-
61
+ - uses : actions/download-artifact@v2
62
+ with :
63
+ name : dist
64
+ path : dist
29
65
- 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 }}
37
67
- name : pytest
38
68
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