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 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611
|
name: Dev Deployment Workflow
on:
pull_request:
branches:
- dev
push:
branches:
- dev
schedule:
- cron: "0 0 * * *"
permissions:
contents: read
checks: write
pull-requests: write
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@v6
name: Clone repository
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install .[test,dev]
- name: Lint PyFunceble with Pylint
run: pylint PyFunceble
- name: Lint tests with Pylint
run: pylint tests
sec_check:
name: Check the safety of PyFunceble
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
python_version:
- "3.12"
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v6
name: Clone repository
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install .[test,dev]
- name: Check the safety of the codebase with Bandit
run: bandit --ini=setup.cfg -r PyFunceble
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@v6
name: Clone repository
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install .
pip install safety
- name: Check the safety of our dependencies.
run: safety check -i 51668 -i 62044 -i 67599 -i 70612
test:
needs: [lint, deps_safety_check, sec_check]
name: "[${{ matrix.os }}-py${{ matrix.python_version }}] Test PyFunceble"
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
python_version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v6
name: Clone repository
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install .[test]
pip install 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:
continue-on-error: true
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
run_cli:
needs: test
name: "[${{ matrix.os }}-py${{ matrix.python_version }}] Run PyFunceble"
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
python_version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
os:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v6
name: Clone repository
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install .[test]
- name: Run PyFunceble as defined by tox_run.ini
run: tox -c tox_run.ini
run_cli_mariadb:
needs: test
name: "[${{ matrix.os }}-py${{ matrix.python_version }}] Run PyFunceble (with mariadb)"
runs-on: "${{ matrix.os }}"
services:
mariadb:
image: ghcr.io/pyfunceble/mariadb/mariadb:latest
ports:
- 3306:3306
env:
MYSQL_USER: pyfunceble
MYSQL_PASSWORD: my_pyfunceble_password
MYSQL_DATABASE: pyfunceble
MYSQL_ROOT_PASSWORD: my_awesome_root_password
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
env:
PYFUNCEBLE_DB_CHARSET: utf8mb4
PYFUNCEBLE_DB_HOST: "127.0.0.1"
PYFUNCEBLE_DB_NAME: pyfunceble
PYFUNCEBLE_DB_PASSWORD: my_pyfunceble_password
PYFUNCEBLE_DB_PORT: "3306"
PYFUNCEBLE_DB_USERNAME: pyfunceble
strategy:
fail-fast: false
matrix:
python_version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v6
name: Clone repository
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install .[test]
- name: Run PyFunceble as defined by tox_run_mariadb.ini
run: tox -c tox_run_mariadb.ini
run_cli_postgresql:
needs: test
name: "[${{ matrix.os }}-py${{ matrix.python_version }}] Run PyFunceble (with postgresql)"
runs-on: "${{ matrix.os }}"
services:
mariadb:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_USER: pyfunceble
POSTGRES_PASSWORD: my_pyfunceble_password
POSTGRES_DB: pyfunceble
MYSQL_ROOT_PASSWORD: my_awesome_root_password
options: --health-cmd="pg_isready --host=localhost --username=pyfunceble --port=5432" --health-interval=5s --health-timeout=2s --health-retries=3
env:
PYFUNCEBLE_DB_CHARSET: utf8
PYFUNCEBLE_DB_HOST: "127.0.0.1"
PYFUNCEBLE_DB_NAME: pyfunceble
PYFUNCEBLE_DB_PASSWORD: my_pyfunceble_password
PYFUNCEBLE_DB_PORT: "5432"
PYFUNCEBLE_DB_USERNAME: pyfunceble
strategy:
fail-fast: false
matrix:
python_version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v6
name: Clone repository
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install .[psql-binary,test]
- name: Run PyFunceble as defined by tox_run_postgresql.ini
run: tox -c tox_run_postgresql.ini
deploy_to_pypi:
needs: [run_cli, run_cli_mariadb, run_cli_postgresql]
name: "Deploy 📦 to the PyPi"
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
python_version:
- "3.12"
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v6
name: Clone repository
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
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_DEV_API_TOKEN }}
skip-existing: true
deploy_docs_container:
needs: [run_cli, run_cli_mariadb, run_cli_postgresql]
name: "Deploy 🗎 (📦)"
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
python_version:
- "3.12"
os:
- ubuntu-latest
env:
DOCKER_PYTHON_VERSION: "3.12"
BUILDER_CLONE_DIRNAME: pyfunceble_docker
steps:
- uses: actions/checkout@v6
name: Clone repository
- uses: actions/checkout@v6
name: Clone docker 📦 repository
with:
repository: PyFunceble/docker
path: ${{ env.BUILDER_CLONE_DIRNAME }}/
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install setuptools wheel
pip install ${{ env.BUILDER_CLONE_DIRNAME }}/.
- name: Get version of builder
run: |
pyfunceble-docker-builder --version
- name: Read package name
run: |
python setup.py --name
- name: Read package version
run: |
python setup.py --version
- name: Read commit ID
run: |
git log -1 --format=format:'%H'
- name: Build, Check and Publish 📦 to Docker Hub
run: >
set -x ;
pyfunceble-docker-builder -b ${{ env.BUILDER_CLONE_DIRNAME }}/docs_builder
-p docs
--pyfunceble-version="$(python setup.py --version)"
--python-version="${DOCKER_PYTHON_VERSION}"
--is-latest --publish --commit="$(git log -1 --format=format:'%H')"
env:
OUR_DOCKER_USERNAME: ${{ secrets.OUR_DOCKER_USERNAME }}
OUR_DOCKER_PASSWORD: ${{ secrets.OUR_DOCKER_PASSWORD }}
OUR_DOCKER_EMAIL: ${{ secrets.OUR_DOCKER_EMAIL }}
- name: Build, Check and Publish 📦 to Internal Hub
run: >
set -x ;
pyfunceble-docker-builder -b ${{ env.BUILDER_CLONE_DIRNAME }}/docs_builder
-p docs
--pyfunceble-version="$(python setup.py --version)"
--python-version="${DOCKER_PYTHON_VERSION}"
--is-latest --publish --commit="$(git log -1 --format=format:'%H')"
env:
OUR_DOCKER_USERNAME: ${{ secrets.INTERNAL_DOCKER_USERNAME }}
OUR_DOCKER_PASSWORD: ${{ secrets.INTERNAL_DOCKER_PASSWORD }}
OUR_DOCKER_REGISTRY: ${{ secrets.INTERNAL_DOCKER_REGISTRY }}
deploy_to_docker_hub:
needs: [run_cli, run_cli_mariadb, run_cli_postgresql]
name: "Deploy 📦 to the Docker Hub"
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
python_version:
- "3.12"
os:
- ubuntu-latest
env:
DOCKER_PYTHON_VERSION: "3.12"
BUILDER_CLONE_DIRNAME: 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@v6
name: Clone repository
- uses: actions/checkout@v6
name: Clone docker 📦 repository
with:
repository: PyFunceble/docker
path: ${{ env.BUILDER_CLONE_DIRNAME }}/
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install setuptools wheel
pip install ${{ env.BUILDER_CLONE_DIRNAME }}/.
- name: Get version of builder
run: |
pyfunceble-docker-builder --version
- name: Read package name
run: |
python setup.py --name
- name: Read package version
run: |
python setup.py --version
- name: Read commit ID
run: |
git log -1 --format=format:'%H'
- name: Build, Check and Publish 📦
run: >
set -x ;
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/dev'
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@v6
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-dev
githubRepoDir="${PWD}"
buildDir="/tmp/build"
latest=$(python3 setup.py --version)
if [[ $(python3 setup.py --name) == "PyFunceble-dev" ]]
then
licenseURL="https://raw.githubusercontent.com/funilrys/PyFunceble/dev/LICENSE"
else
licenseURL="https://raw.githubusercontent.com/funilrys/PyFunceble/master/LICENSE"
fi
genericURL='https://files.pythonhosted.org/packages/source/${upstreamName::1}/${upstreamName}/${upstreamName}-${pkgver}.tar.gz'
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://aur@aur.archlinux.org/pyfunceble-dev.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=(\"${genericURL}\" \"${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-dev to v${latest}"
git push origin master
|