-
Notifications
You must be signed in to change notification settings - Fork 39
322 lines (277 loc) · 10.4 KB
/
zombie-builder.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
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
#
# Copyright Quadrivium LLC
# All Rights Reserved
# SPDX-License-Identifier: Apache-2.0
#
name: Zombie Builder
on:
# schedule:
# - cron: '0 2 * * 0' # Update zombie builder image each Sunday night
workflow_dispatch:
inputs:
platform:
description: 'Platform selection'
type: choice
options:
- linux/amd64
- linux/arm64
default: linux/amd64
polkadot_builder:
description: 'Build the polkadot builder image'
required: false
default: 'false'
type: 'boolean'
polkadot_builder_tag:
description: 'Custom Polkadot Builder tag'
default: 'latest'
required: false
type: 'string'
polkadot_binaries:
description: 'Build the polkadot binaries'
required: false
default: 'true'
type: 'boolean'
polkadot_sdk_tag:
description: 'Custom Polkadot SDK tag'
required: false
type: 'string'
# zombie_tester_image_rebuild:
# description: 'Rebuild the zombie tester image'
# required: false
# default: false
# type: 'boolean'
# polkadot_sdk_tag:
# description: 'Custom Polkadot SDK tag'
# required: false
# type: 'string'
# zombie_tester_latest_tag:
# description: 'Custom Zombie Tester tag'
# default: 'latest'
# required: false
# type: 'string'
env:
DOCKER_REGISTRY_PATH: ${{ secrets.GCP_REGISTRY }}/${{ secrets.GCP_PROJECT }}/kagome-dev/
GITHUB_HUNTER_USERNAME: ${{ secrets.HUNTER_USERNAME }}
GITHUB_HUNTER_TOKEN: ${{ secrets.HUNTER_TOKEN }}
PLATFORM: ${{ github.event.inputs.platform || 'linux/amd64' }}
POLKADOT_SDK_TAG: ${{ github.event.inputs.polkadot_sdk_tag }}
BUILDER_LATEST_TAG: ${{ github.event.inputs.polkadot_builder_tag || 'latest' }}
TESTER_LATEST_TAG: ${{ github.event.inputs.zombie_tester_latest_tag || 'latest' }}
SCCACHE_GCS_BUCKET: ${{ secrets.SCCACHE_GCS_BUCKET }}
CACHE_VERSION: v001
CACHE_PATHS: ./zombienet/docker/build_docker/cargo
DOCKER_BUILD_DIR_NAME: build_docker_ci
jobs:
build_polkadot_builder:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- platform: linux/amd64
os: ubuntu-24.04
- platform: linux/arm64
os: ubuntu-24.04-arm
timeout-minutes: 60
env:
PLATFORM: ${{ matrix.platform }}
steps:
- name: "Сheck if polkadot_builder is required"
run: |
if [ "${{ github.event.inputs.polkadot_builder }}" != "true" ]; then
echo "Polkadot Builder is not required"
echo "skip=true" >> $GITHUB_ENV
fi
- name: Checkout repository
if: env.skip != 'true'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch master branch
if: env.skip != 'true'
run: git fetch origin master:master
- name : "Authenticate with Google Cloud"
if: env.skip != 'true'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
- name: "Set up Cloud SDK"
if: env.skip != 'true'
uses: 'google-github-actions/setup-gcloud@v2'
- name: "Configure Docker for GCR"
if: env.skip != 'true'
run: |
gcloud auth configure-docker --quiet
gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet
- name: "Check if image tag exists using Makefile"
if: env.skip != 'true'
id: check-tag
working-directory: ./zombienet/docker
run: |
make set_versions
exists=$(make polkadot_builder_check_tag)
echo "Image Exists: $exists"
echo "exists=$exists" >> $GITHUB_ENV
- name: "Build Polkadot Builder"
working-directory: ./zombienet/docker
if: env.exists == 'false' || env.skip != 'true'
run: make polkadot_builder && make polkadot_builder_push
- name: "Versions Info"
if: always() && env.skip != 'true'
working-directory: ./zombienet/docker
run: |
make polkadot_builder_image_info
docker_manifest:
runs-on: ubuntu-24.04
timeout-minutes: 60
needs: [build_polkadot_builder]
steps:
- name: "Сheck if polkadot_builder is required"
run: |
if [ "${{ github.event.inputs.polkadot_builder }}" != "true" ]; then
echo "Polkadot Builder is not required"
echo "skip=true" >> $GITHUB_ENV
fi
- name: Checkout repository
if: env.skip != 'true'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch master branch
if: env.skip != 'true'
run: git fetch origin master:master
- name : "Authenticate with Google Cloud"
if: env.skip != 'true'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
- name: "Set up Cloud SDK"
if: env.skip != 'true'
uses: 'google-github-actions/setup-gcloud@v2'
- name: "Configure Docker for GCR"
if: env.skip != 'true'
run: |
gcloud auth configure-docker --quiet
gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet
- name: "Check if image tag exists using Makefile"
if: env.skip != 'true'
id: check-tag
working-directory: ./zombienet/docker
run: |
make set_versions
exists=$(make polkadot_builder_check_tag)
echo "Image Exists: $exists"
echo "exists=$exists" >> $GITHUB_ENV
- name: "Build Polkadot Builder"
working-directory: ./zombienet/docker
if: env.exists == 'false' || env.skip != 'true'
run: make polkadot_builder_push_manifest
- name: "Versions Info"
if: always() && env.skip != 'true'
working-directory: ./zombienet/docker
run: |
make polkadot_builder_image_info
building_binaries:
if: github.event.inputs.polkadot_binaries == 'true'
runs-on: [ self-hosted, qdrvm-arm64 ]
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# include:
# - platform: linux/amd64
# os: ubuntu-24.04
# - platform: linux/arm64
# os: ubuntu-24.04-arm
needs:
- build_polkadot_builder
- docker_manifest
timeout-minutes: 120
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch master branch
run: git fetch origin master:master
# - uses: actions/cache@v4
# with:
# path: ${{ env.CACHE_PATHS }}
# key: ${{ runner.os }}-rust-${{ env.CACHE_VERSION }}
- name: "Authenticate with Google Cloud"
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
- name: "Set up Cloud SDK"
uses: 'google-github-actions/setup-gcloud@v2'
- name: "Configure Docker for GCR"
run: |
gcloud auth configure-docker --quiet
gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet
- name: "Build target"
working-directory: ./zombienet/docker
run: make polkadot_binary
- name: "Push Polkadot APT Package"
working-directory: ./zombienet/docker
run: make upload_apt_package
- name: "Debian package Info"
if: always()
working-directory: ./zombienet/docker
run: |
make polkadot_deb_package_info
# build_zombie_tester:
# runs-on: ubuntu-latest
# needs: [building_binaries]
# timeout-minutes: 60
# steps:
# - name: "Checkout repository"
# uses: actions/checkout@v4
# - name : "Authenticate with Google Cloud"
# uses: 'google-github-actions/auth@v2'
# with:
# credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
# - name: "Set up Cloud SDK"
# uses: 'google-github-actions/setup-gcloud@v2'
# - name: "Configure Docker for GCR"
# run: |
# gcloud auth configure-docker --quiet
# gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet
# - name: "Get Polkadot and Zombienet versions"
# working-directory: ./zombienet/docker
# run: make get_versions
# - name: "Download Variables Artifact"
# uses: actions/download-artifact@v4
# with:
# name: variables-artifact
# path: .
# - name: "Load Variables"
# id: load-variables
# run: |
# source variables.env
# echo "POLKADOT_BINARY_PACKAGE_VERSION=${POLKADOT_BINARY_PACKAGE_VERSION}" >> $GITHUB_ENV
# - name: "Check if image tag exists"
# id: check-tag
# working-directory: ./zombienet/docker
# run: |
# ZOMBIENET_RELEASE=$(grep 'short_version:' zombienet-versions.txt | cut -d ' ' -f 2)
# POLKADOT_SDK_RELEASE=$(grep 'polkadot_format_version:' polkadot-sdk-versions.txt | cut -d ' ' -f 2)
# ZOMBIE_TESTER_IMAGE=${DOCKER_REGISTRY_PATH}zombie_tester:${POLKADOT_SDK_RELEASE}_${ZOMBIENET_RELEASE}
# TAG_EXISTS=$(docker manifest inspect ${ZOMBIE_TESTER_IMAGE} > /dev/null 2>&1 && echo "true" || echo "false")
# echo "exists=$TAG_EXISTS" >> $GITHUB_ENV
# echo "zombie_tester_image=$ZOMBIE_TESTER_IMAGE" >> $GITHUB_OUTPUT
# - name: "Build Zombie Tester"
# working-directory: ./zombienet/docker
# if: env.exists == 'false' || github.event.inputs.zombie_tester_image_rebuild == 'true'
# run: make zombie_tester \
# DOCKER_REGISTRY_PATH=${DOCKER_REGISTRY_PATH} \
# GOOGLE_APPLICATION_CREDENTIALS=${GOOGLE_APPLICATION_CREDENTIALS} \
# PROJECT_ID=${{ secrets.GCP_PROJECT }} \
# TESTER_LATEST_TAG=${{ env.TESTER_LATEST_TAG }} \
# POLKADOT_BINARY_PACKAGE_VERSION="${POLKADOT_BINARY_PACKAGE_VERSION}"
# - name: "Push Zombie Tester"
# working-directory: ./zombienet/docker
# if: env.exists == 'false' || github.event.inputs.zombie_tester_image_rebuild == 'true'
# run: make zombie_tester_push \
# DOCKER_REGISTRY_PATH=${DOCKER_REGISTRY_PATH} \
# - name: "Versions Info"
# if: always()
# run: |
# echo "Zombie Tester Image: ${{ steps.check-tag.outputs.zombie_tester_image }}"