SS-889 App image docker hub autosuggestion (#281) #525
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/workflow-telemetry-action@v1.8.0 | |
- 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/microk8s-actions@v0.4.2 | |
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/http-status-code@1.0.0 | |
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@v4 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |
- name: Save cypress video artifacts on failure | |
uses: actions/upload-artifact@v4 | |
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 |