Files
Hulumath-Web/.gitea/workflows/ci.yml
T
Jacky 672c3cf98b
CI / test (pull_request) Failing after 12m57s
ci: install dependencies in virtualenv
2026-08-08 23:08:47 +08:00

61 lines
2.0 KiB
YAML

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:
- name: Checkout repository
env:
REPOSITORY_URL: http://117.72.28.96:8765/Jacky/Hulumath-Web.git
REVISION: ${{ gitea.sha }}
run: |
git clone "$REPOSITORY_URL" .
git checkout --detach "$REVISION"
- name: Show Python version
run: python3 --version
- name: Install MySQL build dependencies
run: |
sudo apt-get update
sudo apt-get install -y default-libmysqlclient-dev pkg-config python3-venv
- name: Install dependencies
run: |
python3 -m venv .venv-ci
.venv-ci/bin/python -m pip install -r requirements-dev.txt
- name: Check migrations
working-directory: backend
run: ../.venv-ci/bin/python manage.py makemigrations --check --dry-run
- name: Django checks
working-directory: backend
run: ../.venv-ci/bin/python manage.py check
- name: ASGI import check
working-directory: backend
run: ../.venv-ci/bin/python -c "from config.asgi import application; print(type(application).__name__)"
- name: Unit tests
run: .venv-ci/bin/python -m pytest -q
- name: MySQL migrations and tests
env:
DATABASE_URL: mysql://root:ci-root-password@mysql:3306/hulumath
run: |
.venv-ci/bin/python backend/manage.py check --database default
.venv-ci/bin/python backend/manage.py check_mysql
.venv-ci/bin/python backend/manage.py migrate --noinput
.venv-ci/bin/python -m pytest -q
- name: Build image
run: docker build -t hulumath:${{ gitea.sha }} .