Skip to content

Fix: compose の REALTIME_* を必須化し既定値の二重正本と空値の受け皿を塞ぐ (#1573) #1521

Fix: compose の REALTIME_* を必須化し既定値の二重正本と空値の受け皿を塞ぐ (#1573)

Fix: compose の REALTIME_* を必須化し既定値の二重正本と空値の受け皿を塞ぐ (#1573) #1521

name: App Boot Check
on:
pull_request:
paths:
- '.github/workflows/app-di-startup-check.yaml'
- 'cmd/**.go'
- 'internal/**.go'
- 'env/.env.ci'
- 'env/.env'
- 'go.mod'
- 'go.sum'
- '.makefiles/**'
- 'makefile'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
app-boot-check:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
env:
ENV: ci
PORT: 8080
services:
database:
image: postgres:18.4-trixie@sha256:a02db8cac496f15b094798a38254f14d6e00741f709360e5e00bb6668ea31636
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres-password
POSTGRES_DB: test
POSTGRES_INITDB_ARGS: "--encoding=UTF8"
TZ: Asia/Tokyo
PGTZ: Asia/Tokyo
ports:
- "5432:5432"
options: >-
--health-cmd="pg_isready -U postgres -d test"
--health-interval=10s
--health-timeout=5s
--health-retries=5
--health-start-period=20s
dynamodb_local:
# DynamoDB Local, the Realtime Delivery store. Service-container defaults: README.md § Notes.
image: amazon/dynamodb-local:3.3.1@sha256:ff89bd48ff32cd8d9be5fee8873b65b8854dc408f1afe881be6eb00247bc0dab
ports:
- "8000:8000"
options: >-
--health-cmd="curl -s -o /dev/null http://localhost:8000"
--health-interval=5s
--health-timeout=5s
--health-retries=10
--health-start-period=10s
goaws:
# SNS / SQS emulator for the Realtime Delivery fan-out. Service-container defaults: README.md § Notes.
image: admiralpiett/goaws:v0.5.4@sha256:18589afe16517751cc981354536c148854157a718bee9059494d6cdee3dc4e2d
ports:
- "4100:4100"
options: >-
--health-cmd="nc -z localhost 4100"
--health-interval=5s
--health-timeout=5s
--health-retries=10
--health-start-period=5s
steps:
- name: Harden the runner
uses: step-security/harden-runner@b09bb98e06d4d774595224525879c09bc6e98c40 # v2.20.1
with:
egress-policy: block
allowed-endpoints: >
agent.api.stepsecurity.io:443
api.github.com:443
github.com:443
codeload.github.com:443
objects.githubusercontent.com:443
raw.githubusercontent.com:443
release-assets.githubusercontent.com:443
*.actions.githubusercontent.com:443
*.blob.core.windows.net:443
mise.jdx.dev:443
mise-versions.jdx.dev:443
mise.run:443
mise.en.dev:443
aquaproj.github.io:443
proxy.golang.org:443
sum.golang.org:443
index.golang.org:443
storage.googleapis.com:443
dl.google.com:443
go.dev:443
golang.org:443
downloads.sqlc.dev:443
nodejs.org:443
registry.npmjs.org:443
get.pnpm.io:443
astral.sh:443
pypi.org:443
files.pythonhosted.org:443
tuf-repo-cdn.sigstore.dev:443
rekor.sigstore.dev:443
fulcio.sigstore.dev:443
api.npmjs.org:443
api.osv.dev:443
npm.jsr.io:443
docker.io:443
index.docker.io:443
registry-1.docker.io:443
auth.docker.io:443
*.docker.io:443
production.cloudflare.docker.com:443
production.cloudfront.docker.com:443
mirror.gcr.io:443
ghcr.io:443
pkg-containers.githubusercontent.com:443
dl-cdn.alpinelinux.org:443
dl-cdn.alpinelinux.org:80
deb.debian.org:443
deb.debian.org:80
security.debian.org:443
security.debian.org:80
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: go.mod
cache: true
- name: Materialize ci env for embedding
run: make materialize-env
- name: Build server
run: go build -o ./bin/server ./cmd/
# Why this must run before the server starts: README.md § Notes.
- name: Initialize the Realtime Delivery store and topic
run: go run ./cmd/ realtime-init
- name: Start server
run: |
./bin/server serve > server.log 2>&1 &
echo $! > server.pid
- name: Wait for /ready endpoint
run: |
set -euo pipefail
for i in {1..30}; do
if curl -fsS "http://localhost:${PORT}/ready" > /dev/null; then
echo "Readiness check OK"
exit 0
fi
echo "Waiting for server... ($i)"
sleep 2
done
echo "Readiness check failed"
echo "Server logs:"
cat server.log || true
exit 1
- name: Stop server
if: always()
run: |
if [ -f server.pid ]; then
kill "$(cat server.pid)" || true
fi