Skip to content

Merge pull request #691 from drnlm/feature/gh_actions_selenium_tests #328

Merge pull request #691 from drnlm/feature/gh_actions_selenium_tests

Merge pull request #691 from drnlm/feature/gh_actions_selenium_tests #328

Workflow file for this run

name: Django CI
on: [push, pull_request]
jobs:
postgres:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
name: Postgres - Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }} (Allowed Failures - ${{ matrix.django-version == 'main' }} )
strategy:
max-parallel: 4
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
django-version: ['3.2.0', '4.0.0', '4.1.0', '4.2.0', 'main']
exclude:
- django-version: '4.0.0'
python-version: '3.7'
- django-version: '4.1.0'
python-version: '3.7'
- django-version: '4.2.0'
python-version: '3.8'
- django-version: '4.2.0'
python-version: '3.7'
- django-version: 'main'
python-version: '3.7'
- django-version: 'main'
python-version: '3.8'
- django-version: 'main'
python-version: '3.9'
- django-version: '3.2.0'
python-version: '3.11'
- django-version: '4.0.0'
python-version: '3.11'
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
continue-on-error: ${{ matrix.django-version == 'main' }}
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
- name: 'Install psycopg2 for Django < 3.1'
# Django < 3.1 is incompatible with psycopg2 2.9
# See https://github.com/psycopg/psycopg2/issues/1293
if: "matrix.django-version == '2.2.0' || matrix.django-version == '3.0.0'"
run: |
pip install 'psycopg2<2.9'
- name: 'Install psycopg2'
if: "matrix.django-version != '2.2.0' && matrix.django-version != '3.0.0'"
run: |
pip install psycopg2
- name: Install Django Release
run: |
pip install django~=${{ matrix.django-version }}
if: matrix.django-version != 'main'
- name: Install Django Main
continue-on-error: ${{ matrix.django-version == 'main' }}
run: |
pip install 'https://github.com/django/django/archive/main.tar.gz'
if: matrix.django-version == 'main'
- name: Run Tests
continue-on-error: ${{ matrix.django-version == 'main' }}
env:
TESTDB: postgres
run: |
export PYTHONWARNINGS=always
coverage run --source='wafer' manage.py test --exclude-tag selenium && coverage report --skip-covered
sqlite:
runs-on: ubuntu-latest
name: SQLite - Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }} (Allowed Failures - ${{ matrix.django-version == 'main'}} )
strategy:
max-parallel: 4
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10','3.11']
django-version: ['3.2.0', '4.0.0', '4.1.0', '4.2.0', 'main']
exclude:
- django-version: '4.0.0'
python-version: '3.7'
- django-version: '4.1.0'
python-version: '3.7'
- django-version: '4.2.0'
python-version: '3.7'
- django-version: '4.2.0'
python-version: '3.8'
- django-version: 'main'
python-version: '3.7'
- django-version: 'main'
python-version: '3.8'
- django-version: 'main'
python-version: '3.9'
- django-version: '3.2.0'
python-version: '3.11'
- django-version: '4.0.0'
python-version: '3.11'
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
continue-on-error: ${{ matrix.django-version == 'main' }}
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
- name: Install Django Release
run: |
pip install django~=${{ matrix.django-version }}
if: matrix.django-version != 'main'
- name: Install Django Main
continue-on-error: ${{ matrix.django-version == 'main' }}
run: |
pip install 'https://github.com/django/django/archive/main.tar.gz'
if: matrix.django-version == 'main'
- name: Run Tests
continue-on-error: ${{ matrix.django-version == 'main' }}
run: |
export PYTHONWARNINGS=always
coverage run --source='wafer' manage.py test --exclude-tag selenium && coverage report --skip-covered
translations:
runs-on: ubuntu-latest
name: Compile Translations
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
- name: Install gettext
run: |
sudo apt-get -y install gettext
- name: Compile Translations
run: |
cd wafer
python ../manage.py compilemessages
selenium:
runs-on: ubuntu-latest
name: Selenium - Browser ${{ matrix.browser }}
strategy:
max-parallel: 2
matrix:
browser: ['chrome', 'firefox']
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
pip install selenium
- name: Install node
uses: actions/setup-node@v4
- name: Install javascript dependencies
run: |
npm install
- name: Setup Chrome
uses: browser-actions/setup-chrome@v1
if: matrix.browser == 'chrome'
- name: Setup firefox
run: |
wget -O firefox.tar.bz2 'https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US'
tar xaf firefox.tar.bz2
export PATH=$PATH:${PWD}/firefox
if: matrix.browser == 'firefox'
- name: Run Tests
run: |
python manage.py test --tag ${{ matrix.browser }}