name: Django CI on: push: branches: [ master ] pull_request: branches: [ master ] jobs: build: runs-on: ubuntu-latest services: mysql: image: mysql:8 env: MYSQL_ROOT_PASSWORD: mysql MYSQL_DATABASE: test_project ports: - 3306:3306 postgres: image: postgres:13 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: test_project ports: - 5432:5432 # needed because the postgres container does not provide a healthcheck options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 strategy: max-parallel: 4 matrix: python-version: [3.6, 3.7, 3.8, 3.9] django-version: [1.11, 2.0, 2.1, 2.2, 3.0, 3.1, 3.2] exclude: # Python 2.7 is compatible with Django 1.11 - python-version: "2.7" django-version: "2.0" - python-version: "2.7" django-version: "2.1" - python-version: "2.7" django-version: "2.2" - python-version: "2.7" django-version: "3.0" - python-version: "2.7" django-version: "3.1" - python-version: "2.7" django-version: "3.2" # Python 3.8 is compatible with Django 2.2+ - python-version: "3.8" django-version: "1.11" - python-version: "3.8" django-version: "2.0" - python-version: "3.8" django-version: "2.1" # Python 3.9 is compatible with Django 3.1+ - python-version: "3.9" django-version: "1.11" - python-version: "3.9" django-version: "2.0" - python-version: "3.9" django-version: "2.1" - python-version: "3.9" django-version: "2.2" - python-version: "3.9" django-version: "3.0" steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: psycopg2 prerequisites run: sudo apt-get install libpq-dev - name: Install Dependencies run: | python -m pip install --upgrade pip pip install flake8 coverage "Django~=${{ matrix.django-version }}.0" "psycopg2==2.8.6" mysqlclient -e . - name: Run Flake8 run: | flake8 - name: Run Tests run: | coverage run -a tests/runtests.py - name: Run Tests psql run: | coverage run -a tests/runtests.py -d psql env: DB_USER: postgres DB_PASSWORD: postgres - name: Run Tests mysql run: | coverage run -a tests/runtests.py -d mysql env: DB_USER: root DB_PASSWORD: mysql