Skip to content

Commit

Permalink
Refactored CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Nusnus committed Sep 25, 2024
1 parent 424de01 commit 944f7f6
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 102 deletions.
86 changes: 0 additions & 86 deletions .github/workflows/ci.yaml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Linter

on: [push, pull_request, workflow_dispatch]

jobs:
pre-commit:
runs-on: blacksmith-4vcpu-ubuntu-2204
steps:

- name: Checkout branch
uses: actions/checkout@v4

- name: Run pre-commit
uses: pre-commit/action@v3.0.1

lint:
runs-on: blacksmith-4vcpu-ubuntu-2204
strategy:
matrix:
python-version: ["3.12"]
steps:
- name: Install system packages
run: sudo apt-get update && sudo apt-get install libcurl4-openssl-dev libssl-dev
- name: Check out code from GitHub
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
id: python
uses: useblacksmith/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install --upgrade pip wheel tox tox-docker
- name: Run flake8
run: tox -v -e flake8 -- -v
- name: Run pydocstyle
run: tox -v -e pydocstyle -- -v
- name: Run apicheck
run: tox -v -e apicheck -- -v
- name: Run mypy
run: tox -v -e mypy -- -v
110 changes: 110 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Kombu

on:
push:
branches: [ 'main']
paths:
- '**.py'
- '**.txt'
- '.github/workflows/python-package.yml'
- '**.toml'
- "tox.ini"
pull_request:
branches: [ 'main' ]
paths:
- '**.py'
- '**.txt'
- '**.toml'
- '.github/workflows/python-package.yml'
- "tox.ini"
workflow_dispatch:


permissions:
contents: read # to fetch code (actions/checkout)

jobs:
Unit:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.10']
os: ["blacksmith-4vcpu-ubuntu-2204"]

steps:
- name: Install apt packages
if: startsWith(matrix.os, 'blacksmith-4vcpu-ubuntu')
run: sudo apt-get update && sudo apt-get install libcurl4-openssl-dev libssl-dev
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: useblacksmith/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: 'pip'
cache-dependency-path: '**/setup.py'

- name: Install tox
run: python -m pip install --upgrade pip wheel tox tox-docker
- name: >
Run tox for
"${{ matrix.python-version }}-unit"
timeout-minutes: 5
run: |
tox --verbose --verbose
- uses: codecov/codecov-action@v4
with:
flags: unittests # optional
fail_ci_if_error: false # optional (default = false)
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true # optional (default = false)

Integration:
needs:
- Unit
if: needs.Unit.result == 'success'

runs-on: blacksmith-4vcpu-ubuntu-2204
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
toxenv: [
'py-amqp',
'py-redis',
'py-mongodb',
'py-kafka'
]
experimental: [false]
include:
- python-version: pypy3.10
experimental: true

steps:
- name: Install apt packages
run: sudo apt-get update && sudo apt-get install libcurl4-openssl-dev libssl-dev

- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: useblacksmith/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: 'pip'
cache-dependency-path: '**/setup.py'
- name: Install tox
run: python -m pip install --upgrade pip wheel tox tox-docker
- name: >
Run tox for
"${{ matrix.python-version }}-linux-integration-${{ matrix.toxenv }}"
timeout-minutes: 30
run: >
tox --verbose --verbose -e
"${{ matrix.python-version }}-linux-integration-${{ matrix.toxenv }}" -vv
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ venv/
env
.eggs
.python-version
.coverage.*
control/
.env
3 changes: 3 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ Pyro4==4.82
pytest-freezer==0.4.8
pytest-sugar==1.0.0
pytest==8.3.3
pytest-xdist==3.6.1
pre-commit>=3.5.0,<3.6.0; python_version < '3.9'
pre-commit>=3.8.0; python_version >= '3.9'
45 changes: 29 additions & 16 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
[tox]
envlist =
{pypy3.9,3.8,3.9,3.10,3.11,3.12}-unit
{pypy3.9,3.8,3.9,3.10,3.11,3.12}-linux-integration-py-amqp
{pypy3.9,3.8,3.9,3.10,3.11}-linux-integration-redis
{pypy3.9,3.8,3.9,3.10,3.11}-linux-integration-mongodb
{3.8,3.9,3.10,3.11,3.12,pypy3.10}-unit
{3.8,3.9,3.10,3.11,3.12,pypy3.10}-linux-integration-py-amqp
{3.8,3.9,3.10,3.11,3.12,pypy3.10}-linux-integration-redis
{3.8,3.9,3.10,3.11,3.12,pypy3.10}-linux-integration-mongodb
{3.8,3.9,3.10,3.11,3.12}-linux-integration-kafka
flake8
apicheck
pydocstyle
mypy

requires =
tox-docker<=4.1
Expand All @@ -17,7 +18,7 @@ requires =
python =
3.8: py38
3.9: py39
3.10: py310, mypy
3.10: py310
3.11: py311
3.12: py312

Expand All @@ -28,28 +29,30 @@ passenv =
DISTUTILS_USE_SDK
deps=
-r{toxinidir}/requirements/dev.txt
apicheck,pypy3.9,3.8,3.9,3.10,3.11,3.12: -r{toxinidir}/requirements/default.txt
apicheck,pypy3.9,3.8,3.9,3.10,3.11,3.12: -r{toxinidir}/requirements/test.txt
apicheck,pypy3.9,3.8,3.9,3.10,3.11,3.12: -r{toxinidir}/requirements/test-ci.txt
apicheck,pypy3.10,3.8,3.9,3.10,3.11,3.12: -r{toxinidir}/requirements/default.txt
apicheck,pypy3.10,3.8,3.9,3.10,3.11,3.12: -r{toxinidir}/requirements/test.txt
apicheck,pypy3.10,3.8,3.9,3.10,3.11,3.12: -r{toxinidir}/requirements/test-ci.txt
apicheck,3.8-linux,3.9-linux,3.10-linux,3.11-linux,3.12-linux: -r{toxinidir}/requirements/extras/confluentkafka.txt
apicheck,linkcheck: -r{toxinidir}/requirements/docs.txt
flake8,pydocstyle,mypy: -r{toxinidir}/requirements/pkgutils.txt

commands =
unit: python -bb -m pytest -rxs -xv --cov=kombu --cov-report=xml --no-cov-on-fail {posargs}
integration-py-amqp: pytest -xv -E py-amqp t/integration {posargs:-n2}
integration-redis: pytest -xv -E redis t/integration {posargs:-n2}
integration-mongodb: pytest -xv -E mongodb t/integration {posargs:-n2}
integration-kafka: pytest -xv -E kafka t/integration {posargs:-n2}
unit: python -bb -m pytest -rxs -xv --cov=kombu --cov-report=xml --no-cov-on-fail --cov-report term {posargs}
integration-py-amqp: pytest -xv -E py-amqp t/integration -n auto {posargs}
integration-redis: pytest -xv -E redis t/integration -n auto {posargs}
integration-mongodb: pytest -xv -E mongodb t/integration -n auto {posargs}
integration-kafka: pytest -xv -E kafka t/integration -n auto {posargs}

basepython =
pypy3.9: pypy3.9
pypy3.8: pypy3.8
pypy3.9: pypy3.9
pypy3.10: pypy3.10
3.8: python3.8
3.9: python3.9
3.10,apicheck,pydocstyle,flake8,linkcheck,cov,mypy: python3.10
3.10: python3.10
3.11: python3.11
3.12: python3.12
apicheck,pydocstyle,flake8,linkcheck,cov,mypy: python3.12

install_command = python -m pip --disable-pip-version-check install {opts} {packages}

Expand Down Expand Up @@ -135,4 +138,14 @@ commands =
pydocstyle {toxinidir}/kombu

[testenv:mypy]
commands = python -m mypy --config-file setup.cfg
commands = python -m mypy --config-file setup.cfg

[testenv:lint]
allowlist_externals = pre-commit
commands =
pre-commit {posargs:run --all-files --show-diff-on-failure}

[testenv:clean]
deps = cleanpy
commands =
python -m cleanpy .

0 comments on commit 944f7f6

Please sign in to comment.