generated from lidofinance/lido-frontend-template
-
Notifications
You must be signed in to change notification settings - Fork 3
183 lines (159 loc) · 6.53 KB
/
tests-fork.yml
File metadata and controls
183 lines (159 loc) · 6.53 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
name: Forked Test CSM-widget
run-name: Forked CSM-widget Tests. Env [${{ github.event.inputs.stand_type || 'testnet' }}]
on:
schedule:
- cron: "0 6 * * *" # Every day at 6 AM UTC
workflow_dispatch:
inputs:
stand_type:
description: "Stand type"
required: true
type: choice
default: testnet
options:
- testnet
- preview
preview_stand_url:
description: 'Preview stand url (only if "Stand type" is "preview")'
required: false
type: string
preview_stand_env:
description: 'Preview stand env (only if "Stand type" is "preview")'
required: false
type: choice
default: testnet
options:
- testnet
- infra
jobs:
bootstrap:
name: Bootstrap environment
runs-on: ubuntu-latest
outputs:
cache-path: ${{ steps.cache.outputs.path }}
cache-key: ${{ steps.cache.outputs.key }}
env:
JUST_TAG: 1.24.0
steps:
- name: Build cache params
id: cache
run: |
echo "path=$CACHE_PATH" >> "$GITHUB_OUTPUT"
echo "$KEY_INPUT" | md5sum | awk '{print $1}' | xargs -I% echo "key=cargobin-%-${RUNNER_OS}" >> "$GITHUB_OUTPUT"
env:
CACHE_PATH: |
~/.cargo/bin/
KEY_INPUT: |
just:${{env.JUST_TAG}}
- uses: actions/cache@v5
id: get-cache
with:
path: ${{ steps.cache.outputs.path }}
key: ${{ steps.cache.outputs.key }}
- name: Install just
run: cargo install "just@$JUST_TAG"
if: steps.get-cache.outputs.cache-hit != 'true'
test:
runs-on: ubuntu-24.04
needs: bootstrap
env:
# Required envs
RPC_URL: ${{ secrets.RPC_URL }}
WALLET_SECRET_PHRASE: ${{ secrets.WALLET_SECRET_PHRASE }}
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD }}
EMPTY_SECRET_PHRASE: ${{ secrets.EMPTY_SECRET_PHRASE }}
EMPTY_NODE_SECRET_PHRASE: ${{ secrets.EMPTY_NODE_SECRET_PHRASE }}
STAND_TYPE: ${{ inputs.stand_type || github.event.inputs.STAND_TYPE || 'testnet' }}
# Common envs
QASE_API_TOKEN: ${{ secrets.QASE_API_TOKEN }}
QASE_PROJECT_ID: "CSM"
QASE_PLAN_ID: "8"
GH_ACTION_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GH_BRANCH_REF_NAME: ${{ github.ref_name }}
GH_EVENT_NAME: ${{ github.event_name }}
NODE_OPTIONS: --max-old-space-size=4096
TEST_TAGS: "forked"
TEST_BRANCH: ${{ github.event.inputs.branch }}
REPORT_ENABLED: "${{ github.event_name == 'schedule' && 'true' || 'false' }}"
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL}}
SLACK_DUTY_TAG: "S09H269H2TT"
# Optional envs
REFUSE_CF_BLOCK_NAME: ${{ secrets.REFUSE_CF_BLOCK_NAME }}
REFUSE_CF_BLOCK_VALUE: ${{ secrets.REFUSE_CF_BLOCK_VALUE }}
PUSHGATEWAY_URL: ${{ secrets.PUSHGATEWAY_URL }}
PUSHGATEWAY_USERNAME: ${{ secrets.PUSHGATEWAY_USERNAME }}
PUSHGATEWAY_PASSWORD: ${{ secrets.PUSHGATEWAY_PASSWORD }}
GRAFANA_URL: ${{ secrets.GRAFANA_URL }}
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }}
# Forked test envs
USE_FORK: true
DEPLOY_CONFIG: ./artifacts/hoodi/deploy-hoodi.json
CHAIN: hoodi
ARTIFACTS_DIR: ./artifacts/hoodi/
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
- name: Checkout community-staking-module
uses: actions/checkout@v4
with:
repository: lidofinance/community-staking-module
path: community-staking-module
ref: main
- uses: actions/cache@v5
with:
path: ${{ needs.bootstrap.outputs.cache-path }}
key: ${{ needs.bootstrap.outputs.cache-key }}
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: v1.2.3
- name: Restore yarn cache
uses: actions/cache@v5
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- name: Install CSM Contracts dependencies
run: |
cd community-staking-module && yarn install --immutable
- name: Build CSM Fork
run: cd community-staking-module && just deps && just build
- name: Install dependencies
run: yarn install --immutable
- name: Install Playwright Browsers
run: yarn playwright install chromium --with-deps
# - name: Download keys generator binary
# run: bash ./tests/scripts/set_up_keys_generator.sh
- name: Set up preview-stand credentials
if: ${{ inputs.stand_type == 'preview' || github.event.inputs.stand_type == 'preview' }}
run: |
if [ -n "${{ inputs.preview_stand_url || github.event.inputs.preview_stand_url }}" ]; then
echo "Setting login and password for preview stand"
echo "PREVIEW_STAND_LOGIN=${{ secrets.PREVIEW_STAND_LOGIN }}" >> $GITHUB_ENV
echo "PREVIEW_STAND_PASSWORD=${{ secrets.PREVIEW_STAND_PASSWORD }}" >> $GITHUB_ENV
echo "PREVIEW_STAND_URL=${{ inputs.preview_stand_url || github.event.inputs.preview_stand_url }}" >> $GITHUB_ENV
echo "PREVIEW_STAND_ENV=${{ github.event.inputs.preview_stand_env }}" >> $GITHUB_ENV
else
echo "PREVIEW_STAND_URL not provided for preview environment"
exit 1
fi
- name: Run tests based on suite input
run: |
echo -e "\033[34m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m"
echo -e "🚀 Running on Stand Type: \033[1;34m$STAND_TYPE\033[0m"
echo -e "🧪 Test Tags: \033[1;34m$TEST_TAGS\033[0m"
echo -e "🌱 Branch: \033[1;34m${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}\033[0m"
echo -e "🔗 Test Plan: \033[1;34m${QASE_PLAN_ID}\033[0m"
echo -e "\033[34m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m"
xvfb-run --auto-servernum -- yarn test:e2e
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 1