-
Notifications
You must be signed in to change notification settings - Fork 0
169 lines (167 loc) · 4.95 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: "Release"
on:
push:
tags:
- "v*"
jobs:
test:
name: "Test"
runs-on: "ubuntu-latest"
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Set up venv
run: |
sudo apt install python3-venv
sudo python -m venv venv
- name: Unit test
run: |
sudo venv/bin/python -m pip install -r requirements.txt
sudo venv/bin/python -m pip install pycocotools==2.0.7
sudo venv/bin/python -m pip install coverage
sudo venv/bin/python -m coverage run -m unittest discover tests
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: EMalagoli92/OD-Metrics
- name: Mypy
run: |
sudo venv/bin/python -m pip install mypy
sudo venv/bin/python -m mypy src
- name: Pylint
run: |
sudo venv/bin/python -m pip install pylint
sudo venv/bin/python -m pylint src
update-badge-success:
name: "Update badge success"
runs-on: "ubuntu-latest"
permissions: write-all
needs: test
if: success()
steps:
- name: Unit test badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 3f159a4246243b883a5c817ca2d34baa
filename: unit_test.json
label: unit test
message: passed
color: brightgreen
style: flat-square
forceUpdate: true
- name: Mypy badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: d23fd688b541d4b303d2baa6ee87e51a
filename: mypy.json
label: mypy
message: passed
color: brightgreen
style: flat-square
forceUpdate: true
- name: Pylint badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 3ab4a977b9a0e4ccb7178dd1fa51e1b0
filename: pylint.json
label: pylint
message: passed
color: brightgreen
style: flat-square
forceUpdate: true
update-badge-failure:
name: "Update badge failure"
runs-on: "ubuntu-latest"
permissions: write-all
needs: test
if: failure()
steps:
- name: Unit test badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 3f159a4246243b883a5c817ca2d34baa
filename: unit_test.json
label: unit test
message: not-passed
color: red
style: flat-square
forceUpdate: true
- name: Mypy badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: d23fd688b541d4b303d2baa6ee87e51a
filename: mypy.json
label: mypy
message: not-passed
color: red
style: flat-square
forceUpdate: true
- name: Pylint badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 3ab4a977b9a0e4ccb7178dd1fa51e1b0
filename: pylint.json
label: pylint
message: not-passed
color: red
style: flat-square
forceUpdate: true
release:
name: "Tagged Release"
runs-on: "ubuntu-latest"
permissions: write-all
needs: test
steps:
- uses: "marvinpinto/action-automatic-releases@latest"
id: create_release
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
- name: Versione badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 331395960725a4b47d4ca4977a24e949
filename: version.json
label: release
message: ${{ steps.create_release.outputs.automatic_releases_tag }}
color: orange
style: flat-square
forceUpdate: true
build-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
needs: release
if: success()
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Set up venv
run: |
sudo apt install python3-venv
sudo python -m venv venv
sudo venv/bin/python -m venv venv
sudo venv/bin/python -m pip install build
- name: Build
run: |
sudo venv/bin/python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}