mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-15 13:37:56 +08:00
84 lines
2.3 KiB
YAML
84 lines
2.3 KiB
YAML
name: tests
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
|
|
django: [ "3.2", "4.1" ]
|
|
|
|
services:
|
|
disque:
|
|
image: efrecon/disque:1.0-rc1
|
|
ports:
|
|
- '7711:7711/tcp'
|
|
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
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install dependencies with Django ${{ matrix.django }}
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install poetry
|
|
poetry add "django==${{ matrix.django }}"
|
|
poetry install -E testing
|
|
- name: Run Tests
|
|
run: |
|
|
poetry run pytest --cov=./django_q --cov-report=xml
|
|
env:
|
|
MONGO_HOST: "127.0.0.1"
|
|
REDIS_HOST: "127.0.0.1"
|
|
- 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-slim
|
|
steps:
|
|
- name: Upload to coveralls
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m pip install coveralls flake8 black
|
|
coveralls --service=github --finish
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Check flake8/black
|
|
run: |
|
|
flake8 .
|
|
black --check .
|