-
Notifications
You must be signed in to change notification settings - Fork 207
355 lines (334 loc) · 13.3 KB
/
integration.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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
name: Integration tests
on:
# Use the following to explicitly start this workflow.
# packages/deployment/scripts/start-github-integration-test.sh <BRANCH-OR-TAG>
workflow_dispatch:
push:
branches:
- master
- 'release-*'
- 'dev-*'
- beta
tags:
- '@agoric/sdk@*'
pull_request:
types:
- opened
- reopened
- synchronize
- converted_to_draft
- ready_for_review
- labeled
- unlabeled
- auto_merge_enabled
- auto_merge_disabled
merge_group:
schedule:
- cron: '17 6 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre_check:
uses: ./.github/workflows/pre-check-integration.yml
# This job is meant to emulate what developers working with the Agoric platform will experience
# It should be kept in sync with https://agoric.com/documentation/getting-started/
getting-started:
needs: pre_check
if: needs.pre_check.outputs.should_run == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cli: [link-cli/yarn, registry/yarn, registry/npm, registry/npx]
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Reconfigure git to use HTTP authentication
run: git config --global url."https://github.com/".insteadOf ssh://git@github.com/
shell: bash
# Prerequisites
- uses: ./.github/actions/restore-node
with:
node-version: 18.18
keep-endo: 'true'
# Select a branch on dapp to test against by adding text to the body of the
# pull request. For example: #getting-started-branch: zoe-release-0.7.0
# The default is 'main'
- name: Get the appropriate dapp branch
id: get-branch
uses: actions/github-script@v7
with:
result-encoding: string
script: |
let branch = 'main';
if (context.payload.pull_request) {
const { body } = context.payload.pull_request;
const regex = /^\#getting-started-branch:\s+(\S+)/m;
const result = regex.exec(body);
if (result) {
branch = result[1];
}
}
console.log('getting-started dapp branch: ' + branch);
return branch;
- name: Start local NPM registry
if: ${{ startsWith(matrix.cli, 'registry') }}
run: |
set -xe
git reset --hard HEAD
git clean -f
git config user.email "noreply@agoric.com"
REGISTRY_PUBLISH_WORKSPACES="$HOME/endo"
timeout 900 scripts/registry.sh bg-publish ${{ matrix.cli }}
- name: run agoric-cli integration-test
# These integration tests can be flaky so retry automatically
uses: nick-fields/retry@v3
with:
# This step usually takes <4 minutes (after 6m setup). The
# deployment-test running in parallel takes 35 minutes so 20 minutes
# won't increase the time for this workflow to complete.
timeout_minutes: 20
command: scripts/registry.sh test ${{ matrix.cli }} ${{steps.get-branch.outputs.result}}
on_retry_command: rm -f $HOME/bin/agoric
- name: notify on failure
if: >
failure() && github.event_name != 'pull_request' &&
github.repository_owner == 'agoric'
uses: ./.github/actions/notify-status
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
from: ${{ secrets.NOTIFY_EMAIL_FROM }}
to: ${{ secrets.NOTIFY_EMAIL_TO }}
password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }}
deployment-test:
needs: pre_check
if: needs.pre_check.outputs.should_run == 'true'
runs-on: ubuntu-22.04 # jammy (LTS)
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
path: ./agoric-sdk
- run: sudo packages/deployment/scripts/install-deps.sh
working-directory: ./agoric-sdk
- uses: ./agoric-sdk/.github/actions/restore-golang
with:
go-version: '1.20'
path: ./agoric-sdk
- uses: ./agoric-sdk/.github/actions/restore-node
with:
# XXX loadgen not compatible with 18.19 https://github.com/Agoric/agoric-sdk/pull/8365#issuecomment-1848003597
node-version: 18.18
path: ./agoric-sdk
# Forces xsnap to initialize all memory to random data, which increases
# the chances the content of snapshots may deviate between validators
xsnap-random-init: '1'
# Select a branch on loadgen to test against by adding text to the body of the
# pull request. For example: #loadgen-branch: user-123-update-foo
# The default is 'main'
- name: Get the appropriate loadgen branch
id: get-loadgen-branch
uses: actions/github-script@v7
with:
result-encoding: string
script: |
let branch = 'main';
if (context.payload.pull_request) {
const { body } = context.payload.pull_request;
const regex = /^\#loadgen-branch:\s+(\S+)/m;
const result = regex.exec(body);
if (result) {
branch = result[1];
}
}
console.log('loadgen branch: ' + branch);
return branch;
- name: Check out loadgen
uses: actions/checkout@v4
with:
repository: Agoric/testnet-load-generator
path: ./testnet-load-generator
ref: ${{steps.get-loadgen-branch.outputs.result}}
- name: Build cosmic-swingset dependencies
working-directory: ./agoric-sdk
run: |
set -e
cd packages/cosmic-swingset
make install
- name: Make networks directory
run: |
set -e
mkdir networks
- name: Run integration test
working-directory: ./networks
run: |
set -xe
DOCKER_VOLUMES="$PWD/../agoric-sdk:/usr/src/agoric-sdk" \
LOADGEN=1 \
../agoric-sdk/packages/deployment/scripts/integration-test.sh
timeout-minutes: 90
env:
NETWORK_NAME: chaintest
- name: capture results
if: always()
working-directory: ./networks
run: |
NOW=$(date -u +%Y%m%dT%H%M%S)
echo "NOW=$NOW" >> "$GITHUB_ENV"
# Stop the chain from running.
../agoric-sdk/packages/deployment/scripts/setup.sh play stop || true
# Get the results.
../agoric-sdk/packages/deployment/scripts/capture-integration-results.sh "${{ job.status == 'failure' }}"
# Tear down the nodes.
echo yes | ../agoric-sdk/packages/deployment/scripts/setup.sh destroy || true
env:
NETWORK_NAME: chaintest
- uses: actions/upload-artifact@v4
if: always()
with:
name: deployment-test-results-${{ env.NOW }}
path: ./networks/chaintest/results
- name: notify on failure
if: failure() && github.event_name != 'pull_request'
uses: ./agoric-sdk/.github/actions/notify-status
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
from: ${{ secrets.NOTIFY_EMAIL_FROM }}
to: ${{ secrets.NOTIFY_EMAIL_TO }}
password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }}
test-docker-build:
needs: pre_check
if: needs.pre_check.outputs.should_run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: free up disk space
run: |
# Workaround to provide additional free space for testing.
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
# If this turns out not to be enough, maybe look instead at
# https://github.com/actions/runner-images/issues/2840#issuecomment-1540506686
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
echo "=== After cleanup:"
df -h
- uses: actions/checkout@v4
- name: docker build (sdk)
# Produces ghcr.io/agoric/agoric-sdk:unreleased used in the following upgrade test.
# run: cd packages/deployment && ./scripts/test-docker-build.sh | $TEST_COLLECT
# XXX skip TAP test output and collection for now; it hides the output from the logs
run: make docker-build-sdk
working-directory: packages/deployment
- uses: ./.github/actions/restore-node
with:
node-version: '18.x'
# Rebuilding the SDK image with resolved endo packages is not currently supported
# and since we can't build core eval submissions from the SDK using a newer endo,
# simply ignore any endo branch integration (this means we don't have full coverage)
ignore-endo-branch: 'true'
id: restore-node
- name: setup a3p-integration
run: yarn install
working-directory: a3p-integration
- name: verify SDK image didn't change
# In the future when we can rebuild the SDK image with resolved endo packages, it would
# be expected that the SDK image previously built has changed
if: steps.restore-node.outputs.endo-branch == 'NOPE'
run: |
original=$(docker inspect --format "{{.ID}}" ghcr.io/agoric/agoric-sdk:unreleased)
yarn build:sdk
new=$(docker inspect --format "{{.ID}}" ghcr.io/agoric/agoric-sdk:unreleased)
if [ "$original" != "$new" ]; then
echo "New SDK docker image ($new) changed after restore-node (original $original)" 1>&2
exit 1
fi
working-directory: a3p-integration
- name: build proposals tests
run: yarn build
working-directory: a3p-integration
- name: run proposals tests
run: yarn test
working-directory: a3p-integration
- name: collect all core eval scripts
# Core eval scripts will be copied under /tmp/core_eval_scripts directory
# colons in the parent directory name will be replaced with dashes
run: |
find . -type d -path "./a3p-integration/proposals/*/submission" | while read -r dir; do
# Get the parent directory name
parent_dir=$(basename "$(dirname "$dir")")
# Replace colons with dashes in the parent directory name
sanitized_parent_dir=${parent_dir//:/-}
# Create the destination directory under /tmp/core_eval_scripts if it doesn't exist
destination_dir="/tmp/core_eval_scripts/$sanitized_parent_dir"
mkdir -p "$destination_dir"
# Copy everything from the $dir to the destination directory
cp -r "$dir"/* "$destination_dir/"
echo "Copied contents of $dir to $destination_dir"
done
- name: archive core eval scripts
# The core eval scripts can be found at the bottom of `Summary` page of
# `Integration tests` workflow once the workflow is completed.
# Ref: https://github.com/actions/upload-artifact?tab=readme-ov-file#where-does-the-upload-go
uses: actions/upload-artifact@v4
with:
name: core-eval-scripts
path: /tmp/core_eval_scripts
- name: notify on failure
if: failure() && github.event_name != 'pull_request'
uses: ./.github/actions/notify-status
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
from: ${{ secrets.NOTIFY_EMAIL_FROM }}
to: ${{ secrets.NOTIFY_EMAIL_TO }}
password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }}
- uses: ./.github/actions/post-test
if: (success() || failure())
continue-on-error: true
timeout-minutes: 4
with:
datadog-token: ${{ secrets.DATADOG_API_KEY }}
test-multichain-e2e:
needs: pre_check
if: needs.pre_check.outputs.should_run == 'true'
uses: ./.github/workflows/multichain-e2e.yml
finalize-integration-result:
needs:
- pre_check
- getting-started
- deployment-test
- test-docker-build
- test-multichain-e2e
if: >-
always() &&
needs.pre_check.result == 'success' &&
needs.getting-started.result != 'cancelled' &&
needs.deployment-test.result != 'cancelled' &&
needs.test-docker-build.result != 'cancelled' &&
(
needs.pre_check.outputs.should_run == 'true' ||
needs.pre_check.outputs.previous_success == 'true'
)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Final integration-test-result
if: always()
uses: actions/github-script@v7
with:
script: |
const previousSuccess = ${{ needs.pre_check.outputs.previous_success }};
const gettingStartedTestSuccess = "${{ needs.getting-started.result }}" === "success";
const deploymentTestSuccess = "${{ needs.deployment-test.result }}" === "success";
const testDockerBuildSuccess = "${{ needs.test-docker-build.result }}" === "success";
const conclusion = previousSuccess || (gettingStartedTestSuccess && deploymentTestSuccess && testDockerBuildSuccess) ?
'success' : 'failure';
console.log(`Finishing with ${conclusion}`)
if (conclusion === 'failure') {
core.setFailed('Integration tests failed')
}