mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-15 13:37:56 +08:00
130 lines
3.6 KiB
YAML
130 lines
3.6 KiB
YAML
name: tests
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
env:
|
|
MONGO_HOST: "127.0.0.1"
|
|
REDIS_HOST: "127.0.0.1"
|
|
AWS_ENDPOINT_URL: http://localhost:4566
|
|
AWS_REGION: "us-east-1"
|
|
AWS_ACCESS_KEY_ID: "test"
|
|
AWS_SECRET_ACCESS_KEY: "test"
|
|
AWS_DEFAULT_REGION: "us-east-1"
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Lint with ruff
|
|
run: |
|
|
pipx install ruff==0.4.10
|
|
ruff format . --check && ruff check .
|
|
- name: Check twine
|
|
run: |
|
|
python -m pip install twine poetry rstcheck
|
|
poetry build
|
|
rstcheck README.rst
|
|
twine check dist/*
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version:
|
|
- "3.10"
|
|
- "3.11"
|
|
- "3.12"
|
|
- "3.13"
|
|
- "3.14"
|
|
django:
|
|
- "5.2"
|
|
- "6.0"
|
|
- "6.1"
|
|
exclude:
|
|
# django 6.0 does not support earlier than 3.12
|
|
- python-version: "3.10"
|
|
django: "6.0"
|
|
- python-version: "3.11"
|
|
django: "6.0"
|
|
# django 6.1 does not support earlier than 3.12
|
|
- python-version: "3.10"
|
|
django: "6.1"
|
|
- python-version: "3.11"
|
|
django: "6.1"
|
|
|
|
services:
|
|
mongodb:
|
|
image: mongo
|
|
ports:
|
|
- 27017:27017
|
|
postgres:
|
|
image: postgres
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: postgres
|
|
ports:
|
|
- 5432:5432
|
|
# needed because the postgres container does not provide a health check
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
redis:
|
|
image: redis
|
|
ports:
|
|
- 6379:6379
|
|
options: --entrypoint redis-server
|
|
aws:
|
|
image: ministackorg/ministack:1.4.16
|
|
env:
|
|
SERVICES: sqs
|
|
MINISTACK_HOST: aws
|
|
# options: >-
|
|
# --health-cmd "wget -qO- http://localhost:4566/_ministack/ready || exit 1"
|
|
# --health-interval 2s
|
|
# --health-retries 15
|
|
# --health-timeout 5s
|
|
ports:
|
|
- 4566:4566
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install dependencies with Django ${{ matrix.django }}
|
|
run: |
|
|
python -m pip install uv==0.12.1
|
|
uv sync --extra testing --python ${{ matrix.python-version }}
|
|
uv pip install "django~=${{ matrix.django }}a1"
|
|
- name: Create SQS queue
|
|
run: aws sqs create-queue --queue-name testing
|
|
- name: Run Tests
|
|
run: |
|
|
uv run pytest --cov=./django_q --cov-report=xml
|
|
- name: Upload to coveralls
|
|
run: |
|
|
python -m pip install coveralls
|
|
coveralls --service=github
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
COVERALLS_FLAG_NAME: python-${{ matrix.python-version }}-django-${{ matrix.django }}
|
|
COVERALLS_PARALLEL: true
|
|
|
|
finish:
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
container: python:3.11-bookworm
|
|
steps:
|
|
- name: Upload to coveralls
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m pip install coveralls
|
|
coveralls --service=github --finish
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|