build: use MariaDB in CI #283
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| max-parallel: 4 | |
| matrix: | |
| python-version: [3.11, 3.12] | |
| services: | |
| mariadb: | |
| image: mariadb:11.7.2 | |
| env: | |
| MARIADB_DATABASE: editgroups | |
| MARIADB_ROOT_PASSWORD: editgroups | |
| ports: | |
| - 3306 | |
| options: >- | |
| --health-cmd="healthcheck.sh --connect --innodb_initialized" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=3 | |
| redis: | |
| image: redis | |
| ports: | |
| - 6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip setuptools | |
| pip install -r requirements.txt | |
| pip install mysqlclient==2.2.7 coveralls | |
| pip freeze | |
| echo "from .dev import *" > editgroups/settings/__init__.py | |
| cat editgroups/settings/secret_gh_action.py | sed -e "s/MARIADB_PORT/${{ job.services.mariadb.ports[3306] }}/g" | sed -e "s/REDIS_REAL_PORT/${{ job.services.redis.ports[6379] }}/g" > editgroups/settings/secret.py | |
| - name: Verify MariaDB connection | |
| env: | |
| PORT: ${{ job.services.mariadb.ports[3306] }} | |
| run: | | |
| while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do | |
| sleep 1 | |
| done | |
| - name: Run tests | |
| run: | | |
| coverage run --source=editgroups,store,revert,tagging --omit=*/migrations/*,edtigroups/settings/* manage.py test -v 2 | |
| env: | |
| DJANGO_SETTINGS_MODULE: editgroups.settings |