-
Notifications
You must be signed in to change notification settings - Fork 34
284 lines (251 loc) · 10.8 KB
/
zombie-tests.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
274
275
276
277
278
279
280
281
282
283
284
#
# Copyright Quadrivium LLC
# All Rights Reserved
# SPDX-License-Identifier: Apache-2.0
#
name: Zombie-Tests
on:
workflow_dispatch:
inputs:
build_type:
description: 'Build type'
required: true
default: 'Release'
type: 'choice'
options:
- Release
- Debug
- RelWithDebInfo
werror:
description: 'Enable -Werror'
required: true
default: 'OFF'
type: 'choice'
options:
- 'ON'
- 'OFF'
use_cache:
description: 'Use cache for build'
required: true
default: 'true'
type: 'choice'
options:
- 'true'
- 'false'
builder_latest_tag:
description: 'Custom Builder tag'
default: 'latest'
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/
PROJECT_ID: ${{ secrets.GCP_PROJECT }}
BUILD_DIR: build
CTEST_OUTPUT_ON_FAILURE: 1
CI: true
CACHE_VERSION: v01
CACHE_PATH: ./build/cache
USE_CACHE: ${{ github.event.inputs.use_cache || 'true' }}
BUILDER_LATEST_TAG: ${{ github.event.inputs.builder_latest_tag || 'latest' }}
TESTER_LATEST_TAG: ${{ github.event.inputs.zombie_tester_latest_tag || 'latest' }}
jobs:
kagome_dev_docker_build:
runs-on: [ actions-runner-controller ]
timeout-minutes: 180
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Get master branch"
if: github.ref != 'refs/heads/master'
run: git fetch origin master:master || true
- 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 commit version"
working-directory: ./housekeeping/docker/kagome-dev
run: make get_versions
- name: "Check package version"
working-directory: ./housekeeping/docker/kagome-dev
run: |
ARTIFACTS_REPO=$(grep '^ARTIFACTS_REPO ?=' Makefile | sed 's/ARTIFACTS_REPO ?= //')
REGION=$(grep '^REGION ?=' Makefile | sed 's/REGION ?= //')
SHORT_COMMIT_HASH=$(grep 'short_commit_hash:' commit_hash.txt | cut -d ' ' -f 2)
PACKAGE_VERSION="$(date +'%y.%m.%d')-${SHORT_COMMIT_HASH}-${{ github.event.inputs.build_type }}"
echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
echo "package_version=${PACKAGE_VERSION}" >> $GITHUB_ENV
echo "short_commit_hash=${SHORT_COMMIT_HASH}" >> $GITHUB_ENV
gcloud config set artifacts/repository $ARTIFACTS_REPO
gcloud config set artifacts/location $REGION
PACKAGE_EXIST=$(gcloud artifacts versions list --package=kagome-dev --format=json | jq -e ".[] | select(.name | endswith(\"${PACKAGE_VERSION}\"))" > /dev/null && echo "True" || echo "False")
echo "package_exist=${PACKAGE_EXIST}" >> $GITHUB_ENV
- name: "Cache dependencies"
if: ${{ env.package_exist == 'False' && env.USE_CACHE == 'true' }}
id: cache-restore
uses: actions/cache/restore@v4
with:
path: ${{ env.CACHE_PATH }}
key: ${{ github.job }}-${{ env.CACHE_VERSION }}-${{ github.event.inputs.build_type }}-${{ env.short_commit_hash }}
restore-keys: |
${{ github.job }}-${{ env.CACHE_VERSION }}-${{ github.event.inputs.build_type }}-
- name: "Build target"
if: env.package_exist == 'False'
working-directory: ./housekeeping/docker/kagome-dev
run: make kagome_dev_docker_build \
DOCKER_REGISTRY_PATH=${DOCKER_REGISTRY_PATH} \
GITHUB_HUNTER_USERNAME=${{ secrets.HUNTER_USERNAME }} \
GITHUB_HUNTER_TOKEN=${{ secrets.HUNTER_TOKEN }} \
BUILD_TYPE=${{ github.event.inputs.build_type }} \
BUILDER_IMAGE_TAG=${{ env.BUILDER_LATEST_TAG }} \
WERROR=${{ github.event.inputs.werror }}
- name: "Push Kagome APT Package"
if: env.package_exist == 'False'
working-directory: ./housekeeping/docker/kagome-dev
run: |
SHORT_COMMIT_HASH=$(grep 'short_commit_hash:' commit_hash.txt | cut -d ' ' -f 2)
make upload_apt_package \
BUILD_TYPE=${{ github.event.inputs.build_type }}
- name: Set up Docker Buildx
if: env.package_exist == 'False'
uses: docker/[email protected]
- name: "Build Docker Image"
if: env.package_exist == 'False'
working-directory: ./housekeeping/docker/kagome-dev
run: make kagome_image_build \
KAGOME_PACKAGE_VERSION=${{ env.package_version }} \
DOCKER_REGISTRY_PATH=${DOCKER_REGISTRY_PATH} \
BUILD_TYPE=${{ github.event.inputs.build_type }}
- name: "Push Docker Image"
if: env.package_exist == 'False'
working-directory: ./housekeeping/docker/kagome-dev
run: make kagome_image_push \
DOCKER_REGISTRY_PATH=${DOCKER_REGISTRY_PATH} \
BUILD_TYPE=${{ github.event.inputs.build_type }}
- name: "Always Save Cache"
id: cache-save
if: always() && (steps.cache-restore.outputs.cache-hit != 'true' || env.package_exist != 'True')
uses: actions/cache/save@v4
with:
path: ${{ env.CACHE_PATH }}
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
- name: "Versions Info"
if: always()
run: |
echo "Kagome Package Version: kagome-dev ${{ env.package_version }}"
echo "Kagome Images: "
cat /tmp/docker_image.env || true
cat /tmp/dockerhub_image.env || true
Zombie-Tests:
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [kagome_dev_docker_build]
strategy:
fail-fast: false
matrix:
options:
- name: "PVF preparation & execution time"
test: "test-polkadot-functional-0001-parachains-pvf"
# - name: "Disputes initiation, conclusion and lag"
# test: "test-polkadot-functional-0002-parachains-disputes"
- name: "BEEFY voting and finality, test MMR proofs. Assumes Rococo sessions of 1 minute"
test: "test-polkadot-functional-0003-beefy-and-mmr"
# - name: "Dispute finality lag when 1/3 of parachain validators always attempt to include an invalid block"
# test: "test-polkadot-functional-0004-parachains-garbage-candidate"
# - name: "Past-session dispute slashing"
# test: "test-polkadot-functional-0005-parachains-disputes-past-session"
# - name: "Test if parachains make progress with most of approvals being tranch0"
# test: "test-polkadot-functional-0006-parachains-max-tranche0"
- name: "Test if disputes triggered on finalized blocks within scope always end as valid"
test: "test-polkadot-functional-0007-dispute-freshly-finalized"
- name: "Test if disputes triggered on finalized blocks out of scope never get to be confirmed and concluded"
test: "test-polkadot-functional-0008-dispute-old-finalized"
- name: "Approval voting coalescing does not lag finality"
test: "test-polkadot-functional-0009-approval-voting-coalescing"
# - name: "Test validator disabling effects"
# test: "test-polkadot-functional-0010-validator-disabling"
- name: "Test we are producing blocks at 6 seconds clip"
test: "test-polkadot-functional-0011-async-backing-6-seconds-rate"
- name: "Systematic chunk recovery is used if the chunk mapping feature is enabled."
test: "test-polkadot-functional-0013-systematic-chunk-recovery"
- name: "Warp sync from polkadot node"
test: "test-custom-0001-validators-warp-sync"
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: Create and enable swap
run: |
free -h
df -h
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
free -h
df -h
- 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 commit version"
working-directory: ./housekeeping/docker/kagome-dev
run: make get_versions
- name: "Get Package Version"
working-directory: ./housekeeping/docker/kagome-dev
run: |
ARTIFACTS_REPO=$(grep '^ARTIFACTS_REPO ?=' Makefile | sed 's/ARTIFACTS_REPO ?= //')
REGION=$(grep '^REGION ?=' Makefile | sed 's/REGION ?= //')
SHORT_COMMIT_HASH=$(grep 'short_commit_hash:' commit_hash.txt | cut -d ' ' -f 2)
PACKAGE_VERSION="$(date +'%y.%m.%d')-${SHORT_COMMIT_HASH}-${{ github.event.inputs.build_type }}"
echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
echo "package_version=${PACKAGE_VERSION}" >> $GITHUB_ENV
- name: "Get Zombie Tester Version"
run: |
ZOMBIE_TESTER_IMAGE=${DOCKER_REGISTRY_PATH}zombie_tester:${{ env.TESTER_LATEST_TAG }}
echo "zombie_tester_image=${ZOMBIE_TESTER_IMAGE}"
echo "zombie_tester_image=${ZOMBIE_TESTER_IMAGE}" >> $GITHUB_ENV
- name: "Run test"
working-directory: ./zombienet/docker
run: |
make ${{ matrix.options.test }} \
ZOMBIE_TESTER_IMAGE=${{ env.zombie_tester_image }} \
KAGOME_PACKAGE_VERSION=${{ env.package_version }}
free -h
df -h
- name: "Upload test logs as artifact"
if: always()
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.options.test }}
path: /tmp/test_logs
- name: "Versions Info"
if: always()
run: |
echo "Kagome Package Version: kagome-dev ${{ env.package_version }}"
echo "Zombie Tester Image: ${{ env.zombie_tester_image }}"
echo "Zombie Tests Versions: "
cat /tmp/versions.env || true
- name: "Show system info"
if: always()
run: |
free -h
df -h