-
Notifications
You must be signed in to change notification settings - Fork 10
153 lines (134 loc) · 5.37 KB
/
execute_local_tests.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
# Builds a local testnet and runs a set of tests
#
name: '[execute] Execute local tests'
run-name: Run local tests (${{ github.event_name }})
on:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
inputs:
target_branch:
description: 'Branch of go-ten to run against'
required: true
default: main
arguments:
description: 'Arguments to the pysys run'
required: true
default: '-e skip -e performance -e robustness'
jobs:
test-run:
runs-on: [self-hosted, Linux, X64, local-testnets]
steps:
- name: 'Check out ten-test'
uses: actions/checkout@v3
with:
path: ./ten-test
- name: 'Check out go-ten code on schedule trigger'
if: ${{ github.event_name == 'schedule' }}
uses: actions/checkout@v3
with:
repository: ten-protocol/go-ten
path: ./go-ten
- name: 'Check out go-ten code on workflow dispatch'
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/checkout@v3
with:
repository: ten-protocol/go-ten
path: ./go-ten
ref: ${{ github.event.inputs.target_branch }}
- name: 'Docker clean containers and images before the test'
run: |
for i in `docker ps -a | awk '{ print $1 } ' | grep -v CONTAINER`; do docker stop $i && docker rm $i; done
docker system prune -af --volumes
for i in `docker volume ls --filter dangling=true -q`; do docker volume rm $i; done
- name: 'Build docker containers'
run: |
cd ${{ github.workspace }}/go-ten/testnet
./testnet-local-build_images.sh
- name: 'Start up testnet'
run: |
cd ${{ github.workspace }}/go-ten/
go run ./testnet/launcher/cmd
- name: 'Collect container logs'
if: always()
run: |
echo "Run docker container log background processes"
cd ${{ github.workspace }}/go-ten/
docker logs -f `docker ps -aqf "name=validator-host"` > validator-host.out 2>&1 &
docker logs -f `docker ps -aqf "name=validator-enclave"` > validator-enclave.out 2>&1 &
docker logs -f `docker ps -aqf "name=sequencer-host"` > sequencer-host.out 2>&1 &
docker logs -f `docker ps -aqf "name=sequencer-enclave"` > sequencer-enclave.out 2>&1 &
docker logs -f `docker ps -aqf "name=eth2network"` > eth2network.out 2>&1 &
docker logs -f `docker ps -aqf "name=gateway"` > gateway.out 2>&1 &
- name: 'Build required artifacts for running tests'
run: |
cd ${{ github.workspace }}/ten-test
./get_artifacts.sh
ls -l ${{ github.workspace }}/ten-test/artifacts
- name: 'Do a persistence reset'
run: |
cd ${{ github.workspace }}/ten-test/admin
/usr/local/bin/pysys.py run -m ten.local persistence_reset
- name: 'Run tests on workflow dispatch'
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
cd ${{ github.workspace }}/ten-test/tests
/usr/local/bin/pysys.py run -m ten.local ${{ github.event.inputs.arguments }}
- name: 'Run tests on schedule'
if: ${{ github.event_name == 'schedule' }}
run: |
cd ${{ github.workspace }}/ten-test/tests
/usr/local/bin/pysys.py run -m ten.local ${{ github.event.inputs.arguments }}
- name: 'Run the performance summary'
if: always()
continue-on-error: true
run: |
cd ${{ github.workspace }}/ten-test/admin
/usr/local/bin/pysys.py run -m ten.local graph_performance
- name: 'Collate performance output'
if: always()
continue-on-error: true
run: |
cd ${{ github.workspace }}/ten-test
pdftk $(find . -name \*.pdf | sort) cat output results_graphs.pdf || true
- name: 'Upload performance output'
uses: actions/upload-artifact@v4
if: always()
continue-on-error: true
with:
name: performance-artifact
path: |
${{ github.workspace }}/ten-test/results_graphs.pdf
if-no-files-found: ignore
retention-days: 1
- name: 'Upload testcase output'
uses: actions/upload-artifact@v4
if: failure()
continue-on-error: true
with:
name: test-artifact
path: |
${{ github.workspace }}/ten-test/**/Output
!${{ github.workspace }}/ten-test/**/node_modules
retention-days: 1
- name: 'Get the gateway logs'
if: failure()
continue-on-error: true
run: |
cd ${{ github.workspace }}/go-ten/
docker container cp `docker ps -aqf "name=gateway"`:/home/obscuro/gateway_logs.log gateway_logs.out
- name: 'Upload container logs'
uses: actions/upload-artifact@v4
if: failure()
continue-on-error: true
with:
name: container-artifact
path: |
${{ github.workspace }}/go-ten/*.out
retention-days: 1
- name: 'Docker clean containers and images after the test'
if: always()
run: |
for i in `docker ps -a | awk '{ print $1 } ' | grep -v CONTAINER`; do docker stop $i && docker rm $i; done
docker system prune -af --volumes
for i in `docker volume ls --filter dangling=true -q`; do docker volume rm $i; done