-
Notifications
You must be signed in to change notification settings - Fork 66
223 lines (196 loc) · 6.82 KB
/
ci.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: Release Tests
on:
schedule:
- cron: 16 6 * * *
push:
branches: [ main ]
pull_request:
workflow_dispatch:
workflow_call:
# cancels running CI if new commit is pushed to branch
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
LATEST_PYTHON_VER: 3.12
LATEST_QBT_VER: v4.6.3
QBITTORRENTAPI_HOST: localhost:8080
QBITTORRENTAPI_USERNAME: admin
QBITTORRENTAPI_PASSWORD: adminadmin
FORCE_COLOR: 1
jobs:
verify:
name: Get Ready
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
python-latest-version: ${{ steps.set-outputs.outputs.python-latest-version }}
qbittorrent-latest-version: ${{ steps.set-outputs.outputs.qbittorrent-latest-version }}
qbittorrent-host: ${{ steps.set-outputs.outputs.qbittorrent-host }}
qbittorrent-username: ${{ steps.set-outputs.outputs.qbittorrent-username }}
qbittorrent-password: ${{ steps.set-outputs.outputs.qbittorrent-password }}
steps:
- name: Declare Outputs
id: set-outputs
run: |
echo "python-latest-version=${{ env.LATEST_PYTHON_VER }}" >> ${GITHUB_OUTPUT}
echo "qbittorrent-latest-version=${{ env.LATEST_QBT_VER }}" >> ${GITHUB_OUTPUT}
echo "qbittorrent-host=${{ env.QBITTORRENTAPI_HOST }}" >> ${GITHUB_OUTPUT}
echo "qbittorrent-username=${{ env.QBITTORRENTAPI_USERNAME }}" >> ${GITHUB_OUTPUT}
echo "qbittorrent-password=${{ env.QBITTORRENTAPI_PASSWORD }}" >> ${GITHUB_OUTPUT}
- name: Checkout Repo
uses: actions/[email protected]
- name: Set up Python ${{ env.LATEST_PYTHON_VER }}
uses: actions/[email protected]
with:
python-version: ${{ env.LATEST_PYTHON_VER }}
cache: pip
check-latest: true
cache-dependency-path: ${{ github.workspace }}/pyproject.toml
- name: Install
run: pip install .[dev]
- name: Lint
uses: pre-commit/[email protected]
package:
#######
# Verify build and packaging is successful
#######
name: Build & Verify Package
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/[email protected]
with:
fetch-depth: 0 # Fetch all refs so setuptools_scm can generate the correct version number
- name: Set up Python ${{ env.LATEST_PYTHON_VER }}
uses: actions/[email protected]
with:
python-version: ${{ env.LATEST_PYTHON_VER }}
cache: pip
cache-dependency-path: ${{ github.workspace }}/setup.cfg
- name: Install Build Tools
run: |
python -m pip install -U pip setuptools wheel
python -m pip install .[dev]
- name: Build Package
run: tox -e package
- name: Upload Package
uses: actions/[email protected]
with:
name: package
path: ./dist
if-no-files-found: error
Tests-qBittorrent:
name: Release Test ${{ needs.verify.outputs.python-latest-version }} - ${{ matrix.QBT_VER }}
needs: [ verify, package ]
strategy:
matrix:
QBT_VER:
- v4.4.4
- v4.3.9
- v4.3.5
- v4.3.4.1
- v4.3.3
- v4.3.2
- v4.3.1
- v4.3.0.1
- v4.2.5
- v4.2.0
- v4.1.6
- v4.1.0
include:
- IS_QBT_DEV: false
# test dev versions of qBittorrent
- QBT_VER: master
IS_QBT_DEV: true
- QBT_VER: v4_6_x
IS_QBT_DEV: true
uses: ./.github/workflows/test.yml
secrets: inherit
with:
python-version: ${{ needs.verify.outputs.python-latest-version }}
qbittorrent-version: ${{ matrix.QBT_VER }}
qbittorrent-host: ${{ needs.verify.outputs.qbittorrent-host }}
qbittorrent-username: ${{ needs.verify.outputs.qbittorrent-username }}
qbittorrent-password: ${{ needs.verify.outputs.qbittorrent-password }}
is-qbt-dev: ${{ matrix.IS_QBT_DEV }}
Tests-Python:
name: Release Test ${{ matrix.PYTHON_VER }} - ${{ needs.verify.outputs.qbittorrent-latest-version }}
needs: [ verify, package ]
strategy:
matrix:
PYTHON_VER: [ 3.13-dev, 3.12, 3.11, "3.10", pypy3.10, 3.9, 3.8 ]
uses: ./.github/workflows/test.yml
secrets: inherit
with:
python-version: ${{ matrix.PYTHON_VER }}
qbittorrent-version: ${{ needs.verify.outputs.qbittorrent-latest-version }}
qbittorrent-host: ${{ needs.verify.outputs.qbittorrent-host }}
qbittorrent-username: ${{ needs.verify.outputs.qbittorrent-username }}
qbittorrent-password: ${{ needs.verify.outputs.qbittorrent-password }}
is-qbt-dev: false
coverage:
name: Combine & Check Coverage
runs-on: ubuntu-latest
needs: [ Tests-qBittorrent, Tests-Python ]
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Python
uses: actions/[email protected]
with:
python-version: 3.x
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -e .[dev]
- name: Retrieve coverage data
uses: actions/[email protected]
with:
pattern: coverage-data-*
merge-multiple: true
- name: Combine coverage
run: python -m coverage combine
- name: Generate coverage report
id: coverage
run: |
python -m coverage html --skip-covered --skip-empty
python -m coverage report --fail-under=100
- name: Upload HTML coverage report
if: always() && steps.coverage.outcome == 'failure'
uses: actions/[email protected]
with:
name: html-coverage-report
path: ./htmlcov
- name: Upload Coverage to Codecov
if: contains(fromJson('["push", "pull_request"]'), github.event_name)
uses: codecov/[email protected]
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
install-dev:
#######
# Verify package can be installed on all platforms
#######
name: Verify Dev Install
needs: [ verify ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Checkout Repo
uses: actions/[email protected]
- name: Set up Python ${{ env.LATEST_PYTHON_VER }}
uses: actions/[email protected]
with:
python-version: ${{ env.LATEST_PYTHON_VER }}
cache: pip
cache-dependency-path: ${{ github.workspace }}/setup.cfg
- name: Install in Dev Mode
run: |
python -m pip install -U pip wheel setuptools
python -m pip install -e .[dev]
- name: Import Package
run: python -c "from qbittorrentapi import Client; assert Client().host == 'localhost:8080'"