Files
Hulumath-Web/.gitea/workflows/ci.yml
T
Jacky cfc9d99820
CI / test (pull_request) Failing after 2m56s
ci: checkout from local Gitea
2026-08-08 22:58:31 +08:00

59 lines
1.9 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
- name: Install dependencies
run: python3 -m pip install -r requirements-dev.txt
- name: Check migrations
working-directory: backend
run: python3 manage.py makemigrations --check --dry-run
- name: Django checks
working-directory: backend
run: python3 manage.py check
- name: ASGI import check
working-directory: backend
run: python3 -c "from config.asgi import application; print(type(application).__name__)"
- name: Unit tests
run: python3 -m pytest -q
- name: MySQL migrations and tests
env:
DATABASE_URL: mysql://root:ci-root-password@mysql:3306/hulumath
run: |
python3 backend/manage.py check --database default
python3 backend/manage.py check_mysql
python3 backend/manage.py migrate --noinput
python3 -m pytest -q
- name: Build image
run: docker build -t hulumath:${{ gitea.sha }} .