1
+ name : CI
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - master
7
+ tags :
8
+ - ' v*'
9
+ pull_request :
10
+ branches :
11
+ - master
12
+
13
+ jobs :
14
+ test :
15
+ name : Lint and test on ${{ matrix.name }}
16
+ runs-on : ubuntu-latest
17
+ strategy :
18
+ fail-fast : false
19
+ matrix :
20
+ include :
21
+ - name : Linux py36
22
+ pyversion : ' 3.6'
23
+ - name : Linux py37
24
+ pyversion : ' 3.7'
25
+ - name : Linux py38
26
+ pyversion : ' 3.8'
27
+ - name : Linux py39
28
+ pyversion : ' 3.9'
29
+ steps :
30
+ - uses : actions/checkout@v2
31
+ - name : Set up Python ${{ matrix.pyversion }}
32
+ uses : actions/setup-python@v2
33
+ with :
34
+ python-version : ${{ matrix.pyversion }}
35
+ - name : Install poetry
36
+ run : pip install "poetry>=1.1.8,<1.2"
37
+ - name : Install dependencies
38
+ run : poetry install
39
+ - name : Lint
40
+ run : poetry run flake8
41
+ - name : Test
42
+ run : poetry run pytest --cov=observ --cov-report=term-missing
43
+
44
+ build :
45
+ name : Build and test wheel
46
+ runs-on : ubuntu-latest
47
+ steps :
48
+ - uses : actions/checkout@v2
49
+ - name : Set up Python 3.9
50
+ uses : actions/setup-python@v2
51
+ with :
52
+ python-version : ' 3.9'
53
+ - name : Install poetry
54
+ run : pip install "poetry>=1.1.8,<1.2"
55
+ - name : Install dependencies
56
+ run : poetry install
57
+ - name : Build wheel
58
+ run : poetry build
59
+ - name : Twine check
60
+ run : poetry run twine check dist/*
61
+ - name : Upload wheel artifact
62
+ uses : actions/upload-artifact@v2
63
+ with :
64
+ path : dist
65
+ name : dist
66
+
67
+ publish :
68
+ name : Publish to Github and Pypi
69
+ runs-on : ubuntu-latest
70
+ needs : [test, build]
71
+ if : success() && startsWith(github.ref, 'refs/tags/v')
72
+ steps :
73
+ - uses : actions/checkout@v2
74
+ - name : Download wheel artifact
75
+
76
+ with :
77
+ name : dist
78
+ - name : Get version from git ref
79
+ id : get_version
80
+ run : echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
81
+ - name : Create GH release
82
+ uses : actions/create-release@v1
83
+ env :
84
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
85
+ with :
86
+ tag_name : ${{ steps.get_version.outputs.VERSION }}
87
+ release_name : Release ${{ steps.get_version.outputs.VERSION }}
88
+ draft : false
89
+ prerelease : false
90
+ - name : Upload release assets
91
+ # Move back to official action after fix https://github.com/actions/upload-release-asset/issues/4
92
+
93
+ with :
94
+ release-tag : ${{ steps.get_version.outputs.VERSION }}
95
+ files : ' dist/*.tar.gz;dist/*.whl'
96
+ repo-token : ${{ secrets.GITHUB_TOKEN }}
97
+ - name : Publish to PyPI
98
+ uses : pypa/gh-action-pypi-publish@master
99
+ with :
100
+ user : __token__
101
+ password : ${{ secrets.PYPI_PASSWORD }}
0 commit comments