Skip to content

Commit 3fa5c9b

Browse files
committed
chore: Fix issues on CI
Signed-off-by: André Carvalho <[email protected]>
1 parent 9b2768c commit 3fa5c9b

File tree

6 files changed

+54
-29
lines changed

6 files changed

+54
-29
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@ jobs:
1919
python-version: ["3.8", "3.9", "3.10"]
2020
steps:
2121
- uses: actions/checkout@v3
22-
23-
- name: Install poetry
24-
run: pip install poetry
25-
2622
- uses: actions/setup-python@v4
2723
with:
2824
python-version: ${{ matrix.python-version }}
2925
cache: "pip"
3026
cache-dependency-path: "poetry.lock"
3127

28+
- name: Install poetry
29+
run: pip install poetry
30+
3231
- name: Install dependencies
3332
run: poetry install
3433

@@ -39,19 +38,23 @@ jobs:
3938
run: make docker-up
4039

4140
- name: Test
42-
run: make test
41+
# Wait for RabbitMQ to start.
42+
run: sleep 10 && make test
4343

4444
test-build-docs:
4545
runs-on: ubuntu-latest
4646
steps:
4747
- uses: actions/checkout@v3
48-
- name: Install poetry
49-
run: pip install poetry
50-
- uses: actions/setup-python@v3
48+
- uses: actions/setup-python@v4
5149
with:
52-
python-version: 3.x
50+
python-version: "3.10"
5351
cache: "pip"
5452
cache-dependency-path: "poetry.lock"
53+
54+
- name: Install poetry
55+
run: pip install poetry
56+
5557
- name: Install dependencies
5658
run: poetry install
57-
- run: mkdocs build --verbose --clean --strict
59+
60+
- run: poetry run mkdocs build --verbose --clean --strict

.github/workflows/docs.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,24 @@ on:
88
env:
99
POETRY_VIRTUALENVS_CREATE: false
1010

11-
1211
jobs:
1312
deploy:
1413
permissions:
1514
contents: write
1615
runs-on: ubuntu-latest
1716
steps:
1817
- uses: actions/checkout@v3
19-
- name: Install poetry
20-
run: pip install poetry
2118
- uses: actions/setup-python@v3
2219
with:
23-
python-version: 3.x
24-
cache: 'pip'
25-
cache-dependency-path: 'poetry.lock'
20+
python-version: "3.10"
21+
cache: "pip"
22+
cache-dependency-path: "poetry.lock"
23+
24+
- name: Install poetry
25+
run: pip install poetry
26+
2627
- name: Install dependencies
2728
run: poetry install
29+
2830
- name: Build and push docs
29-
run: mkdocs gh-deploy --force
31+
run: poetry run mkdocs gh-deploy --force

mognet/backend/redis_result_backend.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import gzip
66
import json
77
import logging
8+
import sys
89
from asyncio import shield
910
from datetime import timedelta
1011
from typing import (
@@ -30,7 +31,6 @@
3031
from pydantic.tools import parse_raw_as
3132
from redis.asyncio import from_url
3233
from redis.exceptions import ConnectionError, TimeoutError
33-
from typing_extensions import TypeAlias
3434

3535
from mognet.backend.backend_config import Encoding, ResultBackendConfig
3636
from mognet.backend.base_result_backend import AppParameters, BaseResultBackend
@@ -40,15 +40,18 @@
4040
from mognet.model.result_state import READY_STATES, ResultState
4141
from mognet.tools.urls import censor_credentials
4242

43+
if sys.version_info < (3, 10):
44+
from typing_extensions import TypeAlias
45+
else:
46+
from typing import TypeAlias
47+
4348
if TYPE_CHECKING:
4449
from redis.asyncio import Redis # noqa: F401
4550

4651
_log = logging.getLogger(__name__)
4752

4853

49-
_EncodedHSetPayload: TypeAlias = Mapping[
50-
Union[str, bytes], Union[bytes, float, int, str]
51-
]
54+
_EncodedHSetPayload = Mapping[Union[str, bytes], Union[bytes, float, int, str]]
5255

5356
_F = TypeVar("_F", bound=Callable[..., Awaitable[Any]])
5457
_Redis: TypeAlias = "Redis[Any]"

mognet/primitives/request.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
from datetime import datetime, timedelta
2-
from typing import Any, Dict, Generic, List, Optional, Tuple, TypeVar, Union
2+
from typing import (
3+
TYPE_CHECKING,
4+
Any,
5+
Dict,
6+
Generic,
7+
List,
8+
Optional,
9+
Tuple,
10+
TypeVar,
11+
Union,
12+
)
313
from uuid import UUID, uuid4
414

515
from pydantic import BaseModel, conint
616
from pydantic.fields import Field
7-
from typing_extensions import TypeAlias
817

918
TReturn = TypeVar("TReturn")
1019

11-
Priority: TypeAlias = conint(ge=0, le=10) # type: ignore
20+
if TYPE_CHECKING:
21+
Priority = int
22+
else:
23+
Priority = conint(ge=0, le=10)
1224

1325

1426
class Request(BaseModel, Generic[TReturn]):

mognet/state/redis_state_backend.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22

33
import json
44
import logging
5+
import sys
56
from typing import TYPE_CHECKING, Any, Optional, TypeVar, cast
67
from uuid import UUID
78

89
from redis.asyncio import from_url
9-
from typing_extensions import TypeAlias
1010

1111
from mognet.exceptions.base_exceptions import NotConnected
1212
from mognet.state.base_state_backend import BaseStateBackend
1313
from mognet.state.state_backend_config import StateBackendConfig
1414
from mognet.tools.urls import censor_credentials
1515

16+
if sys.version_info < (3, 10):
17+
from typing_extensions import TypeAlias
18+
else:
19+
from typing import TypeAlias
20+
21+
1622
if TYPE_CHECKING:
1723
from redis.asyncio import Redis # noqa: F401
1824

mognet/testing/pytest_integration.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import asyncio
2-
from typing import AsyncIterable, Callable
2+
from typing import Any, AsyncIterable
33

44
import pytest_asyncio
55

66
from mognet import App
77

88

9-
def create_app_fixture(app: App) -> Callable[[], App]:
9+
def create_app_fixture(app: App) -> Any:
1010
"""Create a Pytest fixture for a Mognet application."""
1111

12-
@pytest_asyncio.fixture # type: ignore
1312
async def app_fixture() -> AsyncIterable[App]:
1413
async with app:
1514
start_task = asyncio.create_task(app.start())
@@ -22,4 +21,4 @@ async def app_fixture() -> AsyncIterable[App]:
2221
except BaseException: # pylint: disable=broad-except
2322
pass
2423

25-
return app_fixture # type: ignore
24+
return pytest_asyncio.fixture(app_fixture)

0 commit comments

Comments
 (0)