-
Notifications
You must be signed in to change notification settings - Fork 3
193 lines (158 loc) · 5.24 KB
/
build.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
181
182
183
184
185
186
187
188
189
190
191
192
193
name: ci
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GCP_SERVICE_NAME: vanguard
on:
push:
branches:
- main
pull_request:
jobs:
lint:
name: ⬣ Lint
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
- name: Checkout repo
uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install deps
run: pnpm install
- name: Lint
run: npm run lint
test:
name: ⚡ Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
- name: Checkout repo
uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install deps
run: pnpm install
- name: Setup env
run: npm run db:migrate:test
- name: Run vitest
run: npm run test:ci
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: "**/junit.xml"
- uses: codecov/codecov-action@v3
name: Publish Codecov Report
if: always() # always run even if the previous step fails
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/coverage-final.json
# directory: coverage
fail_ci_if_error: true
verbose: true
# build:
# name: 🐳 Build
# # only on main
# if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
# runs-on: ubuntu-latest
# steps:
# - name: 🛑 Cancel Previous Runs
# uses: styfle/[email protected]
# - name: ⬇️ Checkout repo
# uses: actions/checkout@v3
# - name: ⎔ Setup node
# uses: actions/setup-node@v3
# with:
# node-version: 16
# - name: 📥 Download deps
# uses: bahmutov/npm-install@v1
# - name: ⚡️ Build Remix
# run: |
# npm run build
# - name: Archive Production Artifact
# uses: actions/upload-artifact@v3
# with:
# name: build
# path: build
# TODO(dcramer): we'd like to bring build visibility into GH, but its tricky to get right + secure secrets
# gcp_build:
# name: "🐳 Build"
# # only on main
# if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
# runs-on: ubuntu-latest
# steps:
# - name: 🛑 Cancel Previous Runs
# uses: styfle/[email protected]
# - name: ⬇️ Checkout repo
# uses: actions/checkout@v3
# - id: "auth"
# uses: "google-github-actions/auth@v0"
# with:
# credentials_json: "${{ secrets.GCP_SA_KEY }}"
# # with:
# # workload_identity_provider: "projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider"
# # service_account: "[email protected]"
# # Setup gcloud CLI
# - name: Set up Cloud SDK
# uses: google-github-actions/setup-gcloud@v0
# with:
# install_components: "beta"
# # Build and push image to Google Container Registry
# - id: "build"
# name: Trigger Cloud Build
# run: |-
# gcloud beta builds triggers run ${{ secrets.GCP_TRIGGER_ID }} --quiet
# gcp_deploy:
# name: Deploy
# # only on main
# if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
# runs-on: ubuntu-latest
# needs: [gcp_build, vitest, lint]
# permissions:
# contents: "read"
# id-token: "write"
# steps:
# - name: 🛑 Cancel Previous Runs
# uses: styfle/[email protected]
# - name: ⬇️ Checkout repo
# uses: actions/checkout@v3
# - id: "auth"
# uses: "google-github-actions/auth@v0"
# with:
# credentials_json: "${{ secrets.GCP_SA_KEY }}"
# # with:
# # workload_identity_provider: "projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider"
# # service_account: "[email protected]"
# # Activate image on GCR
# - id: "deploy"
# uses: "google-github-actions/deploy-cloudrun@v0"
# with:
# service: "${{ env.GCP_SERVICE_NAME }}"
# image: "us.gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.GCP_SERVICE_NAME }}:${{ env.GITHUB_SHA }}"
# - name: "Use output"
# run: 'curl "${{ steps.deploy.outputs.url }}"'