Repository navigation
49 lines (45 loc) · 1.65 KB
/
Copy pathci.yml
File metadata and controls
49 lines (45 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Bun CI (was the sh1pt-managed node-pnpm-ci pack; the app moved to Bun, so this
# file is no longer managed by that pack).
name: CI
on:
push:
branches: [main, master]
pull_request:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: install, typecheck, test, build (Bun)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
# The version comes from packageManager in package.json, the same Bun the
# image (.nixpacks/Dockerfile) pins.
- uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- run: bun install --frozen-lockfile
- run: bun run typecheck
- run: bun run test
env:
CI: true
- run: bun run build:web
env:
NEXT_PUBLIC_BASE_URL: https://c0upons.com
# The production server must boot under Bun and answer.
- name: Standalone server answers under Bun
run: |
cd apps/web
cp -r public .next/standalone/apps/web/
cp -r .next/static .next/standalone/apps/web/.next/
(cd .next/standalone && PORT=3000 HOSTNAME=127.0.0.1 REDDIT_SYNC_INTERVAL_MINUTES=0 GROCERY_SYNC_INTERVAL_MINUTES=0 bun apps/web/server.js > "$RUNNER_TEMP/server.log" 2>&1 &)
for i in $(seq 1 30); do
code=$(curl -s -o /dev/null -w '%{http_code}' -H 'x-forwarded-proto: https' http://127.0.0.1:3000/robots.txt || true)
[ "$code" = 200 ] && { echo "/robots.txt -> $code"; exit 0; }
sleep 1
done
cat "$RUNNER_TEMP/server.log"; exit 1