-
Notifications
You must be signed in to change notification settings - Fork 7
242 lines (212 loc) · 9.46 KB
/
integration-test.yml
File metadata and controls
242 lines (212 loc) · 9.46 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
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
name: Integration Tests
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [main]
pull_request:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Cancel previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
POLKADOT_SDK_BIN_DIR: ${{ github.workspace }}/.polkadot-sdk-bin
ZOMBIENET_BIN_DIR: ${{ github.workspace }}/.zombienet-bin
jobs:
changes:
uses: ./.github/workflows/check-changed-files.yml
permissions:
contents: read
pull-requests: read
set-image:
if: needs.changes.outputs.should-run == 'true'
needs: [changes]
uses: ./.github/workflows/set-image.yml
setup:
if: needs.changes.outputs.should-run == 'true'
needs: [changes, set-image]
name: Setup
runs-on: parity-large
container:
image: ${{ needs.set-image.outputs.CI_IMAGE }}
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Load common environment variables via env file
run: cat .github/env >> $GITHUB_ENV
# Cache the Polkadot SDK binaries
- name: Cache Polkadot SDK binaries
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
id: polkadot-sdk-cache
with:
path: ${{ env.POLKADOT_SDK_BIN_DIR }}
key: polkadot-sdk-${{ env.POLKADOT_SDK_VERSION }}-${{ env.POLKADOT_SDK_VERSION_WITH_BULLETIN }}-binaries
# Download and extract binaries if cache missed
- name: Download Polkadot SDK binaries
if: steps.polkadot-sdk-cache.outputs.cache-hit != 'true'
run: |
mkdir -p $POLKADOT_SDK_BIN_DIR
cd $POLKADOT_SDK_BIN_DIR
echo "Downloading Polkadot SDK binaries..."
curl -fL -o polkadot https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/polkadot
curl -fL -o polkadot-prepare-worker https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/polkadot-prepare-worker
curl -fL -o polkadot-execute-worker https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/polkadot-execute-worker
curl -fL -o chain-spec-builder https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/chain-spec-builder
# TODO: replace POLKADOT_SDK_VERSION_WITH_BULLETIN with POLKADOT_SDK_VERSION when released: https://github.com/paritytech/polkadot-sdk/pull/10662
curl -fL -o polkadot-omni-node https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION_WITH_BULLETIN}/polkadot-omni-node
echo "${POLKADOT_SHA256} polkadot" | sha256sum -c -
echo "${POLKADOT_PREPARE_WORKER_SHA256} polkadot-prepare-worker" | sha256sum -c -
echo "${POLKADOT_EXECUTE_WORKER_SHA256} polkadot-execute-worker" | sha256sum -c -
echo "${CHAIN_SPEC_BUILDER_SHA256} chain-spec-builder" | sha256sum -c -
echo "${POLKADOT_OMNI_NODE_SHA256} polkadot-omni-node" | sha256sum -c -
chmod +x *
# Cache the Zombienet binaries
- name: Cache Zombienet
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
id: zombienet-cache
with:
path: ${{ env.ZOMBIENET_BIN_DIR }}
key: zombienet-${{ env.ZOMBIENET_VERSION }}-binaries
# Download and extract binaries if cache missed
# NOTE: zombienet releases do not publish checksums
- name: Download Zombienet binaries
if: steps.zombienet-cache.outputs.cache-hit != 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
mkdir -p $ZOMBIENET_BIN_DIR
cd $ZOMBIENET_BIN_DIR
curl -fL \
-H "Authorization: token ${GITHUB_TOKEN}" \
-o zombienet-linux-x64 \
"https://github.com/paritytech/zombienet/releases/download/${ZOMBIENET_VERSION}/zombienet-linux-x64"
chmod +x zombienet-linux-x64
runtime-matrix:
if: needs.changes.outputs.should-run == 'true'
needs: [changes]
runs-on: ubuntu-latest
outputs:
runtime: ${{ steps.runtime.outputs.runtime }}
name: Extract tasks from matrix
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- id: runtime
run: |
TASKS=$(jq '[.[] | select(.integration_tests == true)]' scripts/runtimes-matrix.json)
SKIPPED=$(jq '[.[] | select(.integration_tests != true)]' scripts/runtimes-matrix.json)
echo "--- Running integration tests for ---"
echo "$TASKS"
echo "--- Skipping integration tests for ---"
echo "$SKIPPED"
TASKS=$(echo "$TASKS" | jq -c .)
echo "runtime=$TASKS" >> $GITHUB_OUTPUT
integration-tests:
needs: [set-image, setup, runtime-matrix]
name: Integration Tests (${{ matrix.runtime.name }})
runs-on: parity-large
container:
image: ${{ needs.set-image.outputs.CI_IMAGE }}
timeout-minutes: 200
strategy:
fail-fast: false
matrix:
runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }}
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Load common environment variables via env file
run: cat .github/env >> $GITHUB_ENV
- name: Rust cache (Bulletin)
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
with:
workspaces: .
shared-key: "bulletin-cache-bulletin-integration-tests"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: examples/package.json
- name: Install just
run: cargo install just --locked || true
- name: Cache Polkadot SDK binaries
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
id: polkadot-sdk-cache
with:
path: ${{ env.POLKADOT_SDK_BIN_DIR }}
key: polkadot-sdk-${{ env.POLKADOT_SDK_VERSION }}-${{ env.POLKADOT_SDK_VERSION_WITH_BULLETIN }}-binaries
- name: Cache Zombienet
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
id: zombienet-cache
with:
path: ${{ env.ZOMBIENET_BIN_DIR }}
key: zombienet-${{ env.ZOMBIENET_VERSION }}-binaries
- name: Add binaries to PATH
run: |
chmod +x "${POLKADOT_SDK_BIN_DIR}"/*
ls -lrt "${POLKADOT_SDK_BIN_DIR}"
chmod +x "${ZOMBIENET_BIN_DIR}"/*
ls -lrt "${ZOMBIENET_BIN_DIR}"
echo "${POLKADOT_SDK_BIN_DIR}" >> "$GITHUB_PATH"
echo "SKIP_PARACHAIN_SETUP=1" >> "$GITHUB_ENV"
echo "${ZOMBIENET_BIN_DIR}" >> "$GITHUB_PATH"
echo "ZOMBIENET_BINARY=zombienet-linux-x64" >> "$GITHUB_ENV"
- name: Start services
working-directory: examples
env:
RUNTIME_PACKAGE: ${{ matrix.runtime.package }}
run: |
TEST_DIR="$(mktemp -d $GITHUB_WORKSPACE/bulletin-tests-run-XXXXX)/test"
echo "TEST_DIR=$TEST_DIR" >> "$GITHUB_ENV"
echo "RUNTIME_PACKAGE=${RUNTIME_PACKAGE}" >> "$GITHUB_ENV"
just KUBO_VERSION="${KUBO_VERSION}" start-services "$TEST_DIR" "$RUNTIME_PACKAGE" "kubo-native"
- name: Test authorize-and-store ws
working-directory: examples
run: just run-test-authorize-and-store "$TEST_DIR" "$RUNTIME_PACKAGE" "ws"
- name: Test authorize-and-store smoldot
working-directory: examples
run: just run-test-authorize-and-store "$TEST_DIR" "$RUNTIME_PACKAGE" "smoldot"
- name: Test store-chunked-data
working-directory: examples
run: just run-test-store-chunked-data "$TEST_DIR"
- name: Test native-ipfs-dag-pb-chunked-data
working-directory: examples
run: just run-test-native-ipfs-dag-pb-chunked-data "$TEST_DIR"
- name: Test store-big-data
working-directory: examples
run: just run-test-store-big-data "$TEST_DIR" "big32"
- name: Test authorize-preimage-and-store
working-directory: examples
run: just run-test-authorize-preimage-and-store "$TEST_DIR"
- name: Test chopsticks compatibility
working-directory: examples
run: just run-test-chopsticks "ws://127.0.0.1:10000"
- name: Stop services
if: always()
working-directory: examples
run: just KUBO_VERSION="${KUBO_VERSION}" stop-services "$TEST_DIR" "kubo-native"
# Collects logs from the last failed zombienet run.
- name: Upload Zombienet logs (on failure)
if: failure()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: failed-zombienet-logs-${{ matrix.runtime.name }}
path: |
${{ env.TEST_DIR }}/*.log
integration-tests-complete:
name: All integration tests passed
needs: [changes, integration-tests]
if: always()
runs-on: ubuntu-latest
steps:
- name: Decide outcome
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: |
echo "Integration tests failed or were cancelled"
exit 1