ci: remove duplicate release dependency installs
CI / test (pull_request) Successful in 3m24s
PR合并自动部署 / release-check (pull_request) Successful in 12s
PR合并自动部署 / deploy (pull_request) Successful in 12s

This commit is contained in:
2026-08-09 03:58:04 +08:00
parent 903ead60c9
commit 52816ce442
4 changed files with 23 additions and 68 deletions
+11 -62
View File
@@ -15,75 +15,24 @@ jobs:
release-check:
if: ${{ github.event.pull_request.merged == true }}
runs-on: ubuntu-latest
timeout-minutes: 15
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
timeout-minutes: 5
steps:
- name: 检出 main
env:
REPOSITORY_URL: http://117.72.28.96:8765/Jacky/Hulumath-Web.git
run: git clone --branch main --single-branch "$REPOSITORY_URL" .
- name: 显示 Python 版本
run: python3 --version
- name: 安装 MySQL 编译依赖
- name: 检查发布文件和脚本语法
run: |
sudo apt-get update
sudo apt-get install -y \
default-libmysqlclient-dev \
pkg-config \
python3-dev \
python3-venv
- name: 安装发布检查依赖
run: |
python3 -m venv .venv-release
.venv-release/bin/python -m pip install \
--index-url https://mirrors.aliyun.com/pypi/simple \
--timeout 120 \
--retries 5 \
-r requirements.txt
- name: 检查迁移文件
working-directory: backend
run: ../.venv-release/bin/python manage.py makemigrations --check --dry-run
- name: Django 系统检查
working-directory: backend
run: ../.venv-release/bin/python manage.py check
- name: ASGI 启动导入检查
working-directory: backend
run: ../.venv-release/bin/python -c "from config.asgi import application; print(type(application).__name__)"
- name: 生产静态资源完整性检查
working-directory: backend
env:
DJANGO_DEBUG: "false"
DJANGO_USE_HTTPS: "false"
DJANGO_SECRET_KEY: release-static-assets-check
DJANGO_ALLOWED_HOSTS: localhost
DATABASE_URL: mysql://root:ci-root-password@mysql:3306/hulumath
REDIS_URL: redis://127.0.0.1:6379/0
run: ../.venv-release/bin/python manage.py collectstatic --noinput --clear
- name: MySQL 发布迁移检查
env:
DATABASE_URL: mysql://root:ci-root-password@mysql:3306/hulumath
run: |
.venv-release/bin/python backend/manage.py check --database default
.venv-release/bin/python backend/manage.py check_mysql
.venv-release/bin/python backend/manage.py migrate --noinput
set -eu
test -f requirements.txt
test -f backend/manage.py
test -f deploy/hulumath-web.service
test -f scripts/deploy_production.sh
test -f scripts/smoke_production.py
bash -n scripts/deploy_production.sh
python3 -m compileall -q backend scripts
git diff-tree --check -m -r HEAD
deploy:
if: ${{ github.event.pull_request.merged == true }}