@@ -26,25 +26,31 @@ jobs:
2626 runs-on : ubuntu-latest
2727
2828 steps :
29+
2930 - uses : actions/checkout@v4
3031
3132 - uses : oven-sh/setup-bun@v1
33+
3234 with :
3335 bun-version : latest
3436
3537 - name : Install dependencies
38+
3639 run : bun install
3740
3841 - name : Generate certificates
42+
3943 run : |
4044 bunx @stacksjs/tlsx secure app.localhost
4145
4246 - name : Start server with HTTPS
47+
4348 run : |
4449 bun run start &
4550 sleep 5
4651
4752 - name : Run tests
53+
4854 run : bun test
4955` ` `
5056
@@ -60,11 +66,13 @@ jobs:
6066 runs-on : ubuntu-latest
6167
6268 steps :
69+
6370 - uses : actions/checkout@v4
6471
6572 - uses : oven-sh/setup-bun@v1
6673
6774 - name : Cache certificates
75+
6876 uses : actions/cache@v3
6977 with :
7078 path : ~/.stacks/ssl
@@ -73,12 +81,14 @@ jobs:
7381 ${{ runner.os }}-certs-
7482
7583 - name : Generate certificates (if not cached)
84+
7685 run : |
7786 if [ ! -f ~/.stacks/ssl/app.localhost.crt ]; then
7887 bunx @stacksjs/tlsx secure app.localhost
7988 fi
8089
8190 - name : Run tests
91+
8292 run : bun test
8393` ` `
8494
@@ -94,11 +104,13 @@ jobs:
94104 runs-on : ubuntu-latest
95105
96106 steps :
107+
97108 - uses : actions/checkout@v4
98109
99110 - uses : oven-sh/setup-bun@v1
100111
101112 - name : Generate certificates
113+
102114 run : |
103115 cat > tlsx.config.ts << 'EOF'
104116 export default {
@@ -112,6 +124,7 @@ jobs:
112124 bunx @stacksjs/tlsx generate
113125
114126 - name : Run E2E tests
127+
115128 run : bun run test:e2e
116129` ` `
117130
@@ -122,6 +135,7 @@ jobs:
122135` ` ` yaml
123136# .gitlab-ci.yml
124137stages :
138+
125139 - test
126140
127141variables :
@@ -134,12 +148,15 @@ test:
134148 cache :
135149 key : ${CI_COMMIT_REF_SLUG}-certs
136150 paths :
151+
137152 - .ssl/
138153
139154 script :
155+
140156 - bun install
141157 - bunx @stacksjs/tlsx secure app.localhost --cert-path $TLSX_CERT_PATH
142158 - bun test
159+
143160```
144161
145162### With Services
@@ -150,15 +167,20 @@ test:
150167 image : oven/bun:latest
151168
152169 services :
170+
153171 - name : postgres:15
172+
154173 alias : db
155174
156175 before_script :
176+
157177 - bun install
158178 - bunx @stacksjs/tlsx secure app.localhost
159179
160180 script :
181+
161182 - bun run test:integration
183+
162184```
163185
164186## CircleCI
@@ -170,37 +192,49 @@ version: 2.1
170192jobs :
171193 test :
172194 docker :
195+
173196 - image : oven/bun:latest
174197
175198 steps :
199+
176200 - checkout
177201
178202 - restore_cache :
203+
179204 keys :
205+
180206 - certs-{{ checksum "tlsx.config.ts" }}
181207 - certs-
182208
183209 - run :
210+
184211 name : Install dependencies
185212 command : bun install
186213
187214 - run :
215+
188216 name : Generate certificates
189217 command : bunx @stacksjs/tlsx secure app.localhost
190218
191219 - save_cache :
220+
192221 paths :
222+
193223 - ~/.stacks/ssl
224+
194225 key : certs-{{ checksum "tlsx.config.ts" }}
195226
196227 - run :
228+
197229 name : Run tests
198230 command : bun test
199231
200232workflows :
201233 test :
202234 jobs :
235+
203236 - test
237+
204238```
205239
206240## Docker Integration
@@ -240,15 +274,20 @@ services:
240274 app :
241275 build : .
242276 volumes :
277+
243278 - certs:/app/.ssl
279+
244280 environment :
281+
245282 - SSL_CERT=/app/.ssl/app.localhost.crt
246283 - SSL_KEY=/app/.ssl/app.localhost.key
247284
248285 cert-generator :
249286 image : oven/bun:latest
250287 volumes :
288+
251289 - certs:/ssl
290+
252291 command : bunx @stacksjs/tlsx secure app.localhost --cert-path /ssl
253292 restart : " no"
254293
@@ -291,19 +330,27 @@ spec:
291330 template :
292331 spec :
293332 containers :
333+
294334 - name : tlsx
335+
295336 image : oven/bun:latest
296337 command :
338+
297339 - sh
298340 - -c
299341 - |
342+
300343 bun add -g @stacksjs/tlsx
301344 bunx @stacksjs/tlsx secure app.localhost --cert-path /certs
302345 volumeMounts :
346+
303347 - name : certs
348+
304349 mountPath : /certs
305350 volumes :
351+
306352 - name : certs
353+
307354 emptyDir : {}
308355 restartPolicy : Never
309356` ` `
@@ -330,7 +377,7 @@ data:
330377
331378` ` ` bash
332379# .husky/pre-commit
333- # !/bin/sh
380+ # !/bin/sh
334381
335382# Check if certificates need renewal
336383bunx @stacksjs/tlsx check --quiet
@@ -412,23 +459,27 @@ name: Certificate Renewal
412459
413460on :
414461 schedule :
415- - cron : ' 0 0 1 * *' # Monthly
462+
463+ - cron : ' 0 0 1 _ _' # Monthly
416464
417465jobs :
418466 renew :
419467 runs-on : ubuntu-latest
420468
421469 steps :
470+
422471 - uses : actions/checkout@v4
423472
424473 - uses : oven-sh/setup-bun@v1
425474
426475 - name : Check and renew certificates
476+
427477 run : |
428478 bunx @stacksjs/tlsx check
429479 bunx @stacksjs/tlsx renew --threshold 30
430480
431481 - name : Commit renewed certificates
482+
432483 run : |
433484 git config user.name "github-actions[bot]"
434485 git config user.email "github-actions[bot]@users.noreply.github.com"
@@ -443,7 +494,9 @@ jobs:
443494
444495` ` ` yaml
445496# Use secrets for sensitive data
497+
446498- name : Generate certificates
499+
447500 env :
448501 CA_PASSWORD : ${{ secrets.CA_PASSWORD }}
449502 run : |
@@ -455,12 +508,14 @@ jobs:
455508
456509` ` ` yaml
457510# Don't upload private keys as artifacts
511+
458512- uses : actions/upload-artifact@v3
513+
459514 with :
460515 name : certificates
461516 path : |
462- .ssl/* .crt
463- !.ssl/* .key # Exclude private keys
517+ .ssl/_ .crt
518+ !.ssl/_ .key # Exclude private keys
464519` ` `
465520
466521## Troubleshooting
@@ -474,7 +529,9 @@ jobs:
474529### Debug Mode
475530
476531` ` ` yaml
532+
477533- name : Generate certificates (debug)
534+
478535 run : |
479536 bunx @stacksjs/tlsx secure app.localhost --verbose
480537 env :
0 commit comments