Merge pull request #1205 from Nitrate/renovate/pin-dependencies #157
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit Tests | |
on: | |
push: | |
branches: | |
- develop | |
- main | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
unittests: | |
name: "py${{ matrix.python-version }}-${{ matrix.django-version }}-${{ matrix.db }}" | |
runs-on: ubuntu-24.04 | |
services: | |
mariadb: | |
image: mariadb:10.11.8@sha256:75f6e61397758489d1dccf95db33b6b49ebfc7ec1253d40060fdf8ceb7f938a3 | |
ports: | |
- 33061:3306 | |
env: | |
MYSQL_DATABASE: nitrate | |
MYSQL_ROOT_PASSWORD: pass | |
options: >- | |
--name=testdb-mariadb | |
--health-cmd="mysqladmin ping -uroot -ppass" | |
--health-interval=5s | |
--health-timeout=2s | |
--health-retries=3 | |
postgres: | |
image: postgres:16.3@sha256:0aafd2ae7e6c391f39fb6b7621632d79f54068faebc726caf469e87bd1d301c0 | |
ports: | |
- 54321:5432 | |
env: | |
POSTGRES_PASSWORD: pass | |
options: >- | |
--name=testdb-pgsql | |
--health-cmd="echo pass | psql -U postgres -W --command 'SELECT 1'" | |
--health-interval=5s | |
--health-timeout=2s | |
--health-retries=3 | |
mysql: | |
image: mysql:8.0.22@sha256:0fd2898dc1c946b34dceaccc3b80d38b1049285c1dab70df7480de62265d6213 | |
ports: | |
- 33062:3306 | |
env: | |
MYSQL_DATABASE: nitrate | |
MYSQL_ROOT_PASSWORD: pass | |
options: >- | |
--name=testdb-mysql | |
--health-cmd="mysqladmin ping -uroot -ppass" | |
--health-interval=5s | |
--health-timeout=2s | |
--health-retries=3 | |
strategy: | |
max-parallel: 7 | |
matrix: | |
python-version: [3.9, '3.10', '3.11', '3.12'] | |
django-version: [django420] | |
db: [sqlite] | |
include: | |
- python-version: '3.12' | |
django-version: django420 | |
db: mysql | |
- python-version: '3.12' | |
django-version: django420 | |
db: mariadb | |
- python-version: '3.12' | |
django-version: django420 | |
db: postgres | |
steps: | |
- name: Install packages used to setup testenv | |
run: | | |
sudo apt update | |
sudo apt-get install gcc python3-dev libkrb5-dev libmariadb-dev libcrypt-dev | |
- name: Checkout code | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Set up Python | |
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox coveralls | |
- run: | | |
echo "tox_pyver=${pyver}" | sed "s/\.//" >> $GITHUB_ENV | |
env: | |
pyver: ${{ matrix.python-version }} | |
- name: Tox | |
run: | | |
tox -e py$tox_pyver-${{ matrix.django-version }}-${{ matrix.db }} | |
- name: Parallel coverage report | |
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 # v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
flag-name: testenv-py${{ matrix.python-version }}-${{ matrix.django-version }}-${{ matrix.db }} | |
parallel: true | |
coveralls: | |
name: Finish Coveralls | |
needs: unittests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Finish coverage report | |
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 # v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel-finished: true |