-
Notifications
You must be signed in to change notification settings - Fork 12
147 lines (127 loc) · 5 KB
/
reusable-e2e-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
name: Run e2e tests
on:
workflow_call:
inputs:
e2eBranch:
type: string
required: false
substrateNodeVersion:
type: string
required: false
default: 'eth-rollup-develop'
globalVersion:
type: string
required: false
default: '8dd0c81aa88b967334d001d8cae031f8799a189f'
workflow_dispatch:
inputs:
e2eBranch:
type: string
required: false
substrateNodeVersion:
type: string
required: false
default: 'eth-rollup-develop'
globalVersion:
type: string
required: false
default: '8dd0c81aa88b967334d001d8cae031f8799a189f'
permissions:
contents: read
actions: read
checks: write
env:
CURRENT_BRANCH: ${{ github.head_ref || github.ref_name }}
DEFAULT_E2E_REPO_BRANCH: eth-rollup-develop
AVS_AGGREGATOR_VERSION: ${{ inputs.globalVersion }}
AVS_FINALIZER_VERSION: ${{ inputs.globalVersion }}
ROLLUP_SEQUENCER_VERSION: ${{ inputs.globalVersion }}
ROLLUP_UPDATER_VERSION: ${{ inputs.globalVersion }}
MANGATA_NODE_VERSION: ${{ inputs.substrateNodeVersion }}
jobs:
run-e2e-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Start env
run: docker compose up -d --wait
- name: Use custom branch in e2e tests repository if it exists, otherwise use default branch
id: e2e
run: |
# Implementation of this conditional action was taken from here:
# https://github.com/actions/checkout/issues/512#issuecomment-1264735491
# This condition check if the input 'e2eBranch' is empty, and if it is, it checks if the current branch name exists in 'mangata-e2e' repository
if [[ -z "${{ inputs.e2eBranch }}" ]]; then
# Checking if current branch name exists in 'mangata-e2e' repository
if git ls-remote --heads --quiet --exit-code https://github.com/mangata-finance/mangata-e2e.git ${{ env.CURRENT_BRANCH }}; then
echo "Using custom '${{ env.CURRENT_BRANCH }}' branch as it exists in 'mangata-e2e' repository"
echo "BRANCH=${{ env.CURRENT_BRANCH }}" >> $GITHUB_OUTPUT
else
echo "Custom branch '${{ env.CURRENT_BRANCH }}' does not exist in 'mangata-e2e' repository, using default '${{ env.DEFAULT_E2E_REPO_BRANCH }}' branch"
echo "BRANCH=${{ env.DEFAULT_E2E_REPO_BRANCH }}" >> $GITHUB_OUTPUT
fi
else
echo "Using '${{ inputs.e2eBranch }}' branch fo 'mangata-e2e' repository as it was provided in the input"
echo "BRANCH=${{ inputs.e2eBranch }}" >> $GITHUB_OUTPUT
fi
- name: Checkout tests
uses: actions/checkout@v4
with:
repository: mangata-finance/mangata-e2e
ref: ${{ steps.e2e.outputs.BRANCH }}
path: e2eTests
- name: Install e2e tests dependencies
working-directory: e2eTests
run: yarn install
- name: Run tests
working-directory: e2eTests
run: yarn test-rollup
- name: Get sequencer logs
if: success() || failure()
run: docker logs rollup-sequencer-1
- name: Get updater logs
if: success() || failure()
run: docker logs rollup-updater-1
- name: Test Report
uses: dorny/[email protected]
if: success() || failure()
with:
name: E2E report test-rollup
path: e2eTests/reports/*.xml
reporter: jest-junit
run-avs-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Start env
run: docker compose up -d --wait
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: build and copy contracts
working-directory: contracts
run: |
forge build
cp out/FinalizerTaskManager.sol/FinalizerTaskManager.json ../avs-finalizer/tests/abis/FinalizerTaskManager.json
cp out/IndexRegistryStorage.sol/IndexRegistryStorage.json ../avs-finalizer/tests/abis/IndexRegistryStorage.json
cp out/RegistryCoordinator.sol/RegistryCoordinator.json ../avs-finalizer/tests/abis/RegistryCoordinator.json
cp out/RegistryCoordinatorStorage.sol/RegistryCoordinatorStorage.json ../avs-finalizer/tests/abis/RegistryCoordinatorStorage.json
- name: FINALIZER tests - install deps
working-directory: avs-finalizer/tests/
run: yarn install
- name: FINALIZER tests - run tests
working-directory: avs-finalizer/tests/
run: yarn test
- name: Get avs-aggregator logs
if: success() || failure()
run: docker logs rollup-avs-aggregator-1
- name: Get avs-finalizer logs
if: success() || failure()
run: docker logs rollup-avs-finalizer-1
- name: Get anvil logs
if: success() || failure()
run: docker logs rollup-anvil-1
- run: docker ps