Repository navigation
136 lines (125 loc) · 6.58 KB
/
Copy pathtests-bench.yml
File metadata and controls
136 lines (125 loc) · 6.58 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
name: "Test Benchmark JS"
# Trigger paths follow the package GRAPH, not the bench directory. bench depends
# on `@cipherstash/stack` and `@cipherstash/stack-drizzle`, and (since the fixture
# schema moved to EQL v3 domains) on the CLI's EQL installer — a break in any of
# them can red this job, so an edit to any of them has to be able to trigger it.
# Scoped the same way the `integration-*` workflows scope theirs rather than
# taking whole packages, to keep the trigger surface honest.
on:
push:
branches:
- 'main'
paths:
- 'languages/typescript/packages/bench/**'
- 'languages/typescript/packages/stack/src/eql/v3/**'
# The bench drives the typed v3 CLIENT, which lives in `encryption/`, not
# `eql/v3/` (that is the authoring DSL). Without this the job stayed green
# by never running for the changes most likely to break it.
- 'languages/typescript/packages/stack/src/encryption/**'
- 'languages/typescript/packages/stack-drizzle/**'
- 'languages/typescript/packages/test-kit/**'
- 'languages/typescript/packages/cli/src/installer/**'
- 'local/**'
- '.github/workflows/tests-bench.yml'
- '.github/actions/integration-setup/**'
- '.github/actions/build-auth-binding/**'
pull_request:
branches:
- "**"
# Repeated verbatim: GitHub Actions does not support YAML anchors/aliases.
paths:
- 'languages/typescript/packages/bench/**'
- 'languages/typescript/packages/stack/src/eql/v3/**'
# The bench drives the typed v3 CLIENT, which lives in `encryption/`, not
# `eql/v3/` (that is the authoring DSL). Without this the job stayed green
# by never running for the changes most likely to break it.
- 'languages/typescript/packages/stack/src/encryption/**'
- 'languages/typescript/packages/stack-drizzle/**'
- 'languages/typescript/packages/test-kit/**'
- 'languages/typescript/packages/cli/src/installer/**'
- 'local/**'
- '.github/workflows/tests-bench.yml'
- '.github/actions/integration-setup/**'
- '.github/actions/build-auth-binding/**'
jobs:
tests-bench:
name: Run Bench Smoke Tests
runs-on: runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=4/image=ubuntu24-full-x64/volume=80gb/extras=s3-cache
timeout-minutes: 10
steps:
- name: Checkout Repo
uses: actions/checkout@v6
# The shared integration preamble, which also builds the `stash` CLI — not
# incidental here: the bench `globalSetup` installs EQL v3 by shelling out
# to the real `stash eql install --eql-version 3`.
- uses: ./.github/actions/integration-setup
with:
# This job's existing Node; the composite defaults to 24 for the
# integration suites.
node-version: 22
# The bench unit checks import @cipherstash/stack, and the `stash eql
# install` in the bench `globalSetup` runs the CLI; both load
# @cipherstash/auth's napi module.
- name: Build the @cipherstash/auth binding
uses: ./.github/actions/build-auth-binding
# `@cipherstash/stack` ships dist/-based `exports`; bench imports
# from `@cipherstash/stack` and `@cipherstash/stack-drizzle` (the Drizzle
# adapter split out into its own package), so both must be built before
# vitest can resolve them — the drizzle bench/test files import
# `@cipherstash/stack-drizzle`. Going through turbo also picks up `^build`
# deps (stack-drizzle depends on stack).
- name: Build stack + adapter packages
run: pnpm exec turbo run build --filter @cipherstash/stack --filter @cipherstash/stack-drizzle
# Deliberately BEFORE Postgres. Separate config, no globalSetup: these
# need neither a database nor credentials, so they must not be reachable
# only after the steps that do — a docker failure below would otherwise
# skip the one check whose whole rationale is that it cannot be skipped.
# The seed keying they check was wrong for the entire v2 -> v3 port
# precisely because every suite that would have caught it needs
# credentials, and `tsc --noEmit` passes on a hand-written row type that
# agrees with itself (#772 review, finding 12).
- name: Run bench unit checks (no database, no credentials)
working-directory: languages/typescript/packages/bench
run: pnpm test:unit
# Docker Hub refuses pulls without a login after too many from one
# address, and RunsOn machines reach that limit. With either secret empty,
# as on a fork's pull request, this step does nothing and pulls stay
# anonymous. scripts/__tests__/workflow-docker-hub-login.test.mjs
# requires it.
- name: Log in to Docker Hub
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
run: |
set -euo pipefail
if [ -z "$DOCKER_HUB_USERNAME" ] || [ -z "$DOCKER_HUB_PASSWORD" ]; then
echo "No Docker Hub credentials, so image pulls stay anonymous."
exit 0
fi
printf '%s' "$DOCKER_HUB_PASSWORD" |
docker login --username "$DOCKER_HUB_USERNAME" --password-stdin
# Service-scoped `postgres`: local/docker-compose.yml also defines a
# PostgREST that bench never talks to.
#
# This container has EQL v2 baked in and NOTHING to do with the v3 domains
# the fixture schema needs — those come from the `globalSetup` install
# below. Do not add an EQL step here; keeping the install inside vitest is
# what makes `pnpm test:local` and CI the same path.
- name: Start local Postgres
working-directory: local
run: docker compose up --wait --wait-timeout 60 postgres
# The login stored the Docker Hub password in the Docker config file,
# where any later step could read it. No later step pulls an image.
# scripts/__tests__/workflow-docker-hub-login.test.mjs checks the order.
- name: Log out of Docker Hub
if: always()
run: docker logout
# `pnpm test:local` resolves to `vitest run`; the trailing `db-only`
# is a vitest path filter that narrows to __tests__/db-only.test.ts
# (credential-free smoke). Note: pnpm 10 forwards script args without
# `--`; using `--` here would cause vitest to treat it as the
# option-terminator and ignore the filter, running all 3 test files
# — including ones that need CipherStash credentials.
- name: Run bench smoke tests
working-directory: languages/typescript/packages/bench
run: pnpm test:local db-only