Compare commits
1 Commits
7879d54958
...
backup/fea
| Author | SHA1 | Date | |
|---|---|---|---|
| 44355deeb3 |
@@ -10,6 +10,7 @@ jobs:
|
|||||||
lint:
|
lint:
|
||||||
name: Code Quality Checks
|
name: Code Quality Checks
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -21,9 +22,7 @@ jobs:
|
|||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
|
|
||||||
- name: Install uv
|
- name: Install uv
|
||||||
run: |
|
run: python -m pip install --upgrade pip uv
|
||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
||||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: Create virtual environment
|
- name: Create virtual environment
|
||||||
run: uv venv
|
run: uv venv
|
||||||
@@ -36,40 +35,17 @@ jobs:
|
|||||||
- name: Run Ruff linting
|
- name: Run Ruff linting
|
||||||
run: |
|
run: |
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
ruff check .
|
ruff check src
|
||||||
|
|
||||||
- name: Run Ruff formatting check
|
- name: Run Ruff formatting check
|
||||||
run: |
|
run: |
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
ruff format . --check
|
ruff format src --check
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: Run Tests
|
name: Run Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
timeout-minutes: 20
|
||||||
postgres:
|
|
||||||
image: postgres:15.10
|
|
||||||
env:
|
|
||||||
POSTGRES_DB: test_db
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
|
|
||||||
redis:
|
|
||||||
image: redis:7-alpine
|
|
||||||
options: >-
|
|
||||||
--health-cmd "redis-cli ping"
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
ports:
|
|
||||||
- 6379:6379
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -81,9 +57,7 @@ jobs:
|
|||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
|
|
||||||
- name: Install uv
|
- name: Install uv
|
||||||
run: |
|
run: python -m pip install --upgrade pip uv
|
||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
||||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: Create virtual environment
|
- name: Create virtual environment
|
||||||
run: uv venv
|
run: uv venv
|
||||||
@@ -93,20 +67,6 @@ jobs:
|
|||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
uv sync --dev
|
uv sync --dev
|
||||||
|
|
||||||
- name: Wait for services to be ready
|
|
||||||
run: |
|
|
||||||
# Wait for PostgreSQL
|
|
||||||
until pg_isready -h localhost -p 5432 -U postgres; do
|
|
||||||
echo "Waiting for PostgreSQL..."
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
# Wait for Redis
|
|
||||||
until redis-cli -h localhost -p 6379 ping; do
|
|
||||||
echo "Waiting for Redis..."
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Run Django tests
|
- name: Run Django tests
|
||||||
run: |
|
run: |
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
@@ -114,15 +74,14 @@ jobs:
|
|||||||
python manage.py test --verbosity=2
|
python manage.py test --verbosity=2
|
||||||
env:
|
env:
|
||||||
DJANGO_SETTINGS_MODULE: config.settings.test
|
DJANGO_SETTINGS_MODULE: config.settings.test
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/test_db
|
|
||||||
REDIS_URL: redis://localhost:6379/0
|
|
||||||
CELERY_BROKER_URL: redis://localhost:6379/0
|
|
||||||
SECRET_KEY: test-secret-key-for-ci
|
SECRET_KEY: test-secret-key-for-ci
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build Docker Images
|
name: Build Docker Images
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 20
|
||||||
needs: [lint, test]
|
needs: [lint, test]
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ packages = ["src"]
|
|||||||
# ==================================================================================
|
# ==================================================================================
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
DJANGO_SETTINGS_MODULE = "config.settings.test"
|
DJANGO_SETTINGS_MODULE = "config.settings.test"
|
||||||
python_paths = ["src"]
|
pythonpath = ["src"]
|
||||||
testpaths = ["tests"]
|
testpaths = ["tests"]
|
||||||
addopts = [
|
addopts = [
|
||||||
"--verbose",
|
"--verbose",
|
||||||
@@ -127,6 +127,8 @@ markers = [
|
|||||||
"serializers: marks tests for serializers",
|
"serializers: marks tests for serializers",
|
||||||
"services: marks tests for services",
|
"services: marks tests for services",
|
||||||
"factories: marks tests for factories",
|
"factories: marks tests for factories",
|
||||||
|
"network: marks tests that require network access",
|
||||||
|
"e2e: marks end-to-end tests",
|
||||||
]
|
]
|
||||||
|
|
||||||
filterwarnings = [
|
filterwarnings = [
|
||||||
|
|||||||
Reference in New Issue
Block a user