-
Notifications
You must be signed in to change notification settings - Fork 41
167 lines (152 loc) · 5.76 KB
/
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: E2E Tests
on:
pull_request:
branches-ignore:
- 'weblate-**'
workflow_dispatch:
inputs:
distinct_id:
description: 'for the return-dispatch action'
required: false
control-api:
description: 'custom control-api version'
data-api:
description: 'custom data-api version'
us:
description: 'custom us version'
ui:
description: 'custom ui version'
default: 'release'
env:
CONTROL_API_VERSION: ${{github.event.inputs.control-api}}
DATA_API_VERSION: ${{github.event.inputs.data-api}}
US_VERSION: ${{github.event.inputs.us}}
UI_VERSION: ${{github.event.inputs.ui}}
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
run-e2e:
name: Install Datalens and Run E2E Tests
runs-on: ubuntu-latest
steps:
- name: echo distinct ID ${{ github.event.inputs.distinct_id }}
run: echo ${{ github.event.inputs.distinct_id }}
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
cache-dependency-path: ./package-lock.json
- name: Get last version config
run: |
VERSION_CONFIG=$(curl -s https://api.github.com/repos/datalens-tech/datalens/contents/versions-config.json | jq -r '.content' | base64 -d)
if [ "${{ env.UI_VERSION }}" == "release" ]; then
UI_VERSION=$(echo "${VERSION_CONFIG}" | jq -r '.uiVersion')
echo "UI_VERSION=$UI_VERSION" >> "$GITHUB_ENV"
fi
if [ -z "${{ env.US_VERSION }}" ]; then
US_VERSION=$(echo "${VERSION_CONFIG}" | jq -r '.usVersion')
echo "US_VERSION=$US_VERSION" >> "$GITHUB_ENV"
fi
if [ -z "${{ env.CONTROL_API_VERSION }}" ]; then
CONTROL_API_VERSION=$(echo "${VERSION_CONFIG}" | jq -r '.controlApiVersion')
echo "CONTROL_API_VERSION=$CONTROL_API_VERSION" >> "$GITHUB_ENV"
fi
if [ -z "${{ env.DATA_API_VERSION }}" ]; then
DATA_API_VERSION=$(echo "${VERSION_CONFIG}" | jq -r '.dataApiVersion')
echo "DATA_API_VERSION=$DATA_API_VERSION" >> "$GITHUB_ENV"
fi
env:
US_VERSION: ${{ env.US_VERSION }}
CONTROL_API_VERSION: ${{ env.CONTROL_API_VERSION }}
DATA_API_VERSION: ${{ env.DATA_API_VERSION }}
UI_VERSION: ${{ env.UI_VERSION }}
- name: Check docker compose Config
run: npm run test:e2e:docker:check
env:
US_VERSION: ${{ env.US_VERSION }}
CONTROL_API_VERSION: ${{ env.CONTROL_API_VERSION }}
DATA_API_VERSION: ${{ env.DATA_API_VERSION }}
UI_VERSION: ${{ env.UI_VERSION }}
- name: Build docker ui image with cache
if: ${{ env.UI_VERSION == '' }}
uses: docker/[email protected]
with:
network: host
context: .
push: false
load: true
tags: e2e-datalens-ui:pr
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Up docker compose and install local deps for test
if: ${{ env.UI_VERSION == '' }}
run: |
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
npm run test:e2e:docker:up-no-build && npm ci && npm run test:install:chromium & wait
env:
US_VERSION: ${{ env.US_VERSION }}
CONTROL_API_VERSION: ${{ env.CONTROL_API_VERSION }}
DATA_API_VERSION: ${{ env.DATA_API_VERSION }}
- name: Run tests local from repo
if: ${{ env.UI_VERSION == '' }}
run: npm run test:e2e:opensource
env:
NO_AUTH: true
E2E_RETRY_TIMES: 1
E2E_TEST_TIMEOUT: 90000
E2E_ACTION_TIMEOUT: 10000
E2E_EXPECT_TIMEOUT: 10000
E2E_DOMAIN: http://localhost:8080
- name: Run tests from builded docker image
if: ${{ env.UI_VERSION != '' }}
run: |
npm run test:e2e:docker
env:
US_VERSION: ${{ env.US_VERSION }}
CONTROL_API_VERSION: ${{ env.CONTROL_API_VERSION }}
DATA_API_VERSION: ${{ env.DATA_API_VERSION }}
UI_VERSION: ${{ env.UI_VERSION }}
E2E_RETRY_TIMES: 1
E2E_TEST_TIMEOUT: 90000
E2E_ACTION_TIMEOUT: 10000
E2E_EXPECT_TIMEOUT: 10000
- name: Copy tests report from docker run
if: always()
run: |
if [ -z "${{ env.UI_VERSION }}" ]; then
echo "skip export report from docker run..."
else
echo "export report from docker run"
rm -rf ./tests/artifacts
npm run test:e2e:docker:report
fi
env:
US_VERSION: ${{ env.US_VERSION }}
CONTROL_API_VERSION: ${{ env.CONTROL_API_VERSION }}
DATA_API_VERSION: ${{ env.DATA_API_VERSION }}
UI_VERSION: ${{ env.UI_VERSION }}
- name: Run docker compose down
if: always()
run: |
npm run test:e2e:docker:down
env:
US_VERSION: ${{ env.US_VERSION }}
CONTROL_API_VERSION: ${{ env.CONTROL_API_VERSION }}
DATA_API_VERSION: ${{ env.DATA_API_VERSION }}
UI_VERSION: ${{ env.UI_VERSION }}
- name: Save report link and pr number
if: always()
run: |
mkdir -p ./tests/artifacts
echo "reports/${{ github.head_ref || github.ref_name }}/${{ github.run_id }}/${{ github.run_attempt }}" > ./tests/artifacts/report-link
echo "${{ github.event.pull_request.number }}" > ./tests/artifacts/report-pr
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: ./tests/artifacts/
retention-days: 30