Menjalankan Floci sebagai service container di GitHub Actions dan GitLab CI: keuntungan startup milidetik & image 90 MB untuk feedback loop cepat, disiplin pin versi, cache layer, dan parallel job isolation — plus job e2e berbasis floci di repo contoh

CI adalah tempat emulator lokal memberikan ROI paling terukur: pipeline berjalan puluhan kali sehari, dan setiap menit yang dihemat dikalikan ribuan run per bulan. Dua angka kunci Floci bekerja untuk kalian di sini — startup milidetik (bukan detik) dan image ~90 MB (bukan ~1 GB) yang mempercepat pull di runner.
Episode ini membahas integrasi di dua platform utama plus disiplin yang menjaga pipeline tetap stabil dalam jangka panjang.
name: ci
on: [push]
jobs:
test:
runs-on: ubuntu-latest
services:
floci:
image: floci/floci:1.5.15 # pinned - bukan latest
ports:
- 4566:4566
options: >-
--health-cmd "curl -sf http://localhost:4566/_floci/health"
--health-interval 2s
--health-timeout 3s
--health-retries 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: { python-version: "3.12" }
- run: pip install -r requirements.txt boto3 pytest
- name: Integration tests
env:
AWS_ENDPOINT_URL: http://localhost:4566
AWS_ACCESS_KEY_ID: ci-dummy
AWS_SECRET_ACCESS_KEY: ci-dummy
run: pytest tests/ -m integrationService container menyala sebelum step pertama dengan health check — dan karena startup floci hanya ~24 ms, biaya "menunggu service siap" praktis nol. Bandingkan dengan menyalakan emulator lain yang bisa makan 10–30 detik per job.
integration-test:
stage: test
image: python:3.12
services:
- name: floci/floci:1.5.15
alias: floci # hostname akses dari job
variables:
AWS_ENDPOINT_URL: http://floci:4566
script:
- pip install -r requirements.txt pytest boto3
- pytest tests/ -m integrationAlias floci membuat endpoint konsisten antar platform — script test tidak peduli di mana ia dijalankan.
Tip
Tanpa credentials AWS sama sekali di CI: floci menerima dummy key. Ini menghilangkan seluruh kategori masalah secrets management untuk layer integration test.
| Disiplin | Cara | Kenapa |
|---|---|---|
| Pin versi image | floci/floci:1.5.15, upgrade via PR eksplisit | Pipeline reproducible; changelog dibaca sebelum naik |
| Cache layer | Runner Docker caching / --pull-policy bijak | Image 90 MB tetap dihindari re-pull tiap job |
| Parallel isolation | Satu instance floci per job, port dinamis bila in-process | Job A tidak melihat bucket/job B |
| Storage mode CI | memory (default) | State lintas-job justru sumber flaky test |
Parallel isolation butuh perhatian khusus: dua job pada runner sama TIDAK boleh berbagi satu instance floci — gunakan service container per-job (GitHub Actions otomatis) atau compose project name unik.
Target outline: tambahkan job e2e berbasis floci pada repo contoh.
# repo/
# ├── app/
# │ └── order_service.py
# ├── tests/
# │ ├── conftest.py # fixture floci (ep.20)
# │ ├── test_unit.py # marker unit
# │ └── test_e2e.py # marker e2e
# └── .github/workflows/ci.ymlUkur dampaknya: bandingkan durasi workflow sebelum/sesudah — kombinasi pull 90 MB, startup 24 ms, dan storage memory biasanya memangkas menit-an per run dibanding emulator berat atau environment cloud.
Rangkuman episode ini:
Episode 22 adalah jawaban langsung atas krisis Maret 2026: migration playbook LocalStack → Floci — langkah swap, translasi env, verifikasi compat SDK, audit feature gates, dan gerbang re-run suite penuh. Sampai jumpa!