name: CI on: push: branches: [main] pull_request: jobs: test: runs-on: ubuntu-latest services: mysql: image: mysql:8.0.35 env: MYSQL_ROOT_PASSWORD: ci-root-password MYSQL_DATABASE: hulumath options: >- --health-cmd "mysqladmin ping -h 127.0.0.1 -uroot -pci-root-password --silent" --health-interval 5s --health-timeout 5s --health-retries 20 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.11" cache: pip - name: Install MySQL build dependencies run: | sudo apt-get update sudo apt-get install -y default-libmysqlclient-dev pkg-config - name: Install dependencies run: pip install -r requirements-dev.txt - name: Check migrations working-directory: backend run: python manage.py makemigrations --check --dry-run - name: Django checks working-directory: backend run: python manage.py check - name: ASGI import check working-directory: backend run: python -c "from config.asgi import application; print(type(application).__name__)" - name: Unit tests run: pytest -q - name: MySQL migrations and tests env: DATABASE_URL: mysql://root:ci-root-password@mysql:3306/hulumath run: | python backend/manage.py check --database default python backend/manage.py check_mysql python backend/manage.py migrate --noinput pytest -q - name: Build image run: docker build -t hulumath:${{ gitea.sha }} .