-
-
Notifications
You must be signed in to change notification settings - Fork 46
336 lines (264 loc) · 9.04 KB
/
stable.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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
name: Stable Deployment Workflow
on:
pull_request:
branches:
- master
push:
branches:
- master
schedule:
- cron: "0 0 * * *"
jobs:
lint:
name: Lint PyFunceble
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
python_version:
- "3.12"
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Clone repository
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install pylint
- name: Lint PyFunceble with Pylint
run: pylint PyFunceble
- name: Lint tests with Pylint
run: pylint tests
deps_safety_check:
name: Check the safety of our dependencies.
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
python_version:
- "3.12"
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Clone repository
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install safety
- name: Check the safety of our dependencies.
run: safety check -i 51668 -i 62044 -i 67599
test:
needs: [lint, deps_safety_check]
name: "[${{ matrix.os }}-py${{ matrix.python_version }}] Test PyFunceble"
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
python_version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v4
name: Clone repository
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install tox coveralls
- name: Test PyFunceble as defined by tox.ini
run: |
tox -c tox.ini
- name: Upload Coverage
continue-on-error: true
run: |
coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_PARALLEL: true
coveralls:
needs: test
name: Finish Coveralls
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
python_version:
- "3.12"
os:
- ubuntu-latest
steps:
- name: Sending finish flag to coveralls.io
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
deploy_to_pypi:
needs: test
name: "Deploy 📦 to the PyPi"
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
python_version:
- "3.12"
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Clone repository
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install twine wheel setuptools
- name: Build 📦
run: |
python setup.py sdist bdist_wheel
- name: Check 📦
run: |
twine check dist/*
- name: Publish 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
deploy_to_docker_hub:
needs: test
name: "Deploy 📦 to the Docker Hub"
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
python_version:
- "3.12"
os:
- ubuntu-latest
env:
DOCKER_PYTHON_VERSION: "3.11"
BUILDER_CLONE_DIRNAM2: pyfunceble_docker
OUR_DOCKER_USERNAME: ${{ secrets.OUR_DOCKER_USERNAME }}
OUR_DOCKER_PASSWORD: ${{ secrets.OUR_DOCKER_PASSWORD }}
OUR_DOCKER_EMAIL: ${{ secrets.OUR_DOCKER_EMAIL }}
steps:
- uses: actions/checkout@v4
name: Clone repository
- uses: actions/checkout@v4
name: Clone docker 📦 repository
with:
repository: PyFunceble/docker
path: ${{ env.BUILDER_CLONE_DIRNAME }}/
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install ${{ env.BUILDER_CLONE_DIRNAME }}/.
- name: Get version of builder
run: |
pyfunceble-docker-builder --version
- name: Build, Check and Publish 📦
run: >
pyfunceble-docker-builder -b ${{ env.BUILDER_CLONE_DIRNAME }}/builder
-p "$(python setup.py --name)"
--pyfunceble-version="$(python setup.py --version)"
--python-version="${DOCKER_PYTHON_VERSION}"
--is-latest --publish --commit="$(git log -1 --format=format:'%H')"
deploy_to_aur:
needs: deploy_to_pypi
name: "Deploy 📦 to the AUR"
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
container:
image: archlinux
steps:
- name: Store the SSH key
run: |
echo "${{ secrets.AUR_SSH_KEY }}" | install -Dm600 /dev/stdin /root/.ssh/id_rsa
- name: Get time for cache
id: cache_time
run: echo "time=$(date +%F-%T)" >> ${GITHUB_OUTPUT}
- name: Set up cache
uses: actions/cache@master
with:
path: /var/cache/pacman/pkg
key: pacman-cache-x86_64-${{ steps.cache_time.outputs.time }}
restore-keys: pacman-cache-x86_64-
- name: Install dependencies
run: |
pacman -Syu --needed --noconfirm && \
pacman -S --needed --noconfirm git binutils pacman-contrib openssh rsync python python-setuptools jq
- uses: actions/checkout@v4
name: Clone repository
- name: Publish 📦 to the AUR - if necessary
env:
GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
run: |
aurRepoDir=/tmp/pyfunceble
githubRepoDir="${PWD}"
buildDir="/tmp/build"
latest=$(python3 setup.py --version)
if [[ $(python3 setup.py --name) == "PyFunceble-dev" ]]
then
licenseURL="https://raw.githubusercontent.com/funilrys/PdyFunceble/dev/LICENSE"
newURL=$(curl -s https://pypi.org/pypi/PyFunceble-dev/json | jq -r ".releases.\"${latest}\"[] | select(.filename | strings | test(\".tar\")).url")
else
licenseURL="https://raw.githubusercontent.com/funilrys/PyFunceble/master/LICENSE"
newURL=$(curl -s https://pypi.org/pypi/PyFunceble/json | jq -r ".releases.\"${latest}\"[] | select(.filename | strings | test(\".tar\")).url")
fi
git config --global --add safe.directory ${GITHUB_WORKSPACE}
git config --global --add safe.directory ${aurRepoDir}
git config --global --add safe.directory ${githubRepoDir}
git config --global user.name ${{ github.actor }}
git config --global user.email ${{ secrets.GIT_EMAIL }}
git clone ssh://[email protected]/pyfunceble.git ${aurRepoDir}
rsync --progress --delete -r --exclude={'*.gz','*.xz','.github','pkg','src','.git','LICENSE'} ${aurRepoDir}/ ${buildDir}/
cd ${buildDir}
current=$(grep -P "^pkgver" PKGBUILD | cut -d= -f2)
echo "Previous version: ${current}"
echo "New version: ${latest}"
useradd makepkg
chown makepkg:root . -R
sed "/^pkgver=/s/.*/pkgver=${latest}/" -i PKGBUILD
sed "/^pkgrel=/s/.*/pkgrel=1/" -i PKGBUILD
sed "s,^source=(.*),source=('${newURL}' '${licenseURL}')," -i PKGBUILD
su makepkg -c "updpkgsums"
su makepkg -c "makepkg --printsrcinfo" > .SRCINFO
rsync --progress --delete -r --exclude={'*.gz','*.xz','.github','pkg','src','.git','LICENSE'} ${buildDir}/ ${aurRepoDir}/
cd ${aurRepoDir}
git add .
git diff --quiet --exit-code --cached || git commit -m "Update PyFunceble to v${latest}"
git push origin master