-
Notifications
You must be signed in to change notification settings - Fork 1
150 lines (132 loc) · 4.5 KB
/
e2e-tests.yaml
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
name: E2E-tests
on:
push:
branches:
- develop
paths-ignore:
- '**.md'
# Adds ability to run this workflow manually
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Manual run'
required: false
type: boolean
jobs:
e2e:
if: github.repository == 'scilifelabdatacentre/serve'
runs-on: ubuntu-20.04
env:
working-directory: .
steps:
- name: Workflow Telemetry
uses: runforesight/[email protected]
- name: Branch or tag that triggered the workflow run
run: |
echo "Running on branch ${GITHUB_REF##*/}"
echo "Running as UID: $UID, GID: $GID"
whoami
- name: Checkout code
uses: actions/checkout@v4
- name: Prepare repository
run: |
echo "Running as UID: $UID, GID: $GID"
export GID=127
echo "Now running as UID: $UID, GID: $GID"
whoami
pwd
mv .env.template .env
sudo chgrp -R 127 media
sudo chmod -R g+rwx media
ls -al
sed -i 's/UID=1000/UID=1001/g' .env
sed -i 's/GID=1000/GID=127/g' .env
- name: A job to install MicroK8s
uses: balchua/[email protected]
with:
channel: '1.28/stable'
addons: '["dns", "rbac", "hostpath-storage", "ingress", "helm"]'
- name: Test and config MicroK8s
run: |
kubectl get no
kubectl get pods -A -o wide
echo "Running usermod to add ${USER} to microk8s group"
sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube
sudo microk8s config >> ~/.kube/config
helm
- name: Dump config
working-directory: ${{env.working-directory}}
run: |
sudo microk8s config > cluster.conf
ls -la
cat cluster.conf
- name: Start serve
working-directory: ${{env.working-directory}}
id: setup
run: |
set -ex
echo "Deploying serve"
docker compose up -d --build
- name: Set Serve URL
working-directory: ${{env.working-directory}}
run: |
curl --version | head -n 1
STUDIO_URL=http://studio.127.0.0.1.nip.io:8080
echo "STUDIO_URL=$STUDIO_URL" >> $GITHUB_ENV
echo "The Serve URL is $STUDIO_URL"
- name: Check URL is up
uses: gerdemann/[email protected]
with:
url: ${{ env.STUDIO_URL }}
code: 200 # http status code
timeout: 120 # seconds
interval: 5 # seconds
continue-on-error: true
- name: Check if Serve is ready
working-directory: ${{env.working-directory}}
id: check_serve_up
run: |
echo "Checking response from STUDIO_URL: ${{ env.STUDIO_URL }}"
response=$(curl --write-out '%{http_code}' --silent --output /dev/null ${{ env.STUDIO_URL }})
if [[ "$response" -ne 200 ]] ; then echo "status $response" && sleep 30; else echo "serve is ready"; fi
- name: Check if celery worker can access kubectl and helm
run: |
docker exec celery-worker kubectl version
docker exec celery-worker helm version
- name: Cypress run e2e tests
uses: cypress-io/github-action@v6
with:
working-directory: ${{env.working-directory}}
config: pageLoadTimeout=100000,baseUrl=${{ env.STUDIO_URL }}
quiet: true
- name: Save cypress screenshot artifacts on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
- name: Save cypress video artifacts on failure
uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-videos
path: cypress/videos
- name: Setup upterm session
uses: lhotari/action-upterm@v1
with:
## If no one connects after 2 minutes, shut down server.
wait-timeout-minutes: 2
## limits ssh access and adds the ssh public key for the user which triggered the workflow
limit-access-to-actor: true
## limits ssh access and adds the ssh public keys of the listed GitHub users
limit-access-to-users: churnikov,hamzaimran08,alfredeen,akochari,anondo1969