forked from lakekeeper/lakekeeper
-
Notifications
You must be signed in to change notification settings - Fork 0
247 lines (213 loc) · 7.11 KB
/
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
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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
CARGO_TERM_COLOR: always
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
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:
- run: sudo snap install --edge --classic just
- uses: actions/checkout@v4
- name: Cargo format
run: just check-format
- name: Check diff
run: git diff --exit-code
docker:
runs-on: ubuntu-24.04
services:
postgres:
image: postgres:15
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:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# - name: Set up Buildx
# uses: docker/setup-buildx-action@v3
# with:
# version: v0.13.1
- name: Docker info
run: docker info
- name: Build Docker image (amd64)
run: |
DOCKER_BUILDKIT=1 docker build -t localhost/iceberg-rest-local:amd64 \
-f docker/full.Dockerfile \
--add-host=host.docker.internal:host-gateway \
--build-arg DATABASE_URL=postgres://postgres:postgres@host.docker.internal:5432/postgres .
docker save -o /tmp/iceberg-rest-server-amd64.tar localhost/iceberg-rest-local:amd64
# This is currently very slow. Switch to ARM workers once they are finally available
# in gh actions!
# - name: Build Docker image (arm64)
# run: |
# DOCKER_BUILDKIT=1 docker build \
# --platform linux/arm64 -t iceberg-rest-local:arm64 \
# --add-host=host.docker.internal:host-gateway \
# -f docker/full.Dockerfile \
# --build-arg DATABASE_URL=postgres://postgres:postgres@host.docker.internal:5432/postgres .
# docker save -o /tmp/iceberg-rest-server-arm64.tar iceberg-rest-local:arm64
# ToDo: Use action instead of manual build.
# The snippet below couldn't resolve the host.docker.internal / host-gateway.
# - name: Build Docker image (amd64)
# uses: docker/build-push-action@v5
# id: build-amd64
# with:
# context: .
# load: true
# platforms: linux/amd64
# file: docker/full.Dockerfile
# outputs: type=docker,dest=/tmp/iceberg-rest-server-amd64.tar
# # cache-from: type=gha
# # cache-to: type=gha,mode=max
# add-hosts: "host.docker.internal:host-gateway"
# build-args: |
# "DATABASE_URL=postgres://postgres:postgres@host.docker.internal:5432/postgres"
# tags: iceberg-rest-local:amd64
- name: Save Docker
uses: actions/upload-artifact@v4
with:
name: iceberg-rest-server-image
path: /tmp/*.tar
clippy:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
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:
- run: sudo snap install --edge --classic just
- uses: actions/checkout@v4
- name: Migrate database
run: |
sudo apt-get install libpq-dev -y
cargo install --version=0.7.4 sqlx-cli --no-default-features --features postgres
cd crates/iceberg-rest-server
sqlx database create
sqlx migrate run
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
- name: Cargo clippy
run: just check-clippy
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
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:
- uses: actions/checkout@v4
- name: Migrate database
run: |
sudo apt-get install libpq-dev -y
cargo install --version=0.7.4 sqlx-cli --no-default-features --features postgres
cd crates/iceberg-rest-server
sqlx database create
sqlx migrate run
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
- name: Test
run: cargo test --no-fail-fast --all-targets --all-features --workspace
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
- name: Doc Test
run: cargo test --no-fail-fast --doc --all-features --workspace
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
test-pyiceberg:
needs: docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Restore binary
uses: actions/download-artifact@v4
with:
name: iceberg-rest-server-image
path: artifacts
- name: Display structure of downloaded files
run: ls -Rlh artifacts
- name: Restore Docker image
run: |
docker load -i artifacts/iceberg-rest-server-amd64.tar
- name: Test Pyiceberg
run: |
cd tests &&
docker compose run spark /opt/entrypoint.sh bash -c "cd /opt/tests && bash run_pyiceberg.sh"
env:
ICEBERG_REST_TEST_SPARK_IMAGE: apache/spark:3.5.1-java17-python3
ICEBERG_REST_TEST_SERVER_IMAGE: localhost/iceberg-rest-local:amd64
test-pyspark:
needs: docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Restore binary
uses: actions/download-artifact@v4
with:
name: iceberg-rest-server-image
path: artifacts
- name: Display structure of downloaded files
run: ls -Rlh artifacts
- name: Restore Docker image
run: |
docker load -i artifacts/iceberg-rest-server-amd64.tar
- name: Test Pyspark
run: |
cd tests &&
docker compose run spark /opt/entrypoint.sh bash -c "cd /opt/tests && bash run_spark.sh"
env:
ICEBERG_REST_TEST_SPARK_IMAGE: apache/spark:3.5.1-java17-python3
ICEBERG_REST_TEST_SERVER_IMAGE: localhost/iceberg-rest-local:amd64