-
Notifications
You must be signed in to change notification settings - Fork 3
272 lines (238 loc) · 8.96 KB
/
integration-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
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
name: Integration Tests
concurrency:
group: inttests-${{ github.repository }}
on:
push:
branches:
- master
workflow_dispatch:
inputs:
slate-client-server-branch:
description: 'Branch under test (slate-client-server)'
required: false
default: master
type: string
slate-portal-branch:
description: 'Branch under test (slate-portal):'
required: false
default: master
type: string
slate-client-version:
description: 'Version of the SLATE client to use (e.g. 1.2.3):'
required: false
default: latest
type: string
kubernetes-version:
description: 'Version of Kubernetes to use (e.g. 1.24.9):'
required: false
default: '1.24.9'
type: string
env:
HELM_SECRETS_BACKEND: vals
MINIKUBE_VERSION: "1.30.1"
PYTHON_VERSION: '3.10.7'
SLATE_API_TOKEN: "12345A6A-AAA2-1234-A1A1-123A123A1234"
jobs:
workflow-inputs:
name: Display Workflow Inputs
runs-on: ubuntu-22.04
if: github.event.inputs != ''
steps:
- name: Output inputs
run: |-
echo "## Workflow inputs" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "${{ toJSON(github.event.inputs) }}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
test:
name: Test
runs-on: ubuntu-22.04
services:
chrome:
image: selenium/standalone-chrome:latest
permissions:
contents: read
id-token: write
steps:
- name: Check out slate-client-server repo
if: ${{ github.event.inputs.slate-client-server-branch == '' }}
uses: actions/checkout@v4
with:
fetch-depth: 1
path: ./slate-client-server
ref: refs/heads/master
repository: slateci/slate-client-server
- name: Check out specific branch of slate-client-server repo
if: ${{ github.event.inputs.slate-client-server-branch != '' }}
uses: actions/checkout@v4
with:
fetch-depth: 1
path: ./slate-client-server
ref: ${{ github.event.inputs.slate-client-server-branch }}
repository: slateci/slate-client-server
- name: Check out slate-portal repo
if: ${{ github.event.inputs.slate-portal-branch == '' }}
uses: actions/checkout@v4
with:
fetch-depth: 1
path: ./slate-portal
ref: refs/heads/master
repository: slateci/slate-portal
- name: Check out specific branch of slate-portal repo
if: ${{ github.event.inputs.slate-portal-branch != '' }}
uses: actions/checkout@v4
with:
fetch-depth: 1
path: ./slate-portal
ref: ${{ github.event.inputs.slate-portal-branch }}
repository: slateci/slate-portal
- name: Set Up Tools
uses: slateci/github-actions/.github/actions/gcloud-helm-setup-lite@v17
with:
service_account: ${{ secrets.GCLOUD_SERVICE_ACCOUNT }}
workload_identity_provider: ${{ secrets.GCLOUD_WORKLOAD_IDENTITY_PROVIDER }}
- name: Create Minikube Cluster
if: ${{ github.event.inputs.kubernetes-version == '' }}
uses: medyagh/setup-minikube@master
with:
minikube-version: ${{ env.MINIKUBE_VERSION }}
driver: docker
container-runtime: containerd
kubernetes-version: "v1.24.9"
cni: calico
- name: Create Minikube Cluster
if: ${{ github.event.inputs.kubernetes-version != '' }}
uses: medyagh/setup-minikube@master
with:
minikube-version: ${{ env.MINIKUBE_VERSION }}
driver: docker
container-runtime: containerd
kubernetes-version: "v${{ github.event.inputs.kubernetes-version }}"
cni: calico
- name: Set up local namespace
working-directory: .
run: |-
minikube kubectl create namespace local
echo "MINIKUBE_IP=$(minikube ip)" >> $GITHUB_ENV
- name: Install the local Slate Client Server Helm chart
working-directory: ./slate-client-server/resources/chart
run: |-
helm secrets install slate-api-local . \
-f ./vars/secrets.yml \
-f ./vars/values.yml \
-f ./vars/local/secrets.yml \
-f ./vars/local/values.yml \
--set-string apiToken=${{ env.SLATE_API_TOKEN }} \
--set-string bootstrapUserFileAccessToken=${{ env.SLATE_API_TOKEN }} \
-n local
- name: Install the local Slate Portal Helm chart
working-directory: ./slate-portal/resources/chart
run: |-
helm secrets install slate-portal-local . \
-f ./vars/secrets.yml \
-f ./vars/values.yml \
-f ./vars/local/secrets.yml \
-f ./vars/local/values.yml \
--set-string apiToken=${{ env.SLATE_API_TOKEN }} \
--set-string portalEndpoint=${{ env.MINIKUBE_IP }}:30008 \
-n local
- name: Gather details for Minikube services
working-directory: .
run: |-
echo "SLATE_API_ENDPOINT=$(minikube service slate-api-local-service --url --namespace local)" >> $GITHUB_ENV
echo "SLATE_PORTAL_ENDPOINT=$(minikube service slate-portal-local-service --url --namespace local)" >> $GITHUB_ENV
- name: Check out portal-unit-test repo
uses: actions/checkout@v4
with:
fetch-depth: 1
path: ./portal-unit-test
ref: refs/heads/master
repository: slateci/portal-unit-test
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: 'x64'
- name: Install Selenium Python Bindings
working-directory: .
run: |-
pip install -U selenium
- name: Install the SLATE client
working-directory: .
run: |-
mkdir ./slate-client
cd ./slate-client
# Script variables:
GITHUB_RELEASES_URL="https://github.com/slateci/slate-client-server/releases"
if [[ "${{ github.event.inputs.slate-client-version }}" == "" ]]
then
SLATE_CLIENT_VERSION="latest"
else
SLATE_CLIENT_VERSION="${{ github.event.inputs.slate-client-version }}"
fi
echo "Downloading SLATE client version: \"$SLATE_CLIENT_VERSION\"..."
if [[ $SLATE_CLIENT_VERSION == "latest" ]]
then
curl -fsSL "${GITHUB_RELEASES_URL}/latest/download/slate-linux.tar.gz" -o slate-linux.tar.gz
curl -fsSL "${GITHUB_RELEASES_URL}/latest/download/slate-linux.sha256" -o slate-linux.sha256
else
curl -fsSL "${GITHUB_RELEASES_URL}/download/v$SLATE_CLIENT_VERSION/slate-linux.tar.gz" -o slate-linux.tar.gz
curl -fsSL "${GITHUB_RELEASES_URL}/download/v$SLATE_CLIENT_VERSION/slate-linux.sha256" -o slate-linux.sha256
fi
echo "Verifying download..."
sha256sum -c slate-linux.sha256 || exit 1
echo "Adding SLATE client to path..."
tar xzvf slate-linux.tar.gz
echo "${{ github.workspace }}/slate-client" >> $GITHUB_PATH
- name: Await pods
uses: jupyterhub/action-k8s-await-workloads@v3
with:
workloads: "" # all
namespace: local
timeout: 300
max-restarts: 1
- name: Kubernetes namespace report
uses: jupyterhub/action-k8s-namespace-report@v1
if: always()
with:
namespace: local
- name: Verify Portal landing page is being served
working-directory: .
run: |-
curl ${{ env.SLATE_PORTAL_ENDPOINT }}/slate_portal
- name: Test connection to the API server
working-directory: .
run: |-
mkdir /home/runner/.slate
echo ${{ env.SLATE_API_TOKEN }} >> /home/runner/.slate/token
chmod 600 /home/runner/.slate/token
echo "=================================="
echo "= Connection Information ="
echo "=================================="
echo Endpoint: $(echo "$SLATE_API_ENDPOINT")
echo ""
echo "$(slate whoami 2>&1 | head -n 2)"
echo ""
slate version
echo ""
echo ""
- name: Seed test data
working-directory: .
run: |-
slate group create my-group --field 'Resource Provider'
slate cluster create my-cluster --group my-group --org SLATE --no-ingress -y
- name: Run Selenium tests
working-directory: ./portal-unit-test
run: |-
python main.py ${{ env.SLATE_PORTAL_ENDPOINT }}
notifications:
name: Notifications
runs-on: ubuntu-22.04
needs:
- test
if: ${{ always() && (needs.test.result == 'failure') }}
steps:
- name: Notify Slack of Failure
uses: slateci/github-actions/.github/actions/slack-notify-failure@v17
with:
slack_bot_token: '${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}'