LichessStatTgWeb/.forgejo/workflows/deploy.yml
vrubelroman a7571f13c1
All checks were successful
CI/CD Pipeline / build-and-deploy (push) Successful in 16s
v1.5.1: not-found players paused, tests in repo + CI, log-based daily summary, docs pruned
- players absent from two consecutive bulk answers (deleted/renamed on Lichess) are paused
  like closed accounts with their own notice; ❓ mark; stats service answers 404 instead
  of "0 games" for unknown users
- /getgamers table stays unmarked, a legend line under it lists closed / not-found players
- daily SUMMARY is computed from events.log (survives restarts); lichess_429 comes from the
  stats service /health, which now exposes lichess_429_24h / lichess_429_total
- admin /status reads its numbers through Database.get_admin_stats
- tests/: 36 bot + 15 service unittest cases, run_tests.sh runs them inside the real images,
  CI runs them after the build and before pushing/deploying
- docs: USER_GUIDE/about/API_DOCUMENTATION rewritten for the current code, ARCHITECTURE.md and
  two sub-READMEs removed, 7 obsolete helper scripts removed, CURRENT_STATE updated
- .claude/agents/designer.md: Telegram-aware designer role

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 02:48:00 +00:00

55 lines
2 KiB
YAML

name: CI/CD Pipeline
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: shell
steps:
- name: Clone repository
run: git clone --depth 1 "http://192.168.8.174:3000/${GITHUB_REPOSITORY}.git" .
env:
GIT_TERMINAL_PROMPT: '0'
- name: Ensure Docker CLI
run: |
apk add --no-cache docker-cli docker-cli-compose openssh-client || true
grep -q '^vrubel:' /etc/passwd || echo 'vrubel:x:1000:1000::/data:/bin/sh' >> /etc/passwd
- name: Setup .env for CI/CD
run: cp .env.example .env
- name: Build Docker images
run: docker-compose build
# Unit tests (tests/) inside the images just built, no network. A failing
# test stops the pipeline here: nothing is pushed or deployed.
- name: Run tests
run: RUN_TESTS_FROM_IMAGE=1 sh ./run_tests.sh
- name: Login to Gitea Container Registry
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login http://192.168.8.174:3000 -u "${{ secrets.REGISTRY_USER }}" --password-stdin
- name: Push images to registry
run: |
docker push 192.168.8.174:3000/vrubel/lichess-api:latest
docker push 192.168.8.174:3000/vrubel/lichess-bot:latest
docker push 192.168.8.174:3000/vrubel/lichess-admin:latest
- name: Transfer images to prod
run: |
docker save \
192.168.8.174:3000/vrubel/lichess-api:latest \
192.168.8.174:3000/vrubel/lichess-bot:latest \
192.168.8.174:3000/vrubel/lichess-admin:latest \
| ssh -i /data/.ssh/id_ed25519 -o StrictHostKeyChecking=no root@130.17.6.76 docker load
- name: Deploy on prod host
run: |
cat docker-compose.prod.yml | ssh -i /data/.ssh/id_ed25519 -o StrictHostKeyChecking=no root@130.17.6.76 \
"cat > ~/services/LichessStatTgWeb/docker-compose.yml"
ssh -i /data/.ssh/id_ed25519 -o StrictHostKeyChecking=no root@130.17.6.76 \
"cd ~/services/LichessStatTgWeb && docker compose up -d --remove-orphans"