-
-
Notifications
You must be signed in to change notification settings - Fork 57
180 lines (139 loc) · 4.35 KB
/
main-ci.yml
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
name: Main CI
on:
push:
branches:
- main
env:
# This enabled remote task caching using Turborepo
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
# Neon
NEON_DATABASE_USERNAME: ${{ secrets.NEON_DATABASE_USERNAME }}
NEON_API_KEY: ${{ secrets.NEON_API_KEY }}
NEON_PROJECT_ID: ${{ secrets.NEON_PROJECT_ID }}
# Authentication
AUTH_GITHUB_ID: ${{ secrets.AUTH_GITHUB_ID }}
AUTH_GITHUB_SECRET: ${{ secrets.AUTH_GITHUB_SECRET }}
AUTH_GOOGLE_ID: ${{ secrets.AUTH_GOOGLE_ID }}
AUTH_GOOGLE_SECRET: ${{ secrets.AUTH_GOOGLE_SECRET }}
AUTH_GOOGLE_CODE_VERIFIER: ${{ secrets.AUTH_GOOGLE_CODE_VERIFIER }}
# Uploadthing
UPLOADTHING_SECRET: ${{ secrets.UPLOADTHING_SECRET }}
UPLOADTHING_APP_ID: ${{ secrets.UPLOADTHING_APP_ID }}
# Unkey
UNKEY_ROOT_KEY: ${{ secrets.UNKEY_ROOT_KEY }}
jobs:
format-lint-typecheck:
name: Format, Lint & Typecheck
runs-on: ubuntu-latest
environment: Production
env:
# We don't need to validate the environment variables when we are checking the format, linting and typechecking
SKIP_ENV_VALIDATION: true
# Database URL
DATABASE_URL: ${{ secrets.DATABASE_URL }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup
uses: ./.github/actions/setup
- name: Format check
run: bun format:check
- name: Spell check
run: bun lint:spell
- name: Lint markdown
run: bun lint:md
- name: Lint & Typecheck
run: bun turbo lint typecheck
build-marketing:
name: Build marketing website
runs-on: ubuntu-latest
needs: format-lint-typecheck
environment: Production
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup
uses: ./.github/actions/setup
- name: Build marketing website
run: bun turbo build --filter=@orbitkit/marketing
build-app:
name: Build web app
runs-on: ubuntu-latest
needs: format-lint-typecheck
environment: Production
env:
# Database URL
DATABASE_URL: ${{ secrets.DATABASE_URL }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup
uses: ./.github/actions/setup
- name: Build
run: bun turbo build --filter=@orbitkit/web
e2e-web:
name: E2E Web App
runs-on: ubuntu-latest
needs: format-lint-typecheck
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup
uses: ./.github/actions/setup
- name: Create Neon Branch
id: create-branch
uses: neondatabase/create-branch-action@v4
with:
project_id: ${{ env.NEON_PROJECT_ID }}
branch_name: web/e2e-main-${{ github.sha }}
username: ${{ env.NEON_DATABASE_USERNAME }}
api_key: ${{ env.NEON_API_KEY }}
- name: Set DATABASE_URL
shell: bash
run: |
echo "DATABASE_URL=${{ steps.create-branch.outputs.db_url }}?sslmode=require" >> $GITHUB_ENV
- name: Install Playwright Browsers
run: bun playwright install --with-deps
- name: Run Playwright tests
run: bun turbo test:e2e --filter=@orbitkit/web
- uses: actions/upload-artifact@v4
if: always()
with:
name: web-playwright-report
path: apps/web/playwright-report/
retention-days: 30
e2e-marketing:
name: E2E Marketing App
runs-on: ubuntu-latest
needs: format-lint-typecheck
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup
uses: ./.github/actions/setup
- name: Install Playwright Browsers
run: bun playwright install --with-deps
- name: Run Playwright tests
run: bun turbo test:e2e --filter=@orbitkit/marketing
- uses: actions/upload-artifact@v4
if: always()
with:
name: marketing-playwright-report
path: apps/marketing/playwright-report/
retention-days: 30
delete-e2e-db-branch:
runs-on: ubuntu-latest
needs: e2e-web
steps:
- name: Delete Neon Branch
uses: neondatabase/delete-branch-action@v3
with:
project_id: ${{ secrets.NEON_PROJECT_ID }}
branch: web/e2e-main-${{ github.sha }}
api_key: ${{ secrets.NEON_API_KEY }}