This repository was archived by the owner on Mar 11, 2022. It is now read-only.
Repository navigation
325 lines (302 loc) · 11.1 KB
/
Copy pathintegration.yml
File metadata and controls
325 lines (302 loc) · 11.1 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
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
name: integration
on:
push:
branches:
- 'master'
- 'develop'
- '*rc'
- 'regenesis/*'
pull_request:
workflow_dispatch:
jobs:
start-runner:
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Start EC2 runner
id: start-ec2-runner-1
uses: machulav/ec2-github-runner@v2
continue-on-error: true
with:
mode: start
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
ec2-image-id: ami-00b46fa1102c70ff2
ec2-instance-type: m4.4xlarge
subnet-id: subnet-905870ae
security-group-id: sg-0855631d714870b32
- name: Start EC2 runner retry
if: steps.start-ec2-runner-1.outcome == 'failure'
id: start-ec2-runner-2
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
ec2-image-id: ami-00b46fa1102c70ff2
ec2-instance-type: m4.4xlarge
subnet-id: subnet-905870ae
security-group-id: sg-0855631d714870b32
- name: See if any of 2 tries succeeded
id: start-ec2-runner
run: |
if [ "${{ steps.start-ec2-runner-1.outcome }}" = "success" ]; then
echo "::set-output name=label::${{ steps.start-ec2-runner-1.outputs.label }}"
echo "::set-output name=ec2-instance-id::${{ steps.start-ec2-runner-1.outputs.ec2-instance-id }}"
fi
if [ "${{ steps.start-ec2-runner-2.outcome }}" = "success" ]; then
echo "::set-output name=label::${{ steps.start-ec2-runner-2.outputs.label }}"
echo "::set-output name=ec2-instance-id::${{ steps.start-ec2-runner-2.outputs.ec2-instance-id }}"
fi
start-executioner:
name: Start self-hosted EC2 executioner
needs: build
runs-on: ubuntu-latest
strategy:
max-parallel: 4
fail-fast: false
matrix:
include:
- id: 1
test-grep-filter: 'tag:rpc'
- id: 2
test-grep-filter: 'tag:boba'
- id: 3
test-grep-filter: 'tag:mrf'
- id: 4
test-grep-filter: 'tag:other'
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Start EC2 executioner
id: start-ec2-executioner-1
uses: machulav/ec2-github-runner@v2
continue-on-error: true
with:
mode: start
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
ec2-image-id: ami-00b46fa1102c70ff2
ec2-instance-type: t2.2xlarge
subnet-id: subnet-905870ae
security-group-id: sg-0855631d714870b32
- name: Start EC2 executioner
id: start-ec2-executioner-2
if: steps.start-ec2-executioner-1.outcome == 'failure'
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
ec2-image-id: ami-00b46fa1102c70ff2
ec2-instance-type: t2.2xlarge
subnet-id: subnet-905870ae
security-group-id: sg-0855631d714870b32
- name: See if any of 2 tries succeeded
id: start-ec2-executioner
run: |
if [ "${{ steps.start-ec2-executioner-1.outcome }}" = "success" ]; then
echo "::set-output name=label::${{ steps.start-ec2-executioner-1.outputs.label }}"
echo "::set-output name=ec2-instance-id::${{ steps.start-ec2-executioner-1.outputs.ec2-instance-id }}"
fi
if [ "${{ steps.start-ec2-executioner-2.outcome }}" = "success" ]; then
echo "::set-output name=label::${{ steps.start-ec2-executioner-2.outputs.label }}"
echo "::set-output name=ec2-instance-id::${{ steps.start-ec2-executioner-2.outputs.ec2-instance-id }}"
fi
- name: Output the runner meta
run: |
mkdir /tmp/runner/
mkdir /tmp/runner/${{ matrix.id }}
echo '${{ matrix.test-grep-filter }}' > /tmp/runner/${{ matrix.id }}/filter
echo ${{ steps.start-ec2-executioner.outputs.label }} > //tmp/runner/${{ matrix.id }}/label
echo ${{ steps.start-ec2-executioner.outputs.ec2-instance-id }} > /tmp/runner/${{ matrix.id }}/instance
- uses: actions/upload-artifact@v2
with:
name: runner_info
path: /tmp/runner/*
build:
needs: start-runner
runs-on: ${{ needs.start-runner.outputs.label }}
# services:
# registry:
# image: registry:2
# ports:
# - 5000:5000
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
steps:
#https://github.com/actions/checkout/issues/590
- run: git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || true
- uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Build the services
working-directory: ./ops
run: |
./scripts/stats.sh &
./scripts/build-ci.sh
- name: List the images
working-directory: ./ops
run: docker images
- name: Export and upload artifact images
run: |
mkdir /tmp/bobanetwork
for i in $(docker images --format "{{.Repository}}:{{.Tag}}" | grep bobanetwork); do
docker save -o /tmp/$(echo "$i" | sed s/:/_/g).tar "$i" &
done
wait < <(jobs -p)
- uses: actions/upload-artifact@v2
with:
name: boba_images
path: /tmp/bobanetwork/*.tar
integration:
needs:
- build
- start-executioner
runs-on: [self-hosted]
env:
DOCKER_CLIENT_TIMEOUT: 120
COMPOSE_HTTP_TIMEOUT: 120
#services:
# registry:
# image: registry:2
# ports:
# - 5000:5000
strategy:
max-parallel: 4
fail-fast: false
matrix:
include:
- id: 1
test-grep-filter: 'tag:rpc'
- id: 2
test-grep-filter: 'tag:boba'
- id: 3
test-grep-filter: 'tag:mrf'
- id: 4
test-grep-filter: 'tag:other'
steps:
- uses: actions/download-artifact@v2
continue-on-error: true
id: download
with:
name: boba_images
path: /tmp/bobanetwork/
#resolving transient error:
#An error occurred while attempting to decompress the response stream
- name: retry artifact download on failure
id: download_2
if: steps.download.outcome=='failure'
uses: actions/download-artifact@v2
with:
name: boba_images
path: /tmp/bobanetwork/
- name: Display structure of downloaded files
run: ls -R
working-directory: /tmp/bobanetwork/
- name: Load artifacts into docker
run: |
for f in ${{steps.download.outputs.download-path}}/*.tar; do
docker load -i $f &
done
wait < <(jobs -p)
#https://github.com/actions/checkout/issues/590
- run: git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || true
- uses: actions/checkout@v3
- name: Bring the stack up
working-directory: ./ops
run: BUILD=2 DAEMON=1 ./up_local.sh
- name: Wait for the Sequencer node
working-directory: ./ops
run: ./scripts/wait-for-sequencer.sh
- name: Start background logging
working-directory: ./ops
run: docker-compose -f docker-compose.yml logs --follow &
- name: Run the integration tests
working-directory: ./ops
run: docker-compose run -e TEST_GREP_FILTER="${{ matrix.test-grep-filter }}" integration_tests
stop-runner:
name: Stop self-hosted EC2 runner
needs:
- start-runner # required to get output from the start-runner job
- build # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}
stop-executioner:
name: Stop self-hosted EC2 runner
needs:
- integration # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
strategy:
max-parallel: 4
fail-fast: false
matrix:
include:
- id: 1
- id: 2
- id: 3
- id: 4
steps:
- uses: actions/download-artifact@v2
with:
name: runner_info
path: /tmp/runner/
- name: Set runner info
id: runner_info
working-directory: /tmp/runner/
run: |
ls -altr
cd ${{ matrix.id }}
cat filter
echo "::set-output name=label::"$(cat label)
echo "::set-output name=ec2-instance-id::"$(cat instance)
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
label: ${{ steps.runner_info.outputs.label }}
ec2-instance-id: ${{ steps.runner_info.outputs.ec2-instance-id }}