-
Notifications
You must be signed in to change notification settings - Fork 78
273 lines (263 loc) · 9 KB
/
ci.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
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
name: CI
on:
workflow_dispatch:
push:
paths:
- 'columnar/**'
- 'third-party/**'
- 'files/**'
- 'acceptance/**'
- docker-bake.hcl
- Dockerfile
- Makefile
- VERSION
- HYDRA_PROD_VER
- .github/workflows/ci.yaml
env:
POSTGRES_REPO: ghcr.io/hydradatabase/hydra
SPILO_REPO: 011789831835.dkr.ecr.us-east-1.amazonaws.com/spilo
TEST_ARTIFACT_DIR: /tmp/test_artifacts
jobs:
lint_go:
name: Lint acceptance
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: acceptance/go.mod
cache-dependency-path: acceptance/go.sum
check-latest: true
cache: true
- name: Lint
run: make lint_acceptance
validate_columnar:
name: Validate Columnar ${{ matrix.postgres }}
strategy:
fail-fast: false
matrix:
postgres: ["13", "14", "15"]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Depot
uses: depot/setup-action@v1
with:
version: latest
- name: Bake Columnar validation
uses: depot/bake-action@v1
with:
token: ${{ secrets.DEPOT_TOKEN }}
project: ${{ secrets.DEPOT_PROJECT }}
pull: true
targets: ${{ format('columnar_{0}', matrix.postgres) }}
set: |
*.platform=linux/amd64
columnar.target=checker
build_validate_postgres:
name: Build and Validate Postgres ${{ matrix.postgres }}
needs: [validate_columnar]
strategy:
fail-fast: false
matrix:
postgres: ["13", "14", "15"]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: setup POSTGRES_IMAGE env
run: echo "POSTGRES_IMAGE=${{ format('{0}:{1}-{2}', env.POSTGRES_REPO, matrix.postgres, github.sha) }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Set up Depot
uses: depot/setup-action@v1
- name: Bake and load amd64 Postgres image
uses: depot/bake-action@v1
env:
POSTGRES_BASE_VERSION: ${{ matrix.postgres }}
with:
token: ${{ secrets.DEPOT_TOKEN }}
project: ${{ secrets.DEPOT_PROJECT }}
load: true
pull: true
targets: postgres
set: |
*.platform=linux/amd64
postgres.tags=${{ env.POSTGRES_IMAGE }}
- uses: actions/setup-go@v3
with:
go-version-file: acceptance/go.mod
cache-dependency-path: acceptance/go.sum
cache: true
- name: Run Acceptance Tests
env:
POSTGRES_UPGRADE_FROM_IMAGE: ${{ format('{0}:{1}', env.POSTGRES_REPO, matrix.postgres) }}
POSTGRES_BASE_VERSION: ${{ matrix.postgres }}
TEST_AWS_ACCESS_KEY_ID: ${{ secrets.TEST_FIXTURE_AWS_ACCESS_KEY_ID }}
TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_FIXTURE_AWS_SECRET_ACCESS_KEY }}
TEST_AWS_REGION: us-east-1
TEST_AWS_S3_BUCKET: hydra-test-fixtures
run: make postgres_pull_upgrade_image postgres_acceptance_test
- name: Upload test container logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: postgres_${{ matrix.postgres }}_container_logs
path: ${{ env.TEST_ARTIFACT_DIR }}
retention-days: 7
- name: Bake multi-platform Postgres
if: github.ref == 'refs/heads/main'
uses: depot/bake-action@v1
with:
token: ${{ secrets.DEPOT_TOKEN }}
project: ${{ secrets.DEPOT_PROJECT }}
pull: true
targets: postgres
build_validate_spilo:
name: Build and Validate Spilo
needs: [validate_columnar]
if: github.repository == 'hydradatabase/hydra-internal'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: setup SPILO_IMAGE
run: echo "SPILO_IMAGE=${{ format('{0}:{1}', env.SPILO_REPO, github.sha) }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Set up Depot
uses: depot/setup-action@v1
- name: Bake and load amd64 spilo image
uses: depot/bake-action@v1
with:
token: ${{ secrets.DEPOT_TOKEN }}
project: ${{ secrets.DEPOT_PROJECT }}
load: true
pull: true
targets: spilo
set: |
*.platform=linux/amd64
spilo.tags=${{ env.SPILO_IMAGE }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: us-east-1
mask-aws-account-id: no
- name: Login to Amazon ECR
id: spilo-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
registries: "011789831835"
- uses: actions/setup-go@v3
with:
go-version-file: acceptance/go.mod
cache-dependency-path: acceptance/go.sum
cache: true
- name: Run Acceptance Tests for Postgres 13
env:
SPILO_POSTGRES_VERSION: "13"
TEST_AWS_ACCESS_KEY_ID: ${{ secrets.TEST_FIXTURE_AWS_ACCESS_KEY_ID }}
TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_FIXTURE_AWS_SECRET_ACCESS_KEY }}
TEST_AWS_REGION: us-east-1
TEST_AWS_S3_BUCKET: hydra-test-fixtures
run: make spilo_pull_upgrade_image spilo_acceptance_test
- name: Run Acceptance Tests for Postgres 14
env:
SPILO_POSTGRES_VERSION: "14"
TEST_AWS_ACCESS_KEY_ID: ${{ secrets.TEST_FIXTURE_AWS_ACCESS_KEY_ID }}
TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_FIXTURE_AWS_SECRET_ACCESS_KEY }}
TEST_AWS_REGION: us-east-1
TEST_AWS_S3_BUCKET: hydra-test-fixtures
run: make spilo_acceptance_test
- name: Upload test container logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: spilo_container_logs
path: ${{ env.TEST_ARTIFACT_DIR }}
retention-days: 7
- name: Bake amd64 spilo
if: github.ref == 'refs/heads/main'
uses: depot/bake-action@v1
with:
token: ${{ secrets.DEPOT_TOKEN }}
project: ${{ secrets.DEPOT_PROJECT }}
pull: true
targets: spilo
set: |
*.platform=linux/amd64
push_postgres:
name: Push Postgres ${{ matrix.postgres }}
needs: [build_validate_postgres]
if: github.repository == 'hydradatabase/hydra' && github.ref == 'refs/heads/main'
strategy:
fail-fast: false
matrix:
postgres: ["13", "14", "15"]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Depot
uses: depot/setup-action@v1
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Bake and push Postgres
uses: depot/bake-action@v1
env:
POSTGRES_BASE_VERSION: ${{ matrix.postgres }}
with:
token: ${{ secrets.DEPOT_TOKEN }}
project: ${{ secrets.DEPOT_PROJECT }}
push: true
targets: postgres
set: |
postgres.tags=${{ env.POSTGRES_REPO }}:${{ matrix.postgres }}
postgres.tags=${{ env.POSTGRES_REPO }}:${{ matrix.postgres }}-${{ github.sha }}
${{ matrix.postgres == '14' && format('postgres.tags={0}:latest', env.POSTGRES_REPO) || '' }}
push_spilo:
name: Push Spilo
needs: [build_validate_spilo]
if: github.repository == 'hydradatabase/hydra-internal' && github.ref == 'refs/heads/main'
uses: ./.github/workflows/build_spilo.yaml
with:
production: true
spilo_repo: 011789831835.dkr.ecr.us-east-1.amazonaws.com/spilo # env vars can't be used here
secrets: inherit
benchmark_postgres:
name: Benchmark Hydra Postgres image (${{ matrix.benchmark }})
needs: [push_postgres]
if: github.repository == 'hydradatabase/hydra' && github.ref == 'refs/heads/main'
strategy:
fail-fast: false
matrix:
benchmark: ["clickbench-100M", "warehouse-10G"]
uses: ./.github/workflows/benchmark.yaml
with:
benchmark: ${{ matrix.benchmark }}
repo: ghcr.io/hydradatabase/hydra
tag: 14-${{ github.sha }}
secrets: inherit
benchmark_spilo:
name: Benchmark Hydra Spilo image (${{ matrix.benchmark }})
needs: [push_spilo]
if: github.repository == 'hydradatabase/hydra-internal' && github.ref == 'refs/heads/main'
strategy:
fail-fast: false
matrix:
benchmark: ["clickbench-100M", "warehouse-10G"]
uses: ./.github/workflows/benchmark.yaml
with:
benchmark: ${{ matrix.benchmark }}
repo: 011789831835.dkr.ecr.us-east-1.amazonaws.com/spilo
tag: ${{ github.sha }}
secrets: inherit