-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (153 loc) · 6.2 KB
/
end-to-end.yaml
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
name: End-to-End Tests
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- develop
- main
workflow_dispatch:
jobs:
check-secrets:
runs-on: ubuntu-latest
outputs:
e2e-erigon-url: ${{ steps.e2e-erigon-url.outputs.defined }}
e2e-cypress-record-key: ${{ steps.e2e-cypress-record-key.outputs.defined }}
steps:
- name: Check if E2E_ERIGON_URL is available
id: e2e-erigon-url
env:
E2E_ERIGON_URL: ${{ secrets.E2E_ERIGON_URL }}
if: "${{ env.E2E_ERIGON_URL != '' }}"
run: echo "defined=true" >> $GITHUB_OUTPUT
- name: Check if E2E_CYPRESS_RECORD_KEY is available
id: e2e-cypress-record-key
env:
E2E_CYPRESS_RECORD_KEY: ${{ secrets.E2E_CYPRESS_RECORD_KEY }}
if: "${{ env.E2E_CYPRESS_RECORD_KEY != '' }}"
run: echo "defined=true" >> $GITHUB_OUTPUT
e2e-test-mainnet:
name: Run E2E tests on mainnet
runs-on: ubuntu-latest
if: ${{ needs.check-secrets.outputs.e2e-erigon-url == 'true' }}
needs: [check-secrets]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up xvfb
run: |
sudo apt update
sudo apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb
- name: Run Cypress tests on mainnet
uses: cypress-io/github-action@v6
with:
start: npm start
wait-on: "http://localhost:5173"
spec: "cypress/e2e/mainnet/**/*.cy.ts,cypress/e2e/*.cy.ts"
tag: ${{needs.check-secrets.outputs.e2e-cypress-record-key == 'true' && 'mainnet' || ''}}
record: |
${{needs.check-secrets.outputs.e2e-cypress-record-key == 'true' && 'true' || 'false'}}
env:
VITE_ERIGON_URL: ${{secrets.E2E_ERIGON_URL}}
CYPRESS_RECORD_KEY: ${{secrets.E2E_CYPRESS_RECORD_KEY}}
- name: Upload screenshots from failing tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: Cypress Mainnet Screenshots
path: cypress/screenshots
e2e-test-devnet:
name: Run E2E tests on a devnet
runs-on: ubuntu-latest
needs: [check-secrets]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up xvfb
run: |
sudo apt update
sudo apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb
- name: Download Erigon
run: git clone --branch release/2.54 --single-branch https://github.com/ledgerwatch/erigon.git
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "erigon/go.mod"
cache-dependency-path: "erigon/go.sum"
- name: Build Erigon
run: |
cd erigon
make erigon
- name: Load devnet config
id: load-devnet-config
run: |
OTTERSCAN_CONFIG="$(cat cypress/support/devnet-config.json | sed 's/localhost/127.0.0.1/')"
OTTERSCAN_CONFIG=$(echo $OTTERSCAN_CONFIG)
echo "config=$OTTERSCAN_CONFIG" >> $GITHUB_OUTPUT
- name: Run Cypress tests on devnet
uses: cypress-io/github-action@v6
with:
start: |
sh ./scripts/run-erigon-devnet-e2e-tests.sh
npm run start
wait-on: "http://127.0.0.1:8545, http://localhost:5173"
spec: "cypress/e2e/devnet/**/*.cy.ts,cypress/e2e/*.cy.ts"
tag: ${{needs.check-secrets.outputs.e2e-cypress-record-key == 'true' && 'devnet' || ''}}
record: |
${{needs.check-secrets.outputs.e2e-cypress-record-key == 'true' && 'true' || 'false'}}
env:
VITE_CONFIG_JSON: ${{steps.load-devnet-config.outputs.config}}
CYPRESS_RECORD_KEY: ${{secrets.E2E_CYPRESS_RECORD_KEY}}
CYPRESS_DEVNET_ERIGON_URL: "http://127.0.0.1:8545"
CYPRESS_DEVNET_SOURCIFY_SOURCE: "http://127.0.0.1:7077"
- name: Upload screenshots from failing tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: Cypress Devnet Screenshots
path: cypress/screenshots
e2e-test-anvil:
name: Run E2E tests on an Anvil devnet
runs-on: ubuntu-latest
needs: [check-secrets]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up xvfb
run: |
sudo apt update
sudo apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb
- name: Download Anvil
run: |
wget -O ./forge.tar.gz https://github.com/foundry-rs/foundry/releases/download/nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9/foundry_nightly_linux_amd64.tar.gz
tar -xzf ./forge.tar.gz anvil
- name: Load devnet config
id: load-devnet-config
run: |
OTTERSCAN_CONFIG="$(cat cypress/support/devnet-config.json | sed 's/localhost/127.0.0.1/')"
OTTERSCAN_CONFIG=$(echo $OTTERSCAN_CONFIG)
echo "config=$OTTERSCAN_CONFIG" >> $GITHUB_OUTPUT
- name: Run Cypress tests on Anvil devnet
uses: cypress-io/github-action@v6
with:
start: |
sh ./scripts/run-anvil-devnet.sh
npm run start
# Cypress can't detect Anvil's RPC server, so we have to assume it is up
wait-on: "http://localhost:5173"
spec: "cypress/e2e/devnet/**/*.cy.ts,cypress/e2e/*.cy.ts"
tag: ${{needs.check-secrets.outputs.e2e-cypress-record-key == 'true' && 'anvil' || ''}}
record: |
${{needs.check-secrets.outputs.e2e-cypress-record-key == 'true' && 'true' || 'false'}}
env:
VITE_CONFIG_JSON: ${{steps.load-devnet-config.outputs.config}}
CYPRESS_RECORD_KEY: ${{secrets.E2E_CYPRESS_RECORD_KEY}}
CYPRESS_DEVNET_ERIGON_URL: "http://127.0.0.1:8545"
CYPRESS_DEVNET_SOURCIFY_SOURCE: "http://127.0.0.1:7077"
CYPRESS_DEVNET_ACCOUNT_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
- name: Upload screenshots from failing tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: Cypress Devnet Screenshots
path: cypress/screenshots