mirror of
https://github.com/Hopiu/django-modeltranslation.git
synced 2026-03-16 22:10:31 +00:00
102 lines
3.1 KiB
YAML
102 lines
3.1 KiB
YAML
# Docs:
|
|
# - https://docs.github.com/en/actions/guides/about-service-containers
|
|
# Example
|
|
# - https://github.com/actions/example-services/blob/main/.github/workflows/postgres-service.yml
|
|
name: CI
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
jobs:
|
|
Check:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
strategy:
|
|
matrix:
|
|
python: ["3.10"]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install poetry
|
|
run: pipx install 'poetry~=1.8'
|
|
- name: Set up Python ${{ matrix.python }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python }}
|
|
cache: 'poetry'
|
|
cache-dependency-path: 'poetry.lock'
|
|
- name: Install deps
|
|
run: poetry install --sync --no-root
|
|
- name: Run linters
|
|
run: |
|
|
source $(poetry env info --path)/bin/activate
|
|
make lint
|
|
- name: Run type checking
|
|
run: |
|
|
source $(poetry env info --path)/bin/activate
|
|
make typecheck
|
|
- name: Test package install
|
|
run: |
|
|
python setup.py sdist
|
|
pip install dist/*
|
|
|
|
Test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python: ["3.9", "3.10", "3.11", "3.12"]
|
|
django: ["4.2", "5.0"]
|
|
database: ["sqlite", "postgres", "mysql"]
|
|
exclude:
|
|
- python: 3.9
|
|
django: 5.0
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
DJANGO: ${{ matrix.django }}
|
|
DB: ${{ matrix.database }}
|
|
DB_HOST: 127.0.0.1
|
|
MYSQL_DATABASE: "modeltranslation"
|
|
MYSQL_USER: "root"
|
|
MYSQL_PASSWORD: "password"
|
|
POSTGRES_DB: "modeltranslation"
|
|
POSTGRES_USER: "modeltranslation"
|
|
POSTGRES_PASSWORD: "modeltranslation"
|
|
services:
|
|
mariadb:
|
|
image: mariadb:10
|
|
ports:
|
|
- 3306:3306
|
|
env:
|
|
MYSQL_DATABASE: "modeltranslation"
|
|
MYSQL_USER: "modeltranslation"
|
|
MYSQL_PASSWORD: "password"
|
|
MYSQL_ROOT_PASSWORD: "password"
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
postgres:
|
|
image: postgres
|
|
ports:
|
|
- 5432:5432
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
env:
|
|
POSTGRES_DB: "modeltranslation"
|
|
POSTGRES_USER: "modeltranslation"
|
|
POSTGRES_PASSWORD: "modeltranslation"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python ${{ matrix.python }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python }}
|
|
- name: Set up env
|
|
run: |
|
|
if [[ $DB == mysql ]]; then
|
|
pip install -q mysqlclient
|
|
fi
|
|
if [[ $DB == postgres ]]; then
|
|
pip install -q psycopg2-binary
|
|
fi
|
|
pip install django_stubs_ext typing-extensions coverage pytest pytest-django pytest-cov parameterized $(./get-django-version.py ${{ matrix.django }})
|
|
- name: Run tests
|
|
run: |
|
|
pytest --cov-report term
|