Skip to content

Commit 5504058

Browse files
committed
ci: add test and lint workflow
1 parent 71fc135 commit 5504058

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Test and Lint
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
quality:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
15+
services:
16+
typesense:
17+
image: typesense/typesense:27.1
18+
ports:
19+
- 8108:8108
20+
volumes:
21+
- /tmp/typesense-data:/data
22+
- /tmp/typesense-analytics:/analytics
23+
env:
24+
TYPESENSE_API_KEY: xyz
25+
TYPESENSE_DATA_DIR: /data
26+
TYPESENSE_ENABLE_CORS: true
27+
TYPESENSE_ANALYTICS_DIR: /analytics
28+
TYPESENSE_ENABLE_SEARCH_ANALYTICS: true
29+
30+
steps:
31+
- name: Wait for Typesense
32+
run: |
33+
timeout 20 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8108/health)" != "200" ]]; do sleep 1; done' || false
34+
- uses: actions/checkout@v4
35+
36+
- name: Set up Python ${{ matrix.python-version }}
37+
uses: actions/setup-python@v4
38+
with:
39+
python-version: ${{ matrix.python-version }}
40+
cache: 'pip'
41+
42+
- name: Install dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install -r requirements/dev.txt
46+
47+
- name: Lint with Flake8
48+
run: |
49+
flake8 src/typesense
50+
51+
- name: Check types with mypy
52+
run: |
53+
mypy src/typesense
54+
55+
- name: Run tests and coverage (excluding OpenAI)
56+
run: |
57+
coverage run -m pytest -m "not open_ai"

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ docstring-style = sphinx
1919
max-complexity = 6
2020

2121
# # Excluding some directories:
22-
exclude = .git,__pycache__,venv,.eggs,*.egg
22+
exclude = .git,__pycache__,venv,.eggs,*.egg,src/typesense/__init__.py
2323
ignore = Q000, WPS602, WPS432, WPS305, WPS221, WPS230, WPS234, WPS433, WPS440, W503, WPS331, WPS306, WPS237, WPS202, RST301, RST306, WPS214, WPS235, WPS226, WPS337, WPS320, F821, WPS201
2424
per-file-ignores =
2525
tests/*.py: S101, WPS226, WPS118, WPS202, WPS204, WPS218, WPS211, WPS604, WPS431, WPS210, WPS201, WPS437

0 commit comments

Comments
 (0)