chore(gitea): 精简部署 workflow,移除多余 CI,保留 main/bt 触发
All checks were successful
Deploy to Production / deploy (push) Successful in 26s
All checks were successful
Deploy to Production / deploy (push) Successful in 26s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -23,6 +23,7 @@ jobs:
|
|||||||
FRONTEND_HOST=${{ secrets.FRONTEND_HOST }}
|
FRONTEND_HOST=${{ secrets.FRONTEND_HOST }}
|
||||||
ENVIRONMENT=production
|
ENVIRONMENT=production
|
||||||
PROJECT_NAME=${{ secrets.PROJECT_NAME }}
|
PROJECT_NAME=${{ secrets.PROJECT_NAME }}
|
||||||
|
STACK_NAME=${{ secrets.STACK_NAME }}
|
||||||
BACKEND_CORS_ORIGINS=${{ secrets.BACKEND_CORS_ORIGINS }}
|
BACKEND_CORS_ORIGINS=${{ secrets.BACKEND_CORS_ORIGINS }}
|
||||||
SECRET_KEY=${{ secrets.SECRET_KEY }}
|
SECRET_KEY=${{ secrets.SECRET_KEY }}
|
||||||
FIRST_SUPERUSER=${{ secrets.FIRST_SUPERUSER }}
|
FIRST_SUPERUSER=${{ secrets.FIRST_SUPERUSER }}
|
||||||
@@ -40,16 +41,6 @@ jobs:
|
|||||||
POSTGRES_USER=${{ secrets.POSTGRES_USER }}
|
POSTGRES_USER=${{ secrets.POSTGRES_USER }}
|
||||||
POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}
|
POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}
|
||||||
SENTRY_DSN=${{ secrets.SENTRY_DSN }}
|
SENTRY_DSN=${{ secrets.SENTRY_DSN }}
|
||||||
MQTT_HOST=${{ secrets.MQTT_HOST }}
|
|
||||||
MQTT_PORT=${{ secrets.MQTT_PORT }}
|
|
||||||
MQTT_USERNAME=${{ secrets.MQTT_USERNAME }}
|
|
||||||
MQTT_PASSWORD=${{ secrets.MQTT_PASSWORD }}
|
|
||||||
MQTT_TOPIC_PATTERN=${{ secrets.MQTT_TOPIC_PATTERN }}
|
|
||||||
MQTT_CLIENT_ID=${{ secrets.MQTT_CLIENT_ID }}
|
|
||||||
RAW_HOT_RETENTION_DAYS=${{ secrets.RAW_HOT_RETENTION_DAYS }}
|
|
||||||
RAW_ARCHIVE_BASE_DIR=${{ secrets.RAW_ARCHIVE_BASE_DIR }}
|
|
||||||
PARSER_BATCH_SIZE=${{ secrets.PARSER_BATCH_SIZE }}
|
|
||||||
PARSER_POLL_INTERVAL_MS=${{ secrets.PARSER_POLL_INTERVAL_MS }}
|
|
||||||
DOCKER_IMAGE_BACKEND=${{ secrets.DOCKER_IMAGE_BACKEND }}
|
DOCKER_IMAGE_BACKEND=${{ secrets.DOCKER_IMAGE_BACKEND }}
|
||||||
DOCKER_IMAGE_FRONTEND=${{ secrets.DOCKER_IMAGE_FRONTEND }}
|
DOCKER_IMAGE_FRONTEND=${{ secrets.DOCKER_IMAGE_FRONTEND }}
|
||||||
ENVEOF
|
ENVEOF
|
||||||
@@ -57,16 +48,6 @@ jobs:
|
|||||||
# Fallback defaults if image name secrets are empty
|
# Fallback defaults if image name secrets are empty
|
||||||
sed -i 's/^DOCKER_IMAGE_BACKEND=$/DOCKER_IMAGE_BACKEND=backend/' .env.production
|
sed -i 's/^DOCKER_IMAGE_BACKEND=$/DOCKER_IMAGE_BACKEND=backend/' .env.production
|
||||||
sed -i 's/^DOCKER_IMAGE_FRONTEND=$/DOCKER_IMAGE_FRONTEND=frontend/' .env.production
|
sed -i 's/^DOCKER_IMAGE_FRONTEND=$/DOCKER_IMAGE_FRONTEND=frontend/' .env.production
|
||||||
sed -i 's/^MQTT_HOST=$/MQTT_HOST=1Panel-emqx-Rniy/' .env.production
|
|
||||||
sed -i 's/^MQTT_PORT=$/MQTT_PORT=1883/' .env.production
|
|
||||||
sed -i 's/^MQTT_USERNAME=$/MQTT_USERNAME=weefnn/' .env.production
|
|
||||||
sed -i 's/^MQTT_PASSWORD=$/MQTT_PASSWORD=123456/' .env.production
|
|
||||||
sed -i 's%^MQTT_TOPIC_PATTERN=$%MQTT_TOPIC_PATTERN=terminal/+/raw%' .env.production
|
|
||||||
sed -i 's/^MQTT_CLIENT_ID=$/MQTT_CLIENT_ID=spatialhub-mqtt-ingestor/' .env.production
|
|
||||||
sed -i 's/^RAW_HOT_RETENTION_DAYS=$/RAW_HOT_RETENTION_DAYS=90/' .env.production
|
|
||||||
sed -i 's%^RAW_ARCHIVE_BASE_DIR=$%RAW_ARCHIVE_BASE_DIR=/data/archive/gnss%' .env.production
|
|
||||||
sed -i 's/^PARSER_BATCH_SIZE=$/PARSER_BATCH_SIZE=200/' .env.production
|
|
||||||
sed -i 's/^PARSER_POLL_INTERVAL_MS=$/PARSER_POLL_INTERVAL_MS=300/' .env.production
|
|
||||||
|
|
||||||
- name: Build Docker images
|
- name: Build Docker images
|
||||||
run: docker compose --env-file .env.production -f compose.prod.yml build
|
run: docker compose --env-file .env.production -f compose.prod.yml build
|
||||||
@@ -103,22 +84,5 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Verify mqtt workers
|
|
||||||
run: |
|
|
||||||
if docker compose --env-file .env.production -f compose.prod.yml ps mqtt-ingestor --status running | grep -q mqtt-ingestor; then
|
|
||||||
echo "✅ mqtt-ingestor is running!"
|
|
||||||
else
|
|
||||||
echo "❌ mqtt-ingestor is not running"
|
|
||||||
docker compose --env-file .env.production -f compose.prod.yml logs mqtt-ingestor
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if docker compose --env-file .env.production -f compose.prod.yml ps mqtt-parser-worker --status running | grep -q mqtt-parser-worker; then
|
|
||||||
echo "✅ mqtt-parser-worker is running!"
|
|
||||||
else
|
|
||||||
echo "❌ mqtt-parser-worker is not running"
|
|
||||||
docker compose --env-file .env.production -f compose.prod.yml logs mqtt-parser-worker
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Cleanup old Docker images
|
- name: Cleanup old Docker images
|
||||||
run: docker image prune -f || true
|
run: docker image prune -f || true
|
||||||
|
|||||||
@@ -1,100 +0,0 @@
|
|||||||
name: Playwright Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- bt
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- synchronize
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-playwright:
|
|
||||||
timeout-minutes: 60
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
git clone "http://172.17.0.1:3000/${{ github.repository }}.git" .
|
|
||||||
git checkout "${{ github.sha }}"
|
|
||||||
|
|
||||||
- name: Detect relevant file changes
|
|
||||||
id: changes
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
CHANGED=false
|
|
||||||
|
|
||||||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
|
||||||
BASE="${{ github.base_ref }}"
|
|
||||||
git fetch origin "+refs/heads/${BASE}:refs/remotes/origin/${BASE}" --depth=200 2>/dev/null \
|
|
||||||
|| git fetch origin --depth=200
|
|
||||||
if git rev-parse "origin/${BASE}" >/dev/null 2>&1; then
|
|
||||||
FILES=$(git diff --name-only "origin/${BASE}...HEAD" || true)
|
|
||||||
else
|
|
||||||
FILES=$(git show --name-only --pretty=format: HEAD)
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
BEFORE="${{ github.event.before }}"
|
|
||||||
if [ -z "${BEFORE}" ] || [ "${BEFORE}" = "0000000000000000000000000000000000000000" ]; then
|
|
||||||
FILES=$(git show --name-only --pretty=format: HEAD)
|
|
||||||
else
|
|
||||||
FILES=$(git diff --name-only "${BEFORE}" "${{ github.sha }}" || true)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
while IFS= read -r line; do
|
|
||||||
[ -z "${line}" ] && continue
|
|
||||||
case "${line}" in
|
|
||||||
backend/*|frontend/*|.env|compose*|.gitea/workflows/playwright.yml|.github/workflows/playwright.yml)
|
|
||||||
CHANGED=true
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done <<< "${FILES}"
|
|
||||||
|
|
||||||
echo "changed=${CHANGED}" >> "${GITHUB_OUTPUT}"
|
|
||||||
echo "Relevant changes for Playwright: ${CHANGED}"
|
|
||||||
|
|
||||||
- name: Skip Playwright (no relevant changes)
|
|
||||||
if: steps.changes.outputs.changed != 'true'
|
|
||||||
run: echo "Skipping Playwright — no changes under backend/, frontend/, compose, .env, or playwright workflows."
|
|
||||||
|
|
||||||
- name: Install uv and Bun
|
|
||||||
if: steps.changes.outputs.changed == 'true'
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
export PATH="${HOME}/.bun/bin:${PATH}"
|
|
||||||
export UV_PYTHON_DOWNLOADS=automatic
|
|
||||||
|
|
||||||
sudo apt-get update -qq
|
|
||||||
sudo apt-get install -y python3 python3-venv curl unzip ca-certificates
|
|
||||||
|
|
||||||
python3 -m venv /tmp/gitea-ci-venv
|
|
||||||
/tmp/gitea-ci-venv/bin/pip install --upgrade pip
|
|
||||||
/tmp/gitea-ci-venv/bin/pip install "uv>=0.4"
|
|
||||||
export PATH="/tmp/gitea-ci-venv/bin:${PATH}"
|
|
||||||
|
|
||||||
# Official Bun installer (not GitHub Actions)
|
|
||||||
curl -fsSL https://bun.sh/install | bash
|
|
||||||
|
|
||||||
- name: Generate client, build images, run Playwright
|
|
||||||
if: steps.changes.outputs.changed == 'true'
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
export PATH="/tmp/gitea-ci-venv/bin:${HOME}/.bun/bin:${PATH}"
|
|
||||||
export BUN_INSTALL="${HOME}/.bun"
|
|
||||||
|
|
||||||
(cd backend && uv sync)
|
|
||||||
bun ci
|
|
||||||
bash scripts/generate-client.sh
|
|
||||||
|
|
||||||
docker compose build
|
|
||||||
docker compose down -v --remove-orphans || true
|
|
||||||
docker compose run --rm playwright bunx playwright test \
|
|
||||||
--fail-on-flaky-tests \
|
|
||||||
--trace=retain-on-failure
|
|
||||||
docker compose down -v --remove-orphans || true
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
name: Test Backend
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- bt
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- synchronize
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-backend:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout and run backend tests
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
export UV_PYTHON_DOWNLOADS=automatic
|
|
||||||
|
|
||||||
git clone "http://172.17.0.1:3000/${{ github.repository }}.git" .
|
|
||||||
git checkout "${{ github.sha }}"
|
|
||||||
|
|
||||||
sudo apt-get update -qq
|
|
||||||
sudo apt-get install -y python3 python3-venv ca-certificates
|
|
||||||
|
|
||||||
# PEP 668: do not pip install into system Python; bootstrap uv inside a throwaway venv
|
|
||||||
python3 -m venv /tmp/gitea-ci-venv
|
|
||||||
/tmp/gitea-ci-venv/bin/pip install --upgrade pip
|
|
||||||
/tmp/gitea-ci-venv/bin/pip install "uv>=0.4"
|
|
||||||
export PATH="/tmp/gitea-ci-venv/bin:${PATH}"
|
|
||||||
|
|
||||||
docker compose down -v --remove-orphans || true
|
|
||||||
docker compose up -d db mailcatcher
|
|
||||||
|
|
||||||
(cd backend && uv run bash scripts/prestart.sh)
|
|
||||||
(cd backend && uv run bash scripts/tests-start.sh "Coverage for ${{ github.sha }}")
|
|
||||||
|
|
||||||
docker compose down -v --remove-orphans || true
|
|
||||||
|
|
||||||
if [ -d backend/htmlcov ]; then
|
|
||||||
echo "Coverage HTML generated under backend/htmlcov (view on runner if needed)."
|
|
||||||
fi
|
|
||||||
|
|
||||||
(cd backend && uv run coverage report --fail-under=90)
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
name: Test Docker Compose
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- bt
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- synchronize
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-docker-compose:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout and verify compose stack
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
git clone "http://172.17.0.1:3000/${{ github.repository }}.git" .
|
|
||||||
git checkout "${{ github.sha }}"
|
|
||||||
|
|
||||||
docker compose build
|
|
||||||
docker compose down -v --remove-orphans || true
|
|
||||||
docker compose up -d --wait backend frontend adminer
|
|
||||||
|
|
||||||
curl -fsS http://localhost:8000/api/v1/utils/health-check
|
|
||||||
curl -fsS http://localhost:5173
|
|
||||||
|
|
||||||
docker compose down -v --remove-orphans || true
|
|
||||||
Reference in New Issue
Block a user