-
Notifications
You must be signed in to change notification settings - Fork 0
184 lines (144 loc) · 4.8 KB
/
hono_integration.yaml
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
name: Hono Integration
on:
pull_request
env:
NEON_DATABASE_USERNAME: ${{ secrets.NEON_DATABASE_USERNAME }}
NEON_DATABASE_NAME: ${{ secrets.NEON_DATABASE_NAME }}
NEON_PROJECT_ID: ${{ vars.NEON_PROJECT_ID }}
NEON_API_TOKEN: ${{ secrets.NEON_API_TOKEN }}
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CLERK_PUBLISHABLE_KEY: ${{ vars.DEV_CLERK_PUBLISHABLE_KEY }}
CLERK_SECRET_KEY: ${{ secrets.DEV_CLERK_SECRET_KEY }}
DEPLOY_TAG: shafa-hono-stage-${{ github.event.number }}
DEPLOY_ROUTE: https://shafa-hono-stage-${{ github.event.number }}.radicalplatforms.workers.dev
jobs:
format_checks:
name: Format Checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: hono/package-lock.json
- name: Install Dependencies
run: npm ci
working-directory: hono
- name: Check Prettier
run: npm run check-prettier
working-directory: hono
- name: Check ESLint
run: npm run check-eslint
working-directory: hono
compilation_checks:
name: Compilation Checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: hono/package-lock.json
- name: Install Dependencies
run: npm ci
working-directory: hono
- name: Check TS Compilation
run: npm run check-ts
working-directory: hono
# test_smoke:
# name: Test Smoke
# runs-on: ubuntu-latest
# needs: [format_checks, compilation_checks]
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 18
# cache: 'npm'
# cache-dependency-path: hono/package-lock.json
# - uses: ankane/setup-postgres@v1
# with:
# postgres-version: 16
# - name: Install Dependencies
# run: npm ci
# working-directory: hono
# - name: Run Smoke Tests
# run: npm run test:smoke
# working-directory: hono
# test_matrix:
# name: Test Matrix
# runs-on: ubuntu-latest
# needs: test_smoke
# strategy:
# matrix:
# test: [ unit, integration, preflight ]
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 18
# cache: 'npm'
# cache-dependency-path: hono/package-lock.json
# - uses: ankane/setup-postgres@v1
# with:
# postgres-version: 16
# - name: Install Dependencies
# run: npm ci
# working-directory: hono
# - name: Run Tests
# run: npm run test:${{ matrix.test }}
# working-directory: hono
cf_deploy_hono_stage:
name: Deploy Hono to Stage
runs-on: ubuntu-latest
needs: [format_checks, compilation_checks]
environment:
name: hono-stage-${{ github.event.number }}
url: ${{ env.DEPLOY_ROUTE }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: hono/package-lock.json
- name: Install Dependencies
run: npm ci
working-directory: hono
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Create Neon Branch
uses: neondatabase/create-branch-action@v4
id: create-branch
with:
project_id: ${{ env.NEON_PROJECT_ID }}
branch_name: ${{ env.DEPLOY_TAG }}
database: ${{ env.NEON_DATABASE_NAME }}
username: ${{ env.NEON_DATABASE_USERNAME }}
api_key: ${{ env.NEON_API_TOKEN }}
- name: Run Migrations
env:
DATABASE_URL: ${{ steps.create-branch.outputs.db_url }}?sslmode=require
run: npm run migrate
working-directory: hono
- name: Deploy Hono
uses: cloudflare/wrangler-action@v3
env:
DATABASE_URL: ${{ steps.create-branch.outputs.db_url }}?sslmode=require
with:
apiToken: ${{ env.CF_API_TOKEN }}
command: deploy --name ${{ env.DEPLOY_TAG }}
workingDirectory: hono
packageManager: pnpm
postCommands: |
echo "${{ env.DATABASE_URL }}" | pnpm wrangler secret put DATABASE_URL --name ${{ env.DEPLOY_TAG }}
echo "${{ env.CLERK_PUBLISHABLE_KEY }}" | pnpm wrangler secret put CLERK_PUBLISHABLE_KEY --name ${{ env.DEPLOY_TAG }}
echo "${{ env.CLERK_SECRET_KEY }}" | pnpm wrangler secret put CLERK_SECRET_KEY --name ${{ env.DEPLOY_TAG }}