Compare commits

...
Author SHA1 Message Date
fecoandClaude Opus 5.5 13e22a9c7d CI: main runs the tests only; images are built for prod
CI / test (push) Successful in 1m43s
CI / build (push) Skipped
CI / deploy (push) Skipped
The runner takes one job at a time, so a deployment (push to main, then
to prod) built every image twice and the two runs took turns. Now main
only tests, and prod tests, builds and deploys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-22 11:48:57 +00:00
2 changed files with 12 additions and 8 deletions
+7 -5
View File
@@ -1,9 +1,10 @@
# main: tests and image build (tags: commit hash, `main`).
# prod: the same, then deployment to the server (tags: commit hash, `prod`, `latest`).
# main: tests only.
# prod: tests, image build (tags: commit hash, `prod`, `latest`), then
# deployment to the server.
#
# Runs on the self-hosted runner in ci/runner (label `linux`). Jobs use the
# host's Docker daemon, so image builds share its BuildKit cache; a commit
# already built on main is rebuilt from cache in seconds.
# Runs on the self-hosted runner in ci/runner (label `linux`), one job at a
# time; building on main too would build every deployed commit twice. Jobs use
# the host's Docker daemon, so image builds share its BuildKit cache.
#
# Repository settings (Settings → Actions):
# secrets.REGISTRY_TOKEN Gitea access token with package write access
@@ -63,6 +64,7 @@ jobs:
build:
needs: test
if: github.ref == 'refs/heads/prod'
runs-on: linux
steps:
- name: Checkout
+5 -3
View File
@@ -2,13 +2,15 @@
A `.gitea/workflows/ci.yml` (Gitea Actions) két ágra fut:
- **main**: tesztek, majd image-build. Címkék: a commit hash első 12 karaktere és `main`.
- **prod**: ugyanez, majd telepítés a szerverre. Címkék: hash, `prod` és `latest`. Élesíteni tehát úgy kell, hogy a main-t a prod-ba mergeled (vagy pusholod).
- **main**: csak tesztek.
- **prod**: tesztek, image-build, majd telepítés a szerverre. Címkék: a commit hash első 12 karaktere, `prod` és `latest`. Élesíteni tehát úgy kell, hogy a main-t a prod-ba mergeled (vagy pusholod).
A runner egyszerre egy feladatot futtat; ha a main is buildelne, minden kitett commit kétszer épülne, és a két futás feladatai egymás közé ékelődnének. A fordítási hibák (például a frontend TypeScript-ellenőrzése) így a prod buildben derülnek ki, ezért kitétel előtt helyben is érdemes buildelni.
A lépések:
1. **test**: `cargo test` a backendre, a workerre, a db-re, a horoscope-clientre és a service-kitre, egy Postgres szolgáltatás-konténerrel.
2. **build**: megépíti a négy image-et, és feltölti őket a `registry.sagifer.com/sagifer/sorsfonalak-<szolgáltatás>` címre. A frontend buildje a TypeScript-típusokat is ellenőrzi. Egy main-en már megépült commit a cache-ből pár mp alatt újraépül.
2. **build** (csak prod): megépíti a négy image-et, és feltölti őket a `registry.sagifer.com/sagifer/sorsfonalak-<szolgáltatás>` címre. A frontend buildje a TypeScript-típusokat is ellenőrzi.
3. **deploy** (csak prod): felmásolja a `docker-compose.yml`-t és a `Caddyfile`-t a szerverre, beírja az új `TAG`-et a szerveren lévő `.env`-be, majd `docker compose pull && up -d`. Az adatbázis-migrációk a backend indulásakor futnak le.
4. **release** (csak prod, a deploy után): létrehoz egy `v<év.hónap.nap>-<hash>` taget és Gitea-release-t az előző release óta bekerült commitok listájával (repó → Releases).