SetUp Sample Tracking Tool and Run Selenium Tests #11
This file contains hidden or 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: Docker Compose + Install Software + Lint Python + Run Selenium Tests | |
| run-name: SetUp Sample Tracking Tool and Run Selenium Tests | |
| on: | |
| push: | |
| branches: [ "main"] | |
| pull_request: | |
| branches: [ "main" ] | |
| permissions: write-all | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Delete migration files and create __init__.py | |
| run: | | |
| rm backend/gui/migrations/* | |
| touch backend/gui/migrations/__init__.py | |
| - name: Docker Compose | |
| run: docker compose -f docker-compose-actions.yml -f docker-compose-develop.yml up --remove-orphans --force-recreate -d | |
| - name: Install firefox | |
| uses: browser-actions/setup-firefox@v1 | |
| - name: Install geckodriver | |
| run: | | |
| wget https://github.com/mozilla/geckodriver/releases/download/v0.36.0/geckodriver-v0.36.0-linux32.tar.gz | |
| tar -xvzf geckodriver* | |
| chmod +x geckodriver | |
| export PATH=$PATH:./geckodriver | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install flake8 pytest | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Create users in docker container | |
| run: | | |
| docker exec saturn3-sample-tracking-saturn3sample-django-1 bash -c " | |
| export DJANGO_SUPERUSER_PASSWORD=root | |
| export DJANGO_SUPERUSER_USERNAME=root | |
| export DJANGO_SUPERUSER_EMAIL=test.lol@testomail.de | |
| python3 manage.py createsuperuser --noinput | |
| python3 manage.py shell < ./backend/gui/selenium/create_test_users.py | |
| " | |
| - name: Lint with flake8 | |
| run: | | |
| # stop the build if there are Python syntax errors or undefined names | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| - name: Test with pytest | |
| run: | | |
| pytest -s --ignore=./pg_data | |
| - name: Upload geckodriver log | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: geckodriver-log | |
| path: geckodriver.log | |
| - name: Upload Screenshot | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: screenie | |
| path: screenie.png |