forked from lidofinance/csm-widget
-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (139 loc) · 5.65 KB
/
tests.yml
File metadata and controls
153 lines (139 loc) · 5.65 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
name: Test CSM-widget
run-name: 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:
- prod
- staging
- testnet
- preview
tags:
description: "Tags for running test suite"
required: false
type: choice
default: "-"
options:
- "-"
- smoke
- performTX
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
workflow_call:
inputs:
preview_stand_url:
required: true
type: string
description: Stand url
stand_type:
description: "Stand type"
required: true
type: string
tags:
required: false
type: string
default: "-"
description: "Test tags"
qase_plan_id:
required: false
type: number
description: "Qase Plan ID"
jobs:
test:
runs-on: ubuntu-24.04
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: "${{ inputs.qase_plan_id || (github.event_name == 'schedule' && 7) || '' }}"
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: ${{ inputs.tags || github.event.inputs.tags || '!forked'}}
TEST_BRANCH: ${{ github.event.inputs.branch }}
REPORT_ENABLED: "${{ github.event_name == 'schedule' && 'true' || 'false' }}"
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL}}
DISCORD_DUTY_TAG: "&1372906915667116032"
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 }}
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: Restore yarn cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- 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