-
Notifications
You must be signed in to change notification settings - Fork 4
295 lines (250 loc) · 9.68 KB
/
Copy pathnode.js.yml
File metadata and controls
295 lines (250 loc) · 9.68 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
name: Node.js CI
on:
push:
branches: ['master']
pull_request:
branches: ['master']
permissions:
contents: read
jobs:
verify-ci:
name: Verify CI
runs-on: ubuntu-latest
env:
NODE_ENV: development
strategy:
matrix:
node-version: [22.21.1]
steps:
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node-version }}
- name: Set up pnpm
shell: bash
run: |
corepack enable
corepack prepare pnpm@11.1.1 --activate
pnpm --version
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Ensure Linux rolldown native binding
if: runner.os == 'Linux'
shell: bash
run: |
set -euo pipefail
if node -e "require.resolve('@rolldown/binding-linux-x64-gnu')" >/dev/null 2>&1; then
echo "rolldown Linux binding already present"
else
echo "rolldown Linux binding missing; forcing reinstall with minimumReleaseAge disabled"
pnpm install --force --frozen-lockfile --config.minimumReleaseAge=0
node -e "require.resolve('@rolldown/binding-linux-x64-gnu')"
fi
- name: Verify test toolchain dependencies
shell: bash
run: |
set -euo pipefail
node -e "require.resolve('jest')"
node -e "require.resolve('jest-environment-jsdom')"
- name: Install Playwright browser
run: pnpm exec playwright install --with-deps chromium
- name: Verify
run: pnpm run verify:ci
- name: Upload coverage artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-report-node-${{ matrix.node-version }}
path: coverage/
- name: Upload HTML coverage report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-html-report-node-${{ matrix.node-version }}
path: coverage/lcov-report/
cross-language-toolchain:
name: Cross-Language Toolchain
runs-on: ubuntu-latest
env:
NODE_ENV: development
strategy:
matrix:
node-version: [22.21.1]
steps:
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node-version }}
- name: Set up pnpm
shell: bash
run: |
corepack enable
corepack prepare pnpm@11.1.1 --activate
pnpm --version
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.12'
- name: Set up Ruby
uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1
with:
ruby-version: '3.3'
- name: Set up PHP
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # v2
with:
php-version: '8.3'
- name: Set up Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: '21'
- name: Set up .NET
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
with:
dotnet-version: '8.0.x'
- name: Install Perl and Kotlin compiler
run: |
sudo apt-get update
sudo apt-get install -y perl unzip
KOTLIN_VERSION=2.1.21
wget -q "https://github.com/JetBrains/kotlin/releases/download/v${KOTLIN_VERSION}/kotlin-compiler-${KOTLIN_VERSION}.zip"
unzip -q "kotlin-compiler-${KOTLIN_VERSION}.zip"
sudo mv kotlinc /opt/kotlinc
echo "/opt/kotlinc/bin" >> "$GITHUB_PATH"
- name: Verify language toolchains
run: |
node --version
python --version
ruby --version
php --version
perl --version
javac -version
dotnet --version
kotlinc -version
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: CLI pack smoke test
shell: bash
run: |
set -euo pipefail
rm -rf .tmp-pack
mkdir -p .tmp-pack
CORE_TARBALL="$(pnpm --filter @anywaydata/core pack --pack-destination ./.tmp-pack | tail -n 1)"
CLI_TARBALL="$(pnpm --filter @anywaydata/cli pack --pack-destination ./.tmp-pack | tail -n 1)"
CORE_TARBALL_ABS="$(realpath "${CORE_TARBALL}")"
CLI_TARBALL_ABS="$(realpath "${CLI_TARBALL}")"
echo "Core tarball: ${CORE_TARBALL_ABS}"
echo "CLI tarball: ${CLI_TARBALL_ABS}"
test -f "${CORE_TARBALL_ABS}"
test -f "${CLI_TARBALL_ABS}"
SMOKE_DIR="$(mktemp -d)"
export SMOKE_DIR
mkdir -p "${SMOKE_DIR}/core" "${SMOKE_DIR}/cli"
tar -xzf "${CORE_TARBALL_ABS}" -C "${SMOKE_DIR}/core"
tar -xzf "${CLI_TARBALL_ABS}" -C "${SMOKE_DIR}/cli"
node - <<NODE
const fs = require('node:fs');
const path = require('node:path');
const cliPkgPath = path.join(process.env.SMOKE_DIR, 'cli', 'package', 'package.json');
const cliPkg = JSON.parse(fs.readFileSync(cliPkgPath, 'utf8'));
cliPkg.dependencies = cliPkg.dependencies || {};
cliPkg.dependencies['@anywaydata/core'] = 'file:../../core/package';
fs.writeFileSync(cliPkgPath, JSON.stringify(cliPkg, null, 2));
NODE
cat "${SMOKE_DIR}/cli/package/package.json"
pnpm --dir "${SMOKE_DIR}/cli/package" install --frozen-lockfile=false
pnpm --dir "${SMOKE_DIR}/cli/package" list --depth 0
node "${SMOKE_DIR}/cli/package/src/node-entry.js" --help
echo "CLI pack smoke test passed with local core+cli tarballs: ${CORE_TARBALL}, ${CLI_TARBALL}"
- name: Build
run: pnpm run build:workspaces
- name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.2.10
- name: Bun CLI entry smoke test
run: bun run apps/cli/src/bun-entry.js --help
docker-smoke:
name: Docker Smoke Tests
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Docker smoke test (API)
run: |
set -euo pipefail
cleanup() {
docker rm -f api-ci >/dev/null 2>&1 || true
}
trap cleanup EXIT
api_curl() {
if ! curl -fsS "$@"; then
echo "API smoke request failed: curl $*"
docker logs api-ci || true
exit 1
fi
}
docker build -f apps/api/Dockerfile -t anywaydata-api-ci .
docker run -d --name api-ci -p 18082:3000 anywaydata-api-ci
ready=0
for i in {1..40}; do
if ! docker ps --format '{{.Names}}' | grep -q '^api-ci$'; then
echo "API container exited before readiness check completed"
docker ps -a --filter "name=api-ci" || true
docker logs api-ci || true
exit 1
fi
if curl -fsS http://127.0.0.1:18082/v1/health >/dev/null; then
ready=1
break
fi
sleep 1
done
if [ "$ready" -ne 1 ]; then
docker logs api-ci || true
echo "API container did not become ready within timeout"
exit 1
fi
api_curl http://127.0.0.1:18082/v1/health | grep -qi "ok"
api_curl -X POST "http://127.0.0.1:18082/v1/generate" \
-H "content-type: application/json" \
-d '{"textSpec":"Name\nBob","rowCount":2,"outputFormat":"json"}' | grep -q '"format":"json"'
echo "API docker smoke test passed"
- name: Docker smoke test (Web)
run: |
set -euo pipefail
cleanup() {
docker rm -f web-ci >/dev/null 2>&1 || true
}
trap cleanup EXIT
docker build -f apps/web/Dockerfile -t anywaydata-web-ci .
docker run -d --rm --name web-ci -p 18080:80 anywaydata-web-ci
for i in {1..20}; do
if curl -fsS http://127.0.0.1:18080/app.html >/dev/null; then
break
fi
sleep 1
done
curl -fsS http://127.0.0.1:18080/app.html | grep -q "AnyWayData"
curl -fsS http://127.0.0.1:18080/generator.html | grep -q "AnyWayData"
echo "Web docker smoke test passed"
- name: Docker smoke test (AnyWayData full site)
run: |
set -euo pipefail
cleanup() {
docker rm -f site-ci >/dev/null 2>&1 || true
}
trap cleanup EXIT
docker build -f apps/anywaydata/Dockerfile -t anywaydata-site-ci .
docker run -d --rm --name site-ci -p 18081:8080 anywaydata-site-ci
for i in {1..20}; do
if curl -fsS http://127.0.0.1:18081/ >/dev/null; then
break
fi
sleep 1
done
curl -fsS http://127.0.0.1:18081/ | grep -q "AnyWayData"
curl -fsS http://127.0.0.1:18081/app.html | grep -q "AnyWayData"
echo "AnyWayData full-site docker smoke test passed"