-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (170 loc) · 4.91 KB
/
Copy pathci.yml
File metadata and controls
188 lines (170 loc) · 4.91 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
# CI pipeline for the OpenDecree TypeScript SDK.
#
# Jobs: lint, typecheck, test (matrix: Node 22/24), examples, integration → check (alls-green gate)
# The check job aggregates all results for branch protection.
#
# Docs-only PRs (*.md, docs/**, examples/**/README.md) skip the entire workflow via
# paths-ignore. Required checks for those PRs are satisfied by ci-docs.yml.
#
# The first job defines YAML anchors (&checkout, &setup-node-22, &install)
# on its setup steps; subsequent jobs alias them to avoid repetition.
# The test job uses its own setup-node step because the matrix node-version
# varies per run.
#
# The integration job checks out the decree server repo, builds the server
# and tools images, then runs the Vitest integration suite against a
# docker-compose stack (postgres + redis + decree).
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
paths-ignore:
- "**/*.md"
- "docs/**"
- "examples/**/README.md"
workflow_call:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- &checkout
name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
- &setup-node-22
name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "22"
cache: npm
- &install
name: Install dependencies
run: npm ci
- name: Run biome lint
run: npm run lint
typecheck:
name: Typecheck
runs-on: ubuntu-latest
steps:
- *checkout
- *setup-node-22
- *install
- name: Run tsc
run: npm run typecheck
test:
name: Test (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ["22", "24"]
steps:
- *checkout
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: npm
- *install
- name: Run tests with coverage
run: npm run test:coverage
- name: Upload coverage to Codecov
# codecov/codecov-action@v6.0.0
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f
with:
files: coverage/coverage-final.json
token: ${{ secrets.CODECOV_TOKEN }}
version:
name: Version sync
runs-on: ubuntu-latest
steps:
- *checkout
- *setup-node-22
- *install
- name: Check src/version.ts matches package.json
run: npm run check:version
examples:
name: Examples
runs-on: ubuntu-latest
steps:
- *checkout
- *setup-node-22
- name: Install SDK dependencies
run: npm ci
- name: Build SDK
run: npm run build
- name: Install example dependencies
run: cd examples && npm ci
- name: Typecheck examples
run: cd examples && npx tsc --noEmit
integration:
name: Integration
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
packages: read
steps:
- *checkout
- *setup-node-22
- *install
- name: Checkout decree server
uses: actions/checkout@v7
with:
repository: opendecree/decree
path: _decree
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
with:
driver: docker-container
- name: Log in to ghcr.io
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build tools image
uses: docker/build-push-action@v7
with:
context: _decree
file: _decree/build/Dockerfile.tools
load: true
tags: decree-tools
cache-from: type=gha,scope=decree-tools
cache-to: type=gha,scope=decree-tools,mode=max
- name: Build server image
uses: docker/build-push-action@v7
with:
context: _decree
file: _decree/build/Dockerfile
load: true
tags: decree-server
cache-from: type=gha,scope=decree-server
cache-to: type=gha,scope=decree-server,mode=max
- name: Start decree stack
run: docker compose up -d --wait service
env:
DECREE_SRC: ./_decree
TOOLS_IMAGE: decree-tools
SERVICE_IMAGE: decree-server
- name: Run integration tests
run: npm run test:integration
- name: Tear down decree stack
if: always()
run: docker compose down -v
env:
DECREE_SRC: ./_decree
check:
name: CI check
if: always()
needs: [lint, typecheck, test, examples, version, integration]
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}