-
Notifications
You must be signed in to change notification settings - Fork 4
129 lines (113 loc) · 4.7 KB
/
Copy pathci.yml
File metadata and controls
129 lines (113 loc) · 4.7 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: CI
on:
pull_request:
branches: [main]
# Naming `types` replaces the default set, so the first three are the
# defaults restored. `edited` is the addition: it re-runs when a title or
# description changes, so a session link pasted in after a green run can't
# sit behind a stale check. PR descriptions here are rarely edited, so the
# extra full runs are cheap.
types: [opened, synchronize, reopened, edited]
jobs:
ci:
runs-on: self-hosted
steps:
# First, and before checkout, so a bad description fails in seconds
# rather than after the full suite. `.claude/settings.json` sets
# attribution.sessionUrl:false so Claude Code stops emitting these; this
# is the check that tells us if that ever stops working.
#
# Only line numbers are reported, never the matched text: this repo is
# public, so are its Actions logs, and echoing the link here would
# republish the identifier somewhere editing the PR cannot reach.
- name: No Claude Code session links in the PR title or description
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BODY: ${{ github.event.pull_request.body }}
run: |
lines=$(printf '%s\n%s' "$PR_TITLE" "$PR_BODY" \
| grep -in 'claude\.ai/code/session' | cut -d: -f1 | tr '\n' ' ') || true
if [ -n "$lines" ]; then
echo "::error::Remove the Claude Code session link from the PR title/description (line 1 is the title, line 2 onward is the description). Offending lines: $lines"
exit 1
fi
- uses: actions/checkout@v6
with:
# ci.yml doesn't call gh/git push/private-registry work (that's release.yml).
# Skipping credential persist means checkout's post-run also skips the
# `git submodule foreach --recursive` cleanup loop, which is unnecessary
# with no submodules and slow on self-hosted macOS.
persist-credentials: false
- uses: pnpm/action-setup@v6
with:
version: 9
- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.13"
- uses: actions/setup-node@v6
with:
node-version: "22"
- name: Start Postgres
id: postgres
run: |
CONTAINER="dispatch-ci-$GITHUB_RUN_ID"
echo "container=$CONTAINER" >> "$GITHUB_OUTPUT"
PORT=$((RANDOM % 10000 + 10000))
echo "port=$PORT" >> "$GITHUB_OUTPUT"
docker run --rm -d \
--name "$CONTAINER" \
-e POSTGRES_USER=dispatch \
-e POSTGRES_PASSWORD=dispatch \
-e POSTGRES_DB=postgres \
-p "$PORT":5432 \
postgres:17-alpine
for i in $(seq 1 15); do
docker exec "$CONTAINER" pg_isready -U dispatch && break
sleep 1
done
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright browsers
run: pnpm exec playwright install chromium
- name: Validate assisted-update metadata
run: |
META="release-notes/next-assisted-update.json"
if [ -f "$META" ]; then
bun bin/embed-assisted-update.ts --check-only --metadata "$META"
fi
- name: CI checks
run: pnpm run ci
env:
TEST_DATABASE_URL: postgres://dispatch:dispatch@127.0.0.1:${{ steps.postgres.outputs.port }}/postgres
- name: Build Bun binaries
run: pnpm run build:bun
- name: Smoke test compiled binary for host platform
run: |
case "$(uname -s)" in
Darwin) PLATFORM="darwin" ;;
Linux) PLATFORM="linux" ;;
*) echo "unsupported platform: $(uname -s)" >&2; exit 1 ;;
esac
case "$(uname -m)" in
aarch64|arm64) ARCH="arm64" ;;
x86_64) ARCH="x64" ;;
*) echo "unsupported architecture: $(uname -m)" >&2; exit 1 ;;
esac
BINARY=$(find dist/bun -maxdepth 1 -type f -name "dispatch-*-bun-${PLATFORM}-${ARCH}" | head -n 1)
if [[ -z "$BINARY" ]]; then
echo "error: no Bun binary found for platform ${PLATFORM}/${ARCH}" >&2
exit 1
fi
bun scripts/smoke-bun-binary.mjs "$BINARY"
env:
TEST_DATABASE_URL: postgres://dispatch:dispatch@127.0.0.1:${{ steps.postgres.outputs.port }}/postgres
- name: Upload Playwright report
uses: actions/upload-artifact@v7
if: failure()
with:
name: playwright-report
path: test-results/
retention-days: 7
- name: Stop Postgres
if: always()
run: docker stop ${{ steps.postgres.outputs.container }} 2>/dev/null || true