-
Notifications
You must be signed in to change notification settings - Fork 0
288 lines (234 loc) · 7.79 KB
/
ci.yml
File metadata and controls
288 lines (234 loc) · 7.79 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
name: CI/CD Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_call:
# Allow this workflow to be called by other workflows (like release)
concurrency:
group: ci-${{ github.ref }}-${{ github.run_id }}
cancel-in-progress: true
jobs:
lint-and-typecheck:
name: Lint & Type Check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10.13.1
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run linting
run: pnpm lint
- name: Run type checking
run: pnpm type-check
test:
name: Test Suite
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
node-version: ['20', '22']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10.13.1
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-${{ matrix.node-version }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm build
- name: Run tests
run: pnpm test
- name: Upload test coverage
if: matrix.node-version == '20'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/*/coverage/lcov.info
fail_ci_if_error: false
build:
name: Build & Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [lint-and-typecheck, test]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10.13.1
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build all packages
run: pnpm build
- name: Test Vite React example build
working-directory: examples/vite-react
run: |
pnpm build
ls -la dist/
- name: Test Node.js Express example build
working-directory: examples/node-express
run: |
pnpm build
ls -la dist/
- name: Test Vanilla Rollup example build
working-directory: examples/vanilla-rollup
run: |
pnpm build
ls -la dist/
- name: Verify package exports
run: |
node -e "console.log('Testing @easythread/core import:', Object.keys(require('./packages/core/dist/index.js')))"
node -e "console.log('Testing @easythread/vite import:', Object.keys(require('./packages/vite-plugin/dist/index.js')))"
node -e "console.log('Testing @easythread/rollup import:', Object.keys(require('./packages/rollup-plugin/dist/index.js')))"
node -e "console.log('Testing @easythread/esbuild import:', Object.keys(require('./packages/esbuild-plugin/dist/index.js')))"
examples-e2e:
name: End-to-End Examples Test
runs-on: ubuntu-latest
timeout-minutes: 20
needs: [build]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10.13.1
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build all packages
run: pnpm build
- name: Test Node.js Express example runtime
working-directory: examples/node-express
run: |
pnpm build
timeout 30s node dist/index.js &
SERVER_PID=$!
sleep 5
# Test the fibonacci endpoint
curl -f http://localhost:3000/fibonacci/10 || exit 1
echo "✅ Node.js Express example working"
kill $SERVER_PID || true
- name: Test Vanilla Rollup example runtime
working-directory: examples/vanilla-rollup
run: |
pnpm build
pnpm start
echo "✅ Vanilla Rollup example working"
publish-ready:
name: Publish Readiness Check
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [examples-e2e]
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10.13.1
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm build
- name: Check package.json files
run: |
echo "Checking package.json files for publish readiness..."
find packages -name "package.json" -exec echo "=== {} ===" \; -exec cat {} \;
- name: Dry run publish
run: |
echo "Performing dry run publish check..."
cd packages/core && npm pack --dry-run
cd ../vite-plugin && npm pack --dry-run
cd ../rollup-plugin && npm pack --dry-run
cd ../esbuild-plugin && npm pack --dry-run
- name: Create GitHub Release (Manual Trigger)
if: false # Set to true when ready to enable automated releases
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Release v${{ github.run_number }}
draft: true
prerelease: false