| 1 |
name: Test |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
push: |
| 6 |
branches: |
| 7 |
- master |
| 8 |
|
| 9 |
jobs: |
| 10 |
test: |
| 11 |
name: Pytest |
| 12 |
strategy: |
| 13 |
fail-fast: false |
| 14 |
matrix: |
| 15 |
os: ["ubuntu-24.04"] |
| 16 |
python: ["3.10", "3.11.1", "3.12"] |
| 17 |
redis: [5, 6, 7, 7.2] |
| 18 |
runs-on: ${{ matrix.os }} |
| 19 |
|
| 20 |
services: |
| 21 |
redis: |
| 22 |
image: redis:${{ matrix.redis }} |
| 23 |
ports: |
| 24 |
- 6379:6379 |
| 25 |
options: --entrypoint redis-server |
| 26 |
|
| 27 |
steps: |
| 28 |
- uses: actions/checkout@v2 |
| 29 |
- uses: actions/setup-python@v5 |
| 30 |
with: |
| 31 |
python-version: ${{ matrix.python }} |
| 32 |
architecture: "x64" |
| 33 |
- name: Cache deps |
| 34 |
uses: actions/cache@v4 |
| 35 |
with: |
| 36 |
path: | |
| 37 |
~/.cache/pypoetry |
| 38 |
~/.cache/pip |
| 39 |
key: deps-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('poetry.lock') }} |
| 40 |
|
| 41 |
- name: Install Poetry |
| 42 |
run: pip install poetry |
| 43 |
|
| 44 |
- name: Install dependencies |
| 45 |
run: | |
| 46 |
poetry config virtualenvs.in-project true |
| 47 |
poetry install --no-interaction --no-root |
| 48 |
poetry run python -c "import sys; print(sys.version)" |
| 49 |
lint: |
| 50 |
name: flake8 & black |
| 51 |
runs-on: ubuntu-latest |
| 52 |
|
| 53 |
steps: |
| 54 |
- uses: actions/checkout@v4 |
| 55 |
|
| 56 |
- uses: actions/setup-python@v5 |
| 57 |
with: |
| 58 |
python-version: 3.12 |
| 59 |
|
| 60 |
- name: Cache pip |
| 61 |
uses: actions/cache@v4 |
| 62 |
with: |
| 63 |
path: ~/.cache/pip |
| 64 |
key: lint-${{ runner.os }}-3.12 |
| 65 |
|
| 66 |
- name: Install tools |
| 67 |
run: pip install flake8==7.1.1 black==24.10.0 |
| 68 |
|
| 69 |
- name: Flake8 |
| 70 |
run: flake8 . |
| 71 |
|
| 72 |
- name: Black |
| 73 |
run: black --check . |