-
Notifications
You must be signed in to change notification settings - Fork 11
229 lines (212 loc) · 6.97 KB
/
e2e-test-workflow-call-nightly.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
on:
workflow_call:
secrets:
SLACK_E2E_TEST_WEBHOOK_URL:
required: true
inputs:
dymension_ci:
description: "CI run on Dymension Repo"
required: false
type: string
default: "latest"
rollapp_evm_ci:
description: "CI run on Rollapp-EVM Repo"
required: false
type: string
default: "latest"
rollapp_wasm_ci:
description: "CI run on Rollapp-Wasm Repo"
required: false
type: string
default: "latest"
relayer_ci:
description: "CI run on Relayer Repo"
required: false
type: string
default: "main-dym"
test:
description: 'test name to run as standalone'
required: false
type: string
default: ''
test-exclusions:
description: 'Comma separated list of tests to skip'
required: false
type: string
default: '' # empty string means don't skip any test.
jobs:
build-evm-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
repository: dymensionxyz/e2e-tests
ref: main
- uses: actions/setup-go@v5
with:
go-version: "1.23.4"
- id: set-matrix
run: |
output=$(go run build_tests_matrix/main.go)
echo "matrix=$output" >> $GITHUB_OUTPUT
env:
TEST_EXCLUSIONS: '${{ inputs.test-exclusions }}'
TEST_NAME: '${{ inputs.test }}'
ROLLAPP_TYPE: "EVM"
build-wasm-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
repository: dymensionxyz/e2e-tests
ref: main
- uses: actions/setup-go@v5
with:
go-version: "1.23.4"
- id: set-matrix
run: |
output=$(go run build_tests_matrix/main.go)
echo "matrix=$output" >> $GITHUB_OUTPUT
env:
TEST_EXCLUSIONS: '${{ inputs.test-exclusions }}'
TEST_NAME: '${{ inputs.test }}'
ROLLAPP_TYPE: "Wasm"
# e2e-tests-by runs the actual go test command to trigger the test.
rollapp-evm:
needs:
- build-evm-matrix
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.build-evm-matrix.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: dymensionxyz/e2e-tests
ref: main
- name: Set up Go 1.23
uses: actions/setup-go@v4
with:
go-version: "1.23.4"
- name: Download Tarball Artifact
uses: actions/download-artifact@v4
with:
name: e2e
path: /tmp
- name: Load Docker Image
run: |
docker image load -i /tmp/e2e.tar
docker image ls -a
- name: Rollapp-EVM E2E Tests
run:
sudo -E make e2e-test test=${{ matrix.test }}
env:
DYMENSION_CI: ${{ inputs.dymension_ci }}
ROLLAPP_EVM_CI: ${{ inputs.rollapp_evm_ci }}
ROLLAPP_WASM_CI: ${{ inputs.rollapp_wasm_ci }}
RELAYER_CI: ${{ inputs.relayer_ci }}
- name: Write failed test
if: failure()
run:
echo "${{ matrix.test }}" >> failed-tests-${{ matrix.test }}.log
- name: Upload Failed Tests
if: failure()
uses: actions/upload-artifact@v4
with:
name: failed-tests-${{ matrix.test }}
path: failed-tests-${{ matrix.test }}.log
if-no-files-found: ignore
# e2e-tests-by runs the actual go test command to trigger the test.
rollapp-wasm:
needs:
- build-wasm-matrix
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.build-wasm-matrix.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: dymensionxyz/e2e-tests
ref: main
- name: Set up Go 1.23
uses: actions/setup-go@v4
with:
go-version: "1.23.4"
- name: Download Tarball Artifact
uses: actions/download-artifact@v4
with:
name: e2e
path: /tmp
- name: Load Docker Image
run: |
docker image load -i /tmp/e2e.tar
docker image ls -a
- name: Rollapp-Wasm E2E Tests
run: sudo -E make e2e-test test=${{ matrix.test }}
env:
DYMENSION_CI: ${{ inputs.dymension_ci }}
ROLLAPP_EVM_CI: ${{ inputs.rollapp_evm_ci }}
ROLLAPP_WASM_CI: ${{ inputs.rollapp_wasm_ci }}
RELAYER_CI: ${{ inputs.relayer_ci }}
- name: Write failed test
if: failure()
run:
echo "${{ matrix.test }}" >> failed-tests-${{ matrix.test }}.log
- name: Upload Failed Tests
if: failure()
uses: actions/upload-artifact@v4
with:
name: failed-tests-${{ matrix.test }}
path: failed-tests-${{ matrix.test }}.log
if-no-files-found: ignore
notify-slack:
runs-on: ubuntu-latest
needs:
- rollapp-evm
- rollapp-wasm
if: always()
steps:
- name: Download All Failed Test Logs
uses: actions/download-artifact@v4
with:
pattern: failed-tests-*
merge-multiple: true
- name: Combine Failed Test Logs
run: |
set +e
touch combined-failed-tests.log
for file in failed-tests-*; do
echo "Adding $file to combined log"
cat "$file" >> combined-failed-tests.log
done
set -e
echo "RUN_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV
cat combined-failed-tests.log
- name: Generate Slack Message
id: slack_message
run: |
if [ -s combined-failed-tests.log ]; then
FAILED_TESTS=$(awk '{print NR ". " $0}' combined-failed-tests.log | paste -sd '\n')
MESSAGE="*Some tests failed. Details:*\n\n${FAILED_TESTS}\n\n<${{ env.RUN_URL }}|View the full report here>"
else
MESSAGE="All tests passed!\n\n<${{ env.RUN_URL }}|View the full report here>"
fi
# Replace newlines with \n for safe storage in environment variable
MESSAGE_ESCAPED=$(echo "$MESSAGE" | sed ':a;N;$!ba;s/\n/\\n/g')
echo "SLACK_MESSAGE=$MESSAGE_ESCAPED" >> $GITHUB_ENV
- name: Notify Slack
env:
SLACK_E2E_TEST_WEBHOOK_URL: ${{ secrets.SLACK_E2E_TEST_WEBHOOK_URL }}
run: |
if [ -z "${SLACK_E2E_TEST_WEBHOOK_URL}" ]; then
echo "SLACK_E2E_TEST_WEBHOOK_URL is not set"
exit 1
else
echo "SLACK_E2E_TEST_WEBHOOK_URL is set"
fi
curl -X POST -H 'Content-type: application/json' -d "{\"text\": \"${{ env.SLACK_MESSAGE }}\"}" $SLACK_E2E_TEST_WEBHOOK_URL