Repository navigation
211 lines (186 loc) · 7.52 KB
/
Copy pathdocker-build-check.yml
File metadata and controls
211 lines (186 loc) · 7.52 KB
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
# SPDX-FileCopyrightText: © 2025 Phala Network <dstack@phala.network>
#
# SPDX-License-Identifier: Apache-2.0
name: Docker Build Check
# Not a required status check, so a workflow-level filter is safe here: a pull
# request that skips it is not left waiting on a check that never arrives. What
# it verifies -- that the builder images still build and that their pinned
# package lists still match -- cannot change unless something under `dstack/`
# does.
on:
push:
branches: [ next, 'release/**' ]
paths:
- 'dstack/**'
- 'rust-toolchain.toml'
- '.github/workflows/docker-build-check.yml'
- '.github/workflows/kms-release.yml'
- '.github/workflows/gateway-release.yml'
- '.github/workflows/verifier-release.yml'
pull_request:
branches: [ next, 'release/**' ]
paths:
- 'dstack/**'
- 'rust-toolchain.toml'
- '.github/workflows/docker-build-check.yml'
- '.github/workflows/kms-release.yml'
- '.github/workflows/gateway-release.yml'
- '.github/workflows/verifier-release.yml'
env:
DSTACK_REV: ${{ github.event.pull_request.head.sha || github.sha }}
DSTACK_SRC_URL: ${{ github.event.pull_request.head.repo.clone_url || format('{0}/{1}', github.server_url, github.repository) }}
# Builds go through the `docker` driver, i.e. the daemon's own BuildKit, rather
# than the `docker-container` builder setup-buildx creates by default. With a
# container builder every `--load` compresses the result into a tarball and
# imports it into the daemon; for the `*-builder` targets, which carry the Rust
# toolchain and the cargo target directory, that alone was two to three
# minutes. With the daemon's builder the image lands in the store directly, and
# the second build of the `*-builder` target is a cache hit on the first.
#
# No BuildKit layer cache (`cache-to: type=gha`). The source is cloned at
# DSTACK_REV inside the build, so the cargo layer misses on every commit, and
# `mode=max` still exported the whole builder stage to the Actions cache: about
# two and a half minutes per job, and most of the repository's 10 GB cache
# quota, which evicted the cargo caches the other workflows depend on. What it
# could have saved was the pinned-package install, roughly fifteen seconds.
jobs:
build-script-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Test release build orchestration
run: python3 -m unittest discover -s dstack/build/shared/tests -v
gateway:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
- name: Build Gateway Docker image
uses: docker/build-push-action@v5
with:
context: dstack/gateway/dstack-app/builder
push: false
load: true
tags: dstack-gateway-check:latest
provenance: false
build-contexts: |
build-shared=dstack/build/shared
build-args: |
DSTACK_REV=${{ env.DSTACK_REV }}
DSTACK_SRC_URL=${{ env.DSTACK_SRC_URL }}
- name: Verify pinned packages
run: |
dstack/build/shared/verify-pinned-packages.sh dstack-gateway-check:latest \
dstack/gateway/dstack-app/builder/shared/pinned-packages.txt
- name: Build gateway-builder target
run: |
docker buildx build \
--load \
--target gateway-builder \
--tag gateway-builder-check:latest \
--provenance=false \
--build-context build-shared=dstack/build/shared \
--build-arg "DSTACK_REV=${DSTACK_REV}" \
--build-arg "DSTACK_SRC_URL=${DSTACK_SRC_URL}" \
dstack/gateway/dstack-app/builder
- name: Verify builder pinned packages
run: |
dstack/build/shared/verify-pinned-packages.sh gateway-builder-check:latest \
dstack/gateway/dstack-app/builder/shared/builder-pinned-packages.txt
kms:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Checkout KMS contract dependencies
run: |
git submodule update --init --recursive --depth 1 -- \
dstack/kms/auth-eth/lib/forge-std \
dstack/kms/auth-eth/lib/openzeppelin-contracts-upgradeable \
dstack/kms/auth-eth/lib/openzeppelin-foundry-upgrades
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
- name: Build KMS Docker image
uses: docker/build-push-action@v5
with:
context: dstack/kms/dstack-app/builder
push: false
load: true
tags: dstack-kms-check:latest
provenance: false
build-contexts: |
build-shared=dstack/build/shared
build-args: |
DSTACK_REV=${{ env.DSTACK_REV }}
DSTACK_SRC_URL=${{ env.DSTACK_SRC_URL }}
- name: Verify pinned packages
run: |
dstack/build/shared/verify-pinned-packages.sh dstack-kms-check:latest \
dstack/kms/dstack-app/builder/shared/pinned-packages.txt
- name: Build kms-builder target
run: |
docker buildx build \
--load \
--target kms-builder \
--tag kms-builder-check:latest \
--provenance=false \
--build-context build-shared=dstack/build/shared \
--build-arg "DSTACK_REV=${DSTACK_REV}" \
--build-arg "DSTACK_SRC_URL=${DSTACK_SRC_URL}" \
dstack/kms/dstack-app/builder
- name: Verify builder pinned packages
run: |
dstack/build/shared/verify-pinned-packages.sh kms-builder-check:latest \
dstack/kms/dstack-app/builder/shared/builder-pinned-packages.txt
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Build KMS contracts
run: |
cd dstack/kms/auth-eth
forge build
verifier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
- name: Build Verifier Docker image
uses: docker/build-push-action@v5
with:
context: dstack/verifier
file: dstack/verifier/builder/Dockerfile
push: false
load: true
tags: dstack-verifier-check:latest
provenance: false
build-contexts: |
build-shared=dstack/build/shared
build-args: |
DSTACK_REV=${{ env.DSTACK_REV }}
DSTACK_SRC_URL=${{ env.DSTACK_SRC_URL }}
- name: Verify pinned packages (runtime)
run: |
dstack/build/shared/verify-pinned-packages.sh dstack-verifier-check:latest \
dstack/verifier/builder/shared/pinned-packages.txt
- name: Build verifier-builder target
run: |
docker buildx build \
--load \
--target verifier-builder \
--tag verifier-builder-check:latest \
--provenance=false \
--file dstack/verifier/builder/Dockerfile \
--build-context build-shared=dstack/build/shared \
--build-arg "DSTACK_REV=${DSTACK_REV}" \
--build-arg "DSTACK_SRC_URL=${DSTACK_SRC_URL}" \
dstack/verifier
- name: Verify builder pinned packages
run: |
dstack/build/shared/verify-pinned-packages.sh verifier-builder-check:latest \
dstack/verifier/builder/shared/builder-pinned-packages.txt