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
+
35
+
9
36
test :
10
37
runs-on : ubuntu-latest
38
+ needs : [dist]
11
39
strategy :
12
40
matrix :
13
41
# todo: extract from source
14
42
python-version : [2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, "3.10", "3.11-dev"]
15
- install-style : [full, editable]
16
-
43
+ install-from : ["dist/*.whl"]
44
+ include :
45
+ - python-version : 3.9
46
+ install-from : " -e ."
47
+ - python-version : 3.9
48
+ install-from : " ."
49
+ - python-version : 3.9
50
+ install-from : " dist/*.tar.gz"
17
51
steps :
18
52
- uses : actions/checkout@v1
19
53
- name : Set up Python ${{ matrix.python-version }}
@@ -25,14 +59,58 @@ jobs:
25
59
python -m pip install --upgrade pip
26
60
pip install -U setuptools setuptools_scm
27
61
pip install pytest
28
-
29
62
- 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
-
63
+ run : pip install ${{ matrix.install-from }}
37
64
- name : pytest
38
65
run : pytest
66
+
67
+
68
+ jobs :
69
+
70
+
71
+ mypy :
72
+ runs-on : ubuntu-latest
73
+
74
+ name : Python ${{ matrix.python_version }} - dist ${{ matrix.dist }}
75
+ steps :
76
+ - uses : actions/checkout@v1
77
+ - name : Setup python
78
+ uses : actions/setup-python@v2
79
+ with :
80
+ python-version : ${{ matrix.python_version }}
81
+ architecture : x64
82
+ - uses : actions/download-artifact@v2
83
+ with :
84
+ name : dist
85
+ path : dist
86
+ - run : pip install -e . mypy
87
+ - run : mypy -m
88
+
89
+ dist_check :
90
+ runs-on : ubuntu-latest
91
+ needs : [dist]
92
+ steps :
93
+ - uses : actions/setup-python@v2
94
+ with :
95
+ python-version : " 3.9"
96
+ - uses : actions/download-artifact@v2
97
+ with :
98
+ name : dist
99
+ path : dist
100
+ - run : pipx run twine check --strict dist/*
101
+
102
+ dist_upload :
103
+
104
+ runs-on : ubuntu-latest
105
+ if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
106
+ needs : [dist_check, test]
107
+ steps :
108
+ - uses : actions/download-artifact@v2
109
+ with :
110
+ name : dist
111
+ path : dist
112
+ - name : Publish package to PyPI
113
+ uses : pypa/gh-action-pypi-publish@master
114
+ with :
115
+ user : __token__
116
+ password : ${{ secrets.pypi_token }}
0 commit comments