-
-
Notifications
You must be signed in to change notification settings - Fork 271
152 lines (129 loc) · 5.28 KB
/
Copy pathci.yml
File metadata and controls
152 lines (129 loc) · 5.28 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
# Actions are pinned to full commit SHAs; see .github/dependabot.yml for why and how they are updated.
on:
push:
branches: [master]
tags-ignore: ['**']
paths-ignore:
- 'packages/dashboard/**'
pull_request:
branches: [master]
paths-ignore:
- 'packages/dashboard/**'
name: CI
jobs:
# Runs the full suite against Postgres in two modes via one matrix:
# - standard: npm run cover (with coverage, uploaded to Coveralls as the only flag)
# - distributed: npm run test:distributed (DISTRIBUTED=true)
# distributedDatabaseMode is a pure runtime fetch-strategy toggle, so every test (existing and new)
# is automatically exercised against the distributed code paths in the distributed leg - fast and
# reliable, without CockroachDB's slow DDL. The distributed leg is behavioral only: its line
# coverage is already produced by the standard leg, where distributedDatabaseTest/perJobResultsTest
# pin __test__distributed per-instance. Its value is catching features that regress under the
# distributed fetch path (retry/policies/flows/dead-letter/...), which coverage % can't see.
# fail-fast is off so one mode's failure doesn't mask the other's result.
test:
runs-on: ubuntu-latest
container: node:24
strategy:
fail-fast: false
matrix:
include:
- mode: standard
command: npm run cover
- mode: distributed
command: npm run test:distributed
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
- name: Install
run: npm install
- name: Test (${{ matrix.mode }})
run: ${{ matrix.command }}
env:
POSTGRES_HOST: postgres
# Only the standard leg produces coverage; the distributed leg uploads nothing.
- name: Coveralls
if: ${{ matrix.mode == 'standard' }}
uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329 # v2
with:
flag-name: standard
parallel: true
# Runs the full suite against embedded PGlite (in-process WASM PostgreSQL). No service container is
# needed — the database runs inside the test process. Connection-model-specific tests (custom pg
# connections, pool internals, multi-master, distributed mode) are skipped via itPglite/describePglite.
test-pglite:
runs-on: ubuntu-latest
container: node:24
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
- name: Install
run: npm install
- name: Test (pglite)
run: npm run test:pglite
# docs/index.md is generated from README.md by scripts/sync-readme.js, so a README edit
# that skips the regenerate step silently leaves the docs home page stale. The check needs
# no dependencies (the script uses only node builtins) and no database, so it runs as its
# own job for fast, clearly-named feedback instead of riding along in a test leg.
docs-readme-sync:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
- name: Check docs/index.md is in sync with README.md
run: npm run docs:readme -- --check
# Fast feedback on every push/PR: the distributed-mode invariants that the rest of the
# suite can't express, run against a real CockroachDB cluster.
test-cockroachdb:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
- name: Start CockroachDB cluster
run: |
docker compose -f docker-compose.cockroach.yaml up -d
# `up --wait` can't be used here: the one-shot init/setup containers exit by design, which
# newer compose reports as a failed service. Block on the setup container instead - it
# creates the pgboss database once the cluster is initialized.
docker wait pgboss-cockroach-cockroachdb-setup-1 || true
docker compose -f docker-compose.cockroach.yaml exec -T cockroachdb-1 cockroach sql --insecure -e "SHOW DATABASES" | grep -q pgboss
- name: Install
run: npm ci
- name: Test distributed database mode
run: npm run test:cockroachdb
coverage:
needs: [test]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329 # v2
with:
parallel-finished: true
carryforward: "standard"