62 lines
1.4 KiB
YAML
62 lines
1.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
branches: [main, master]
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
cache: "poetry"
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install poetry
|
|
poetry install --with dev
|
|
- name: Lint (flake8)
|
|
run: poetry run flake8 src tests
|
|
- name: Type check (mypy)
|
|
run: poetry run mypy src
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
needs: lint
|
|
services:
|
|
mysql:
|
|
image: mysql:8.0
|
|
env:
|
|
MYSQL_ROOT_PASSWORD: root
|
|
MYSQL_DATABASE: djangoadmin_test
|
|
ports:
|
|
- 3306:3306
|
|
redis:
|
|
image: redis:7
|
|
ports:
|
|
- 6379:6379
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
cache: "poetry"
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install poetry
|
|
poetry install --with dev
|
|
- name: Run tests
|
|
env:
|
|
DB_HOST: 127.0.0.1
|
|
DB_PORT: 3306
|
|
DB_USERNAME: root
|
|
DB_PASSWORD: root
|
|
DB_DATABASE: djangoadmin_test
|
|
REDIS_HOST: 127.0.0.1
|
|
REDIS_PORT: 6379
|
|
run: poetry run pytest -v --cov=src --cov-report=term-missing
|