Starte test.yml wieder mit dem Push und warte auf den Checkout des Dev-Deploys, weil workflow_run hier nicht auslöst.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4bd2d047f5
commit
363ecdfd0a
2 files changed
+43
-15
No files matched your search
+40
-12
@@ -1,16 +1,15 @@
|
||||
name: Test Suite
|
||||
|
||||
# Runs once per push, after "Deploy Development" has updated the checkout it tests.
|
||||
# A push trigger here would start a second run that races the deploy.
|
||||
# One run per push. The deploy starts at the same time and updates the checkout this suite tests,
|
||||
# so the jobs wait until that checkout contains the pushed commit. A workflow_run trigger
|
||||
# (after the deploy) did not start reliably on this Gitea, see git log of this file.
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Deploy Development"]
|
||||
types: [completed]
|
||||
push:
|
||||
branches: [develop]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
pytest-backend:
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: pytest against Dev Postgres (tsumugu_test)
|
||||
@@ -19,6 +18,19 @@ jobs:
|
||||
APP_DIR="/home/lars/docker/tsumugu-dev"
|
||||
COMPOSE_FILE="docker-compose.dev-env.yml"
|
||||
echo "pytest uses Dev Postgres (${APP_DIR}); event=${{ github.event_name }}"
|
||||
if [ "${{ github.event_name }}" = "push" ]; then
|
||||
for i in $(seq 1 180); do
|
||||
if git -c safe.directory='*' -C "$APP_DIR" merge-base --is-ancestor "${{ github.sha }}" HEAD 2>/dev/null; then
|
||||
echo "Dev checkout contains ${{ github.sha }} (attempt $i)"
|
||||
break
|
||||
fi
|
||||
if [ "$i" -eq 180 ]; then
|
||||
echo "the deploy did not reach ${{ github.sha }} within 15 minutes"
|
||||
exit 1
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
fi
|
||||
cd "$APP_DIR"
|
||||
for i in $(seq 1 60); do
|
||||
if [ -f "$APP_DIR/backend/pytest.ini" ] && docker compose -f "$COMPOSE_FILE" exec -T backend true 2>/dev/null; then
|
||||
@@ -59,27 +71,43 @@ jobs:
|
||||
'
|
||||
|
||||
smoke-dev:
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||
# After pytest, so the deploy that started with the push has normally finished. The health check retries.
|
||||
needs: pytest-backend
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Non-destructive smoke against the running Dev app
|
||||
run: |
|
||||
set -e
|
||||
echo "live Dev API (tsumugu_dev), read-only health"
|
||||
curl -sf http://localhost:8094/api/health
|
||||
echo
|
||||
curl -sf http://localhost:3094/api/health
|
||||
echo
|
||||
for url in http://localhost:8094/api/health http://localhost:3094/api/health; do
|
||||
for i in $(seq 1 30); do
|
||||
if curl -sf "$url"; then echo; break; fi
|
||||
if [ "$i" -eq 30 ]; then echo "no health answer from $url"; exit 1; fi
|
||||
sleep 10
|
||||
done
|
||||
done
|
||||
echo "LAN smoke OK. Public URL after TLS: https://dev.tsumugu.jinkendo.de"
|
||||
|
||||
frontend-build:
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Frontend production build on Dev checkout
|
||||
run: |
|
||||
set -e
|
||||
APP_DIR="/home/lars/docker/tsumugu-dev"
|
||||
if [ "${{ github.event_name }}" = "push" ]; then
|
||||
for i in $(seq 1 180); do
|
||||
if git -c safe.directory='*' -C "$APP_DIR" merge-base --is-ancestor "${{ github.sha }}" HEAD 2>/dev/null; then
|
||||
echo "Dev checkout contains ${{ github.sha }} (attempt $i)"
|
||||
break
|
||||
fi
|
||||
if [ "$i" -eq 180 ]; then
|
||||
echo "the deploy did not reach ${{ github.sha }} within 15 minutes"
|
||||
exit 1
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
fi
|
||||
cd "$APP_DIR/frontend"
|
||||
npm ci
|
||||
npm run build
|
||||
Reference in new issue
Block a user