Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,51 @@ jobs:
echo "OpenCode state files:"
ls -lA ~/.local/state/opencode || true

gateway-smoke:
if: ${{ github.event_name == 'push' || needs.setup.outputs.should-build == 'true' }}
name: Gateway Image Smoke Test
needs: [setup]
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node.js and pnpm
uses: ./.github/actions/setup
- name: Build runtime
run: pnpm --filter @fro-bot/runtime build
- name: Build gateway
run: pnpm --filter @fro-bot/gateway build
- name: Assert no bare @fro-bot/runtime import in gateway bundle
run: |
if grep -q 'from "@fro-bot/runtime"' packages/gateway/dist/main.mjs; then
echo "REGRESSION: gateway dist has bare @fro-bot/runtime import"
exit 1
fi
echo "OK: no bare @fro-bot/runtime import found in gateway bundle"
- name: Build gateway Docker image
run: docker build -f deploy/gateway.Dockerfile -t fro-bot-gateway:smoke .
- name: Smoke-test gateway image (assert config load, not module crash)
run: |
set +e
output="$(timeout 60s docker run --rm fro-bot-gateway:smoke 2>&1)"
status=$?
set -e
echo "--- docker run output ---"
echo "$output"
echo "--- exit status: $status ---"
if [ "$status" -eq 124 ]; then
echo "REGRESSION: gateway image hung on boot (timed out)"
exit 1
fi
test "$status" -ne 0
echo "$output" | grep -q "Missing required secret: DISCORD_TOKEN"
if echo "$output" | grep -q "ERR_MODULE_NOT_FOUND"; then
echo "REGRESSION: module resolution failed (ERR_MODULE_NOT_FOUND)"
exit 1
fi
echo "OK: gateway reached config loading (DISCORD_TOKEN check), no module-resolution crash"

dependency-review:
if: ${{ github.event_name == 'pull_request' }}
name: Dependency Review
Expand Down
2 changes: 0 additions & 2 deletions deploy/gateway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ WORKDIR /app

# Copy production node_modules from build stage
COPY --from=build /workspace/node_modules ./node_modules
COPY --from=build /workspace/packages/runtime/package.json ./packages/runtime/package.json
COPY --from=build /workspace/packages/runtime/dist/ ./packages/runtime/dist/
COPY --from=build /workspace/packages/gateway/package.json ./packages/gateway/package.json
COPY --from=build /workspace/packages/gateway/dist/ ./packages/gateway/dist/

Expand Down
4 changes: 4 additions & 0 deletions packages/gateway/tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ export default defineConfig({
entry: ['src/main.ts'],
format: 'esm',
outDir: 'dist',
noExternal: id => {
if (id === '@fro-bot/runtime' || id.startsWith('@fro-bot/runtime/')) return true
return false
},
})
Loading