Repository navigation
146 lines (121 loc) · 5.14 KB
/
Copy pathci.yml
File metadata and controls
146 lines (121 loc) · 5.14 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# No `version:` input: the action reads `packageManager` from
# package.json, and specifying both is an error. The pinned
# pnpm@11.18.0 there is the more precise source anyway.
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
# The live tests drive the real rsync binary. Assert the version so a
# runner image change that moves across the 3.2.4 secluded-args boundary
# shows up here rather than as a mystery later.
- name: rsync version
run: rsync --version | head -1
- run: pnpm install --frozen-lockfile
# The engine and the CLI first: the app builds and the typechecks below
# consume their emitted types.
- run: pnpm build
- run: pnpm typecheck
- run: pnpm test
# The two apps are built separately from `pnpm build` because neither is
# needed to run the tests, but both have to compile before a release.
- name: Build the marketing site
run: pnpm --filter @diskpush/web build
- name: Build the desktop app
run: pnpm --filter @diskpush/desktop build
# The app starting is not something the unit tests can check. Without a
# display it fails at the display, and reaching that point proves main,
# preload and everything they import loaded.
- name: Desktop starts
run: pnpm smoke:desktop
# diskpush.com runs on dev2 as Next's standalone server under Bun (see
# .nixpacks/Dockerfile). Build it the way the image does (Node + pnpm, web
# only), then boot it under Bun and read the pages that come off disk at
# request time or go through the crawl-gateway middleware.
web-bun:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# app/sitemap.ts dates each page from `git log`.
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.4.0
- run: pnpm install --frozen-lockfile --prod=false --filter @diskpush/web...
- run: pnpm --filter @diskpush/web build
- name: Boot the standalone server under Bun
run: |
s=apps/web/.next/standalone
cp -r apps/web/public "$s/apps/web/public"
cp -r apps/web/.next/static "$s/apps/web/.next/static"
test -f "$s/docs/install.md" && test -f "$s/scripts/install.sh"
(cd "$s" && PORT=3999 HOSTNAME=127.0.0.1 bun apps/web/server.js > /tmp/web.log 2>&1 &)
for i in $(seq 1 30); do
curl -sf -o /dev/null http://127.0.0.1:3999/ && break
sleep 1
done
for p in / /docs /docs/install /docs/cli /security /privacy /install.sh /llms.txt /robots.txt /sitemap.xml /.well-known/security.txt /manifest.json; do
code=$(curl -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:3999$p")
echo "$p $code"
[ "$code" = 200 ] || { cat /tmp/web.log; exit 1; }
done
# An unknown slug is read from docs/ at request time: 404, not 500.
code=$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:3999/docs/no-such-doc)
echo "/docs/no-such-doc $code"; [ "$code" = 404 ]
grep -q 'SITE=' <(curl -s http://127.0.0.1:3999/install.sh)
# The crawl gateway in middleware answers AI training crawlers 402.
code=$(curl -s -o /dev/null -w '%{http_code}' -A GPTBot http://127.0.0.1:3999/)
echo "GPTBot $code"; [ "$code" = 402 ]
cat /tmp/web.log
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# No `version:` input: the action reads `packageManager` from
# package.json, and specifying both is an error. The pinned
# pnpm@11.18.0 there is the more precise source anyway.
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm build
- name: Generate a throwaway key for the test containers
run: ssh-keygen -t ed25519 -N '' -f docker/test-ssh-server/test_key
- name: Start the test SSH servers
run: docker compose -f docker/test-ssh-server/compose.yml up -d --build
- name: Wait for sshd
run: |
for i in $(seq 1 30); do
if nc -z localhost 2222; then echo "up"; exit 0; fi
sleep 1
done
echo "sshd never came up"; exit 1
- name: Integration tests
env:
DISKPUSH_TEST_SSH: '1'
DISKPUSH_TEST_SSH_HOST: localhost
DISKPUSH_TEST_SSH_PORT: '2222'
DISKPUSH_TEST_SSH_USER: diskpush
DISKPUSH_TEST_SSH_KEY: docker/test-ssh-server/test_key
run: pnpm vitest run --config vitest.integration.config.ts
- name: Server logs
if: failure()
run: docker compose -f docker/test-ssh-server/compose.yml logs