-
Notifications
You must be signed in to change notification settings - Fork 37
244 lines (211 loc) · 7.32 KB
/
e2e-test.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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
name: End to End Test
on:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)"
required: false
default: false
pull_request:
branches:
- main
concurrency:
group: '${{ github.workflow }} @ ${{ github.ref }}'
cancel-in-progress: true
env:
PYPI_RELEASE_VERSION: 100.0.0
RELEASE_VERSION: 0.0.0-dev
NEXUS_IMAGE: sonatype/nexus3:3.40.1
NEXUS_USER_NAME: admin
NEXUS_USER_PWD: admin123
PORT_NEXUS: 8081
PORT_NEXUS_DOCKER: 8083
IP_DOCKER_BRIDGE: 172.17.0.1
REPO_NAME_DOCKER: docker-hosted
REPO_NAME_PYPI: pypi-hosted
jobs:
filter:
runs-on: ubuntu-latest
outputs:
client: ${{ steps.filter.outputs.client }}
server: ${{ steps.filter.outputs.server }}
scripts: ${{ steps.filter.outputs.scripts }}
docker: ${{ steps.filter.outputs.docker }}
example: ${{ steps.filter.outputs.example }}
labels: ${{ steps.pr-labels.outputs.labels }}
server_api: ${{ steps.filter.outputs.server_api }}
steps:
- uses: actions/checkout@v3
- name: Get PR labels
id: pr-labels
uses: joerick/[email protected]
- name: Check for files changed
uses: getsentry/paths-filter@v2
id: filter
with:
base: main
filters: .github/file-filter.yml
e2e-test:
runs-on: ubuntu-latest
needs:
- filter
if: ${{ github.event_name == 'push'
|| github.event_name == 'workflow_dispatch'
|| (github.event_name == 'pull_request'
&& (needs.filter.outputs.client == 'true'
|| needs.filter.outputs.server == 'true'
|| needs.filter.outputs.scripts == 'true'
|| needs.filter.outputs.docker == 'true'
|| needs.filter.outputs.example == 'true'
)
&& contains(needs.filter.outputs.labels, 'e2e')
)
|| needs.filter.outputs.server_api == 'true' }}
defaults:
run:
shell: bash
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
server-driver:
- "docker-compose"
- "minikube"
exclude:
- python-version: "3.10"
server-driver: "docker-compose"
- python-version: "3.9"
server-driver: "docker-compose"
- python-version: "3.8"
server-driver: "minikube"
- python-version: "3.7"
server-driver: "minikube"
steps:
- uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v3
with:
python-version: ${{matrix.python-version}}
architecture: "x64"
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "adopt"
cache: "maven"
server-id: starwhale # Value of the distributionManagement/repository/id field of the pom.xml
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
# Github default free runner provides 14GB of disk space, we should release some useless files for workarounds.
- name: Release disk space
run: |
echo "cleanup useless files..."
df -hT
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"/{CodeQL,Ruby,go,node}
echo "cleanup done."
df -hT
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: Startup nexus service
working-directory: ./scripts/e2e_test
run: bash start_test.sh start_nexus &
- name: Startup minikube
uses: medyagh/setup-minikube@latest
id: minikube
with:
cache: true
driver: docker
container-runtime: docker
memory: 6G
cpus: 2
wait: false
insecure-registry: "192.0.0.0/8,10.0.0.0/8"
addons: ingress,ingress-dns
if: ${{ matrix.server-driver == 'minikube' }}
- name: Overwrite configs
working-directory: ./scripts/e2e_test
run: |
bash start_test.sh overwrite_pip_config
bash start_test.sh overwrite_pypirc
- name: Build Console(mock index.html)
working-directory: ./scripts/e2e_test
run: bash start_test.sh build_console
- name: Build server docker image
working-directory: ./scripts/e2e_test
run: |
[ "$SERVER_DRIVER" == "minikube" ] && eval $(minikube docker-env) || true
bash start_test.sh build_server_image
env:
SERVER_DRIVER: ${{ matrix.server-driver }}
- name: Build client python package
working-directory: ./scripts/e2e_test
run: bash start_test.sh build_swcli
env:
SKIP_UI_BUILD: 1
- name: Startup Starwhale Server
working-directory: ./scripts/e2e_test
run: bash start_test.sh start_starwhale
env:
SERVER_DRIVER: ${{ matrix.server-driver }}
- name: Check nexus service available
working-directory: ./scripts/e2e_test
run: |
bash start_test.sh create_service_check_file
bash start_test.sh check_nexus_service
- name: Prepare nexus repositories
working-directory: ./scripts/e2e_test
run: bash start_test.sh create_repository_in_nexus
- name: Upload pypi into nexus
working-directory: ./scripts/e2e_test
run: bash start_test.sh upload_pypi_to_nexus
- name: Setup minikube dns mock
working-directory: ./scripts/e2e_test
run: bash start_test.sh setup_minikube_dns_mock
if: ${{ matrix.server-driver == 'minikube' }}
- name: Wait and check Starwhale Server
working-directory: ./scripts/e2e_test
run: bash start_test.sh check_services_alive
env:
SERVER_DRIVER: ${{ matrix.server-driver }}
- name: Test OpenAPI model generating
working-directory: ./scripts/e2e_test
run: bash start_test.sh open_api_model_test
env:
SERVER_DRIVER: ${{ matrix.server-driver }}
- name: Test by client side
working-directory: ./scripts/e2e_test
run: bash start_test.sh client_test
env:
SKIP_UI_BUILD: 1
SERVER_DRIVER: ${{ matrix.server-driver }}
SW_IMAGE_REPO: "ghcr.io/star-whale"
- name: Post output client-side test logs
if: failure()
working-directory: ./scripts/e2e_test
run: |
bash start_test.sh show_logs
env:
SERVER_DRIVER: ${{ matrix.server-driver }}
- name: Test by api side
working-directory: ./scripts/e2e_test
run: bash start_test.sh api_test
env:
SERVER_DRIVER: ${{ matrix.server-driver }}