.github/workflows/:
| Workflow | Trigger | Fungsi |
|---|---|---|
ci.yml | Push & PR ke main | Lint, doctor, docs, tests |
deploy-cloudflare.yml | Manual (workflow_dispatch) | Deploy ke app.sertifikasitrainer.com |
Tab Actions: github.com/trisnalesmana/aimentor/actions
Status saat ini
Ringkasan kondisi pipeline setelah workflow di-push kemain:
| Komponen | Status | Keterangan |
|---|---|---|
| Workflow CI | ✅ Aktif | Jalan otomatis tiap push/PR ke main |
| Workflow Deploy Cloudflare | ✅ Ada, belum pernah di-run | Hanya manual lewat Actions |
| CI run terakhir | ✅ Hijau | Lint, doctor, docs, web tests lulus |
| API tests di CI | ✅ Blocking | vitest run di apps/api — 352 tests |
Environment production | ✅ Dibuat | Masih perlu isi secrets sebelum deploy |
| Repository secrets | ❌ Belum diisi | Deploy akan gagal tanpa secrets di bawah |
CI sudah jalan. CD belum siap dipakai sampai environment
production dan secrets di-setup di GitHub.Job CI — mana yang blocking?
| Job | Blocking? | Catatan |
|---|---|---|
Lint (lint:ci) | Ya | Hanya scripts/, thub, .github/ |
| thub doctor | Ya | Cek struktur repo, bukan secret nyata |
| Mintlify docs | Ya | validate + broken-links |
| Web tests | Ya | Vitest di apps/web |
| API tests | Ya | bun run test (vitest) di apps/api |
Cara cek sendiri
Lewat browser
- Buka Actions
- Klik workflow CI — run hijau = pipeline utama lulus
- Klik workflow Deploy Cloudflare — kalau kosong, belum pernah dijalankan
- Settings → Environments — pastikan ada
production - Settings → Secrets and variables → Actions — cek secret sudah terisi
Lewat GitHub CLI
Checklist setup CD
Centang ini sebelum menjalankan Deploy Cloudflare pertama kali:Buat environment production
GitHub → Settings → Environments → New environment → nama:
Opsional: tambah required reviewers supaya deploy butuh approval.
productionOpsional: tambah required reviewers supaya deploy butuh approval.
Isi DOTENV_SHARED
Salin seluruh isi file
Format: satu
.env shared lokal (bukan path file).Format: satu
KEY=value per baris, multiline secret di GitHub.Isi DATABASE_URL
URL Neon production untuk migrate saat deploy, misalnya:
postgresql://...@ep-xxx.neon.tech/neondb?sslmode=requireIsi token Cloudflare
CLOUDFLARE_API_TOKEN— token dengan akses Workers (Wrangler)CLOUDFLARE_ACCOUNT_ID— dari dashboard Cloudflare
(Opsional) WORKER_SECRETS_B64
Kalau opsi Push worker secrets aktif saat deploy:Salin output ke secret
WORKER_SECRETS_B64.CI (ci.yml)
Setiap push atau PR ke main menjalankan job paralel:
lint
lint
bun run lint:ci — Biome pada scripts/, thub, .github/ (blocking).bun run lint (seluruh monorepo) belum di-gate di CI karena masih ada lint debt legacy.doctor
doctor
./thub doctor --ci — cek struktur env, script, dan dependency (blocking).docs
docs
mint validate + mint broken-links di apps/docs (blocking).test-api
test-api
bun run test (vitest) di apps/api dengan TZ=Asia/Jakarta (blocking).test-web
test-web
bun run test di apps/web (blocking).Simulasi lokal
CD (deploy-cloudflare.yml)
Deploy hanya manual — tidak auto-deploy saat merge ke main.
Buat environment `production`
Di GitHub repo → Settings → Environments → tambah
Opsional: aktifkan required reviewers untuk gate deploy.
production.Opsional: aktifkan required reviewers untuk gate deploy.
Isi repository secrets
| Secret | Wajib | Keterangan |
|---|---|---|
DOTENV_SHARED | Ya | Isi penuh file .env shared (multiline) |
DATABASE_URL | Ya | URL Neon untuk migrate production |
CLOUDFLARE_API_TOKEN | Ya | Token Wrangler dengan akses Workers |
CLOUDFLARE_ACCOUNT_ID | Ya | Account ID Cloudflare |
WORKER_SECRETS_B64 | Opsional* | Base64 dari .cloudflare/worker-secrets.json |
Jalankan workflow
GitHub → Actions → Deploy Cloudflare → Run workflow.Input opsional:
| Input | Default | Arti |
|---|---|---|
| Skip database migration | false | Lewati psql migrate |
| Skip web build | false | Deploy tanpa rebuild frontend |
| Push worker secrets | true | Sync secrets ke Wrangler sebelum deploy |
| Run smoke test | true | ./thub smoke prod setelah deploy |
Apa yang dijalankan di CI deploy
scripts/ci-materialize-env.sh— tulis.envdariDOTENV_SHARED, optionalDATABASE_URL→.env.production.local, lalu./thub env merge --prodscripts/ci-push-worker-secrets.sh— decodeWORKER_SECRETS_B64→ push viasync-worker-secrets.shscripts/deploy-prod.sh— migrate, build, deploy Workers./thub smoke prod— health check production
Perbandingan dengan deploy lokal
Lokal (./thub deploy) | GitHub Actions | |
|---|---|---|
| Env | .env + override lokal | Secret DOTENV_SHARED |
| Konfirmasi | Ketik yes | Workflow dispatch |
| Secrets | ./thub secrets push | WORKER_SECRETS_B64 + script CI |
| Target | app.sertifikasitrainer.com | Sama |
Troubleshooting CI
Semua job gagal di bun install --frozen-lockfile
Semua job gagal di bun install --frozen-lockfile
Pesan:
lockfile had changes, but lockfile is frozen.Penyebab: package.json berubah (misalnya workspace apps/docs) tapi bun.lock belum di-commit.Perbaikan lokal:doctor gagal di CI tapi lokal OK
doctor gagal di CI tapi lokal OK
Pastikan
bun install --frozen-lockfile sukses dan tidak ada file .env yang di-commit. Doctor CI tidak butuh secret nyata — hanya struktur repo.API tests gagal di CI
API tests gagal di CI
Saat ini tidak menggagalkan workflow (
continue-on-error). Banyak test API butuh env lengkap atau masih assertion lama. Job ini informatif dulu — perbaikan test API bisa dilakukan bertahap.deploy gagal: Missing DOTENV_SHARED
deploy gagal: Missing DOTENV_SHARED
migrate gagal
migrate gagal
Cek
DATABASE_URL di environment production. URL harus reachable dari runner GitHub (Neon dengan SSL).smoke prod gagal setelah deploy
smoke prod gagal setelah deploy
Tunggu propagasi Cloudflare (~1 menit), lalu re-run hanya smoke:
./thub smoke prod lokal dengan env production, atau re-run workflow dengan skip migrate/build.