forked from timgit/pg-boss
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (113 loc) · 4.07 KB
/
Copy pathci.yml
File metadata and controls
132 lines (113 loc) · 4.07 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
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@v5
- name: Set up Node.js
uses: actions/setup-node@v5
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@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@v5
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version: 24
- name: Install
run: npm install
- name: Test (pglite)
run: npm run test:pglite
# 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@v5
- name: Set up Node.js
uses: actions/setup-node@v5
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@v2
with:
parallel-finished: true
carryforward: "standard"