Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Change the GitHub Actions trigger #261

Merged
merged 3 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ name: Build and Test

on:
push:
branches:
- master
pull_request:
branches:
- master
types: [closed]

jobs:
matrix-builder:
Expand All @@ -24,7 +25,7 @@ jobs:
env:
PY_VERSIONS: "[\"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\", \"pypy-3.8-v7.3.11\", \"pypy-3.9-v7.3.11\"]"
OS_NAMES: "[\"ubuntu-20.04\"]" #, windows-latest, macOS-latest]
CELERY_VERSIONS: "[\">=3.1.0,<4.0.0\", \">=4.0.0,<5.0.0\", \">=5.0.0,<6.0.0\"]"
CELERY_VERSIONS: "[\">=4.0.0,<5.0.0\", \">=5.0.0,<6.0.0\"]"
run: |
python -m pip install --upgrade pip
MATRIX=$(python .github/workflows/resolve_versions.py matrix -c "$PY_VERSIONS" -o "$OS_NAMES" -n "celery" -s "$CELERY_VERSIONS")
Expand Down Expand Up @@ -109,6 +110,9 @@ jobs:
pip install "celery${{ matrix.celery }}"
pip install pytest-github-actions-annotate-failures

- name: Check with black
run: black --check .

- name: Check with mypy
if: ${{ !startsWith(matrix.python-version, 'pypy') && matrix.python-version >= '3.7' }}
run: mypy
Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/resolve_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,7 @@ def process_matrix(args: Namespace) -> None:
for c, o, n, s in matrix:
compatible_versions = get_compatible_versions(c, o, n, s)
if compatible_versions:
# This is because celery 3 depends on use_2to3,
# which is no longer supported by 3.9, 3.10 and 3.11
# and by newer pypy versions.
if (
n == "celery"
and (
c.replace(".", "").startswith("39")
or c.replace(".", "").startswith("310")
or c.replace(".", "").startswith("311")
or c.startswith("pypy-3")
)
and all(cv.startswith("3") for cv in compatible_versions)
) or (
# This is because inspect.getfullargspec has been removed in Python 3.11
# and `vine.five` 4.x was depending on it. This is fixed in 5.x.
n == "celery"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ celery_pubsub.publish('some.very.good.test', 42) # task 3 only
* 2.0.0
* Drop support for CPython 2.7, 3.4, 3.5, 3.6
* Drop support for Pypy 2.7 and 3.6.
* Drop support for Celery 3.
* Add support for Pypy 3.8 and 3.9.
* Add support for CPython 3.11.
* Type hints are now directly in the code. No more stubs files.
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
celery>=3.1.0
celery>=4.0.0
38 changes: 13 additions & 25 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,27 @@

import celery
from celery import Task
from celery.worker import WorkController

from celery_pubsub import subscribe, unsubscribe
from celery_pubsub import subscribe
from pkg_resources import get_distribution, parse_version

P = ParamSpec("P")
R = TypeVar("R")
task: Callable[..., Callable[[Callable[P, R]], Task[P, R]]]

if not typing.TYPE_CHECKING:
if get_distribution("celery").parsed_version < parse_version("4.0.0"):
celery.current_app.conf.update(
CELERY_ALWAYS_EAGER=True,
)
task = celery.task

@pytest.fixture
def celery_worker() -> WorkController:
pass

else: # pragma: no cover
task = celery.shared_task

@pytest.fixture(scope="session")
def celery_config():
return {
"broker_url": "memory://",
"result_backend": "rpc://",
"broker_transport_options": {"polling_interval": 0.05},
}

if get_distribution("celery").parsed_version >= parse_version("5.0.0"):
pytest_plugins = ["celery.contrib.pytest"]
task = celery.shared_task

@pytest.fixture(scope="session")
def celery_config():
return {
"broker_url": "memory://",
"result_backend": "rpc://",
"broker_transport_options": {"polling_interval": 0.05},
}

if get_distribution("celery").parsed_version >= parse_version("5.0.0"):
pytest_plugins = ["celery.contrib.pytest"]


@pytest.fixture(scope="session")
Expand Down