Skip to content

Commit 8d3718e

Browse files
committed
feature: faster docker builds using blacksmith
1 parent a11b52b commit 8d3718e

1 file changed

Lines changed: 104 additions & 60 deletions

File tree

.github/workflows/integ-tests.yml

Lines changed: 104 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,30 @@ jobs:
2929
- name: Install dependencies
3030
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libclang-dev clang
3131

32-
- name: Build Docker image
33-
run: |
34-
docker build -t thevalut-node:test .
32+
- name: Docker meta
33+
id: meta
34+
uses: docker/metadata-action@v5
35+
with:
36+
images: trieve/threshold
37+
tags: |
38+
type=raw,value=latest
39+
type=ref,event=pr
40+
type=sha
3541
36-
- name: Save Docker image
37-
run: |
38-
docker save thevalut-node:test | gzip > thevalut-node-test.tar.gz
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
3944

40-
- name: Upload Docker image artifact
41-
uses: actions/upload-artifact@v4
45+
- name: Login to Docker Hub
46+
uses: docker/login-action@v3
4247
with:
43-
name: thevalut-node-test-image
44-
path: thevalut-node-test.tar.gz
45-
retention-days: 1
48+
username: ${{ secrets.DOCKER_USERNAME }}
49+
password: ${{ secrets.DOCKER_PASSWORD }}
50+
51+
- name: Build and push Docker image
52+
uses: useblacksmith/build-push-action@v1
53+
with:
54+
push: true
55+
tags: ${{ steps.meta.outputs.tags }}
4656

4757
dkg_test-12:
4858
runs-on: blacksmith-16vcpu-ubuntu-2204
@@ -69,15 +79,19 @@ jobs:
6979
rustup update 1.87
7080
rustup default 1.87
7181
72-
- name: Download Docker image artifact
73-
uses: actions/download-artifact@v4
82+
- name: Login to Docker Hub
83+
uses: docker/login-action@v3
7484
with:
75-
name: thevalut-node-test-image
76-
path: .
85+
username: ${{ secrets.DOCKER_USERNAME }}
86+
password: ${{ secrets.DOCKER_PASSWORD }}
7787

78-
- name: Load Docker image
88+
- name: Pull Docker image
7989
run: |
80-
gunzip -c thevalut-node-test.tar.gz | docker load
90+
if [ "${{ github.event_name }}" = "pull_request" ]; then
91+
docker pull "trieve/threshold:pr-${{ github.event.pull_request.number }}"
92+
else
93+
docker pull trieve/threshold:latest
94+
fi
8195
8296
- name: Install dependencies
8397
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libclang-dev clang
@@ -137,15 +151,19 @@ jobs:
137151
rustup update 1.87
138152
rustup default 1.87
139153
140-
- name: Download Docker image artifact
141-
uses: actions/download-artifact@v4
154+
- name: Login to Docker Hub
155+
uses: docker/login-action@v3
142156
with:
143-
name: thevalut-node-test-image
144-
path: .
157+
username: ${{ secrets.DOCKER_USERNAME }}
158+
password: ${{ secrets.DOCKER_PASSWORD }}
145159

146-
- name: Load Docker image
160+
- name: Pull Docker image
147161
run: |
148-
gunzip -c thevalut-node-test.tar.gz | docker load
162+
if [ "${{ github.event_name }}" = "pull_request" ]; then
163+
docker pull "trieve/threshold:pr-${{ github.event.pull_request.number }}"
164+
else
165+
docker pull trieve/threshold:latest
166+
fi
149167
150168
- name: Install dependencies
151169
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libclang-dev clang
@@ -197,15 +215,19 @@ jobs:
197215
rustup update 1.87
198216
rustup default 1.87
199217
200-
- name: Download Docker image artifact
201-
uses: actions/download-artifact@v4
218+
- name: Login to Docker Hub
219+
uses: docker/login-action@v3
202220
with:
203-
name: thevalut-node-test-image
204-
path: .
221+
username: ${{ secrets.DOCKER_USERNAME }}
222+
password: ${{ secrets.DOCKER_PASSWORD }}
205223

206-
- name: Load Docker image
224+
- name: Pull Docker image
207225
run: |
208-
gunzip -c thevalut-node-test.tar.gz | docker load
226+
if [ "${{ github.event_name }}" = "pull_request" ]; then
227+
docker pull "trieve/threshold:pr-${{ github.event.pull_request.number }}"
228+
else
229+
docker pull trieve/threshold:latest
230+
fi
209231
210232
- name: Clean cargo
211233
run: cargo clean
@@ -262,19 +284,26 @@ jobs:
262284
rustup update 1.87
263285
rustup default 1.87
264286
265-
- name: Download Docker image artifact
266-
uses: actions/download-artifact@v4
287+
- name: Login to Docker Hub
288+
uses: docker/login-action@v3
267289
with:
268-
name: thevalut-node-test-image
269-
path: .
290+
username: ${{ secrets.DOCKER_USERNAME }}
291+
password: ${{ secrets.DOCKER_PASSWORD }}
292+
293+
- name: Pull Docker image
294+
run: |
295+
if [ "${{ github.event_name }}" = "pull_request" ]; then
296+
docker pull "trieve/threshold:pr-${{ github.event.pull_request.number }}"
297+
else
298+
docker pull trieve/threshold:latest
299+
fi
300+
301+
- name: Clean cargo
302+
run: cargo clean
270303

271304
- name: Install dependencies
272305
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libclang-dev clang
273306

274-
- name: Load Docker image
275-
run: |
276-
gunzip -c thevalut-node-test.tar.gz | docker load
277-
278307
- name: Create NodeCluster (3 nodes)
279308
run: ./scripts/clear_dkg_keys.sh
280309

@@ -327,19 +356,23 @@ jobs:
327356
rustup update 1.87
328357
rustup default 1.87
329358
330-
- name: Download Docker image artifact
331-
uses: actions/download-artifact@v4
359+
- name: Login to Docker Hub
360+
uses: docker/login-action@v3
332361
with:
333-
name: thevalut-node-test-image
334-
path: .
362+
username: ${{ secrets.DOCKER_USERNAME }}
363+
password: ${{ secrets.DOCKER_PASSWORD }}
364+
365+
- name: Pull Docker image
366+
run: |
367+
if [ "${{ github.event_name }}" = "pull_request" ]; then
368+
docker pull "trieve/threshold:pr-${{ github.event.pull_request.number }}"
369+
else
370+
docker pull trieve/threshold:latest
371+
fi
335372
336373
- name: Install dependencies
337374
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libclang-dev clang
338375

339-
- name: Load Docker image
340-
run: |
341-
gunzip -c thevalut-node-test.tar.gz | docker load
342-
343376
- name: Create NodeCluster (3 nodes)
344377
run: ./scripts/clear_dkg_keys.sh
345378

@@ -392,22 +425,29 @@ jobs:
392425
rustup update 1.87
393426
rustup default 1.87
394427
395-
- name: Download Docker image artifact
396-
uses: actions/download-artifact@v4
428+
- name: Login to Docker Hub
429+
uses: docker/login-action@v3
397430
with:
398-
name: thevalut-node-test-image
399-
path: .
431+
username: ${{ secrets.DOCKER_USERNAME }}
432+
password: ${{ secrets.DOCKER_PASSWORD }}
400433

401-
- name: Load Docker image
434+
- name: Pull Docker image
402435
run: |
403-
gunzip -c thevalut-node-test.tar.gz | docker load
436+
if [ "${{ github.event_name }}" = "pull_request" ]; then
437+
docker pull "trieve/threshold:pr-${{ github.event.pull_request.number }}"
438+
else
439+
docker pull trieve/threshold:latest
440+
fi
404441
405442
- name: Clean cargo
406443
run: cargo clean
407444

408445
- name: Install dependencies
409446
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libclang-dev clang
410447

448+
- name: Create NodeCluster (3 nodes)
449+
run: ./scripts/clear_dkg_keys.sh
450+
411451
- name: Start 5-node stack with network chaos
412452
run: |
413453
docker compose -f docker-compose.yaml -f docker-compose.chaos-network.yaml up -d
@@ -457,22 +497,26 @@ jobs:
457497
rustup update 1.87
458498
rustup default 1.87
459499
460-
- name: Download Docker image artifact
461-
uses: actions/download-artifact@v4
500+
- name: Login to Docker Hub
501+
uses: docker/login-action@v3
462502
with:
463-
name: thevalut-node-test-image
464-
path: .
503+
username: ${{ secrets.DOCKER_USERNAME }}
504+
password: ${{ secrets.DOCKER_PASSWORD }}
465505

466-
- name: Load Docker image
506+
- name: Pull Docker image
467507
run: |
468-
gunzip -c thevalut-node-test.tar.gz | docker load
469-
470-
- name: Clean cargo
471-
run: cargo clean
508+
if [ "${{ github.event_name }}" = "pull_request" ]; then
509+
docker pull "trieve/threshold:pr-${{ github.event.pull_request.number }}"
510+
else
511+
docker pull trieve/threshold:latest
512+
fi
472513
473514
- name: Install dependencies
474515
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libclang-dev clang
475516

517+
- name: Create NodeCluster (3 nodes)
518+
run: ./scripts/clear_dkg_keys.sh
519+
476520
- name: Start 5-node stack with node chaos
477521
run: |
478522
docker compose -f docker-compose.yaml -f docker-compose.chaos-nodes.yaml up -d

0 commit comments

Comments
 (0)