-
Notifications
You must be signed in to change notification settings - Fork 3
Guide: Replicating the github actions locally for debugging
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.
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 ubuntu:latest /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.
Execute these lines one by one.
cd ddueruem-web/frontend
apt update && apt upgrade
apt install sudo
sudo apt-get update
sudo apt-get install python3.10
sudo apt install python3-pip
Execute these lines one by one.
cp '../backend/ddueruemweb/.env.testing' '../backend/ddueruemweb/.env'
cd ../backend
pip install -r requirements.txt
python3.10 manage.py makemigrations
python3.10 manage.py migrate --run-syncdb
python3.10 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
Execute these lines one by one.
sudo apt install npm
npm install -g serve
npm run serve // do this in extra shell
apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
npm run cypress:open // -> leads to an error on windows... possible solution: https://shouv.medium.com/how-to-run-cypress-on-wsl2-989b83795fb6