django-modeltranslation/.github/workflows/github-actions.yml
Serhii Tereshchenko 6b4bb733d9
fix: Store version as plain text file to simplify bumping (#636)
BREAKING CHANGE: Replaced `VERSION` in tuple format by `__version__` as a string
2022-05-14 11:11:07 +03:00

104 lines
3.2 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, pull_request]
jobs:
Lint:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
python: [3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install flake8
run: |
python -m pip install --upgrade pip
pip install flake8 black
- name: Lint with flake8 and black
run: |
flake8 modeltranslation
black --check modeltranslation *.py
Install:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
python: [3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install package
run: |
python -m pip install --upgrade pip
pip install .
Test:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.7, 3.8, 3.9]
django: [2.2, 3.2]
database: ["sqlite", "postgres", "mysql"]
include:
- python-version: "3.9"
django: "4.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
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@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
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 coverage six $(./get-django-version.py ${{ matrix.django }})
- name: Run tests
run: |
coverage run --source=modeltranslation ./runtests.py