Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Guide: Replicating the github actions locally for debugging

Bishares edited this page Jan 27, 2023 · 13 revisions

The issue with debugging github actions

It is sometimes tricky to debug github actions via the web interface. There is no (easy) way to access the ubuntu docker container while the actions are running.

Some tools have been developed to solve this issue. Example solutions are:

However it is also possible to simpy set up a local ubuntu container with the same configurations as the remote Github container and debug the issue that way. This guide will cover this solution.

Setting up a local cypress docker container

Execute these lines one by one.

docker run --rm -it --name github_simulation -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/PycharmProjects/ddueruem-web:/ddueruem-web -d cypress/browsers:chrome69 /bin/bash
docker exec -u root -t -i github_simulation /bin/bash

This should create a container with name github_simulation and also mount the directory ../ddueruem-web into the directory ./ddueruem-web. It will also mount your real docker environment into the container (allows to use docker inside of the container). You will then enter the container as root user.

installing all the stuff in the container

Execute these lines one by one.

apt update && apt upgrade
apt install sudo
sudo apt-get update
sudo apt install python3.9
sudo apt install python3-pip

Setting up the server

Execute these lines one by one.

File copying and requirements installation

cp 'ddueruem-web/backend/ddueruemweb/.env.testing' 'ddueruem-web/backend/ddueruemweb/.env'
cd ddueruem-web/backend
pip3 install -r requirements.txt

Running Django migrations

python3.9 manage.py makemigrations
python3.9 manage.py migrate --run-syncdb
python3.9 manage.py runserver // do this in extra shell (open new shell with `docker exec -u root -t -i github_simulation /bin/bash`) so you can still type in your original shell

Setting up the frontend

Installing npm dependencies and running the frontend

Execute these lines one by one.

sudo apt install npm
cd ../frontend
npm install -g serve 
npm run serve // do this in extra shell

Special Cypress preparation if you are on Windows WSL and want to use Cypress GUI

Windows 11 Build 22000 or later

Follow this guide: https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps

Before Windows 11 Build 22000

Follow this guide: https://shouv.medium.com/how-to-run-cypress-on-wsl2-989b83795fb6

  1. Install VcXsrc as described in the guide

  2. Configure the .bashrc of the linux container:

install nano or any other texteditor

sudo apt install nano

Move into the /home directory of the linux container and make sure there is a .bashrc file

ls -la ~/ | more

Edit the .bashrc file via nano ~/.bashrc

Also do the other steps of the guide.

Running Cypress

To run cypress without GUI execute

npm run env -- cypress run

To run it with GUI execute (NEED TO FOLLOW GUIDE ABOVE!):

npm run cypress:open // -> leads to an error on my machine: https://github.com/intel/libva/issues/278