Skip to content

Commit 0edffd3

Browse files
committed
Add Github Actions
1 parent a1dc3c9 commit 0edffd3

File tree

14 files changed

+59
-25
lines changed

14 files changed

+59
-25
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Hublot
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build-and-test:
7+
8+
runs-on: ubuntu-24.04
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
python-version: ["3.9", "3.10", "3.11", "3.12"]
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v3
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install pip==24.3.1
23+
python -m pip install -r test/requirements.txt
24+
python -m pip install .[pycurl]
25+
- name: Lint
26+
run: |
27+
ruff check hublot/ test/
28+
ruff format --check --line-length=132 hublot/ test/
29+
pylint hublot/ test/
30+
mypy --show-error-codes hublot/ test/
31+
- name: Test
32+
run: |
33+
pytest --cov=hublot \
34+
--cov-report json:coverage/ocerage.json \
35+
--cov-report xml:coverage/coverage.xml \
36+
--cov-report term \
37+
test/
38+
- name: Update Coverage Badge
39+
#if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
40+
uses: we-cli/coverage-badge-action@main

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.egg-info/
2+
coverage/
23
.coverage
34
__pycache__
45
build/

.pre-commit-config.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@ repos:
33

44
- repo: local
55
hooks:
6-
- id: ruff
7-
name: ruff
6+
- id: ruff-check
7+
name: ruff-check
88
entry: ruff
99
language: python
1010
types: [python]
11+
args: [check]
12+
13+
- id: ruff-format
14+
name: ruff-format
15+
entry: ruff
16+
language: python
17+
types: [python]
18+
args: [format]
1119

1220
- id: pylint
1321
name: pylint
@@ -22,13 +30,6 @@ repos:
2230
types: [python]
2331
args: [--show-error-codes]
2432

25-
- id: black
26-
name: black
27-
entry: black
28-
language: python
29-
types: [python]
30-
args: [--line-length=132]
31-
3233
- id: pytest
3334
name: pytest
3435
entry: pytest

hublot/cache/cache.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414

1515
class Cache:
16-
1716
def __init__(
1817
self,
1918
storage: Storage,

hublot/cache/key.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
@dataclass(frozen=True, order=True)
1818
class CacheKey:
19-
2019
parts: Tuple[str, ...]
2120
sequence_num: int = 0
2221

hublot/cache/storage.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,24 @@
1616

1717

1818
class Storage(ABC): # pragma: no-cover
19-
2019
@abstractmethod
21-
def read(self, key: CacheKey, max_age: Optional[timedelta] = None) -> Optional[Response]: ...
20+
def read(self, key: CacheKey, max_age: Optional[timedelta] = None) -> Optional[Response]:
21+
...
2222

2323
@abstractmethod
24-
def write(self, key: CacheKey, response: Response) -> None: ...
24+
def write(self, key: CacheKey, response: Response) -> None:
25+
...
2526

2627
@abstractmethod
27-
def iter_all_keys(self) -> Iterable[CacheKey]: ...
28+
def iter_all_keys(self) -> Iterable[CacheKey]:
29+
...
2830

2931
@abstractmethod
30-
def prune(self, max_age: timedelta) -> None: ...
32+
def prune(self, max_age: timedelta) -> None:
33+
...
3134

3235

3336
class DiskStorage(Storage):
34-
3537
def __init__(self, root_path: Path) -> None:
3638
self.root_path = root_path
3739

hublot/decorator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class ThreadLocalStackFrame:
2222

2323

2424
class ThreadLocalStack(threading.local):
25-
2625
def __init__(self) -> None:
2726
super().__init__()
2827
# each thread will magically get a different stack

hublot/engines/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111

1212
class Engine(ABC):
13-
1413
id: ClassVar[str]
1514

1615
@abstractmethod

hublot/engines/curlcmd.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class CurlCmdEngineError(HublotException):
2626

2727

2828
class CurlCmdEngine(Engine):
29-
3029
id = "curlcmd"
3130

3231
def __init__(self, curl_cmd: str = "curl") -> None:

hublot/engines/pool.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313

1414
class EnginePool(Engine):
15-
1615
id = "engine-pool"
1716

1817
def __init__(self, engines: Sequence[Engine]):

0 commit comments

Comments
 (0)