From 7bcfafa9e05192b4182682a7e2fe9950f79cf8b0 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 3 Oct 2023 09:15:33 +0200 Subject: [PATCH] CI - add job to test fittrackee update with package --- .github/workflows/.tests-python.yml | 57 +++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/.github/workflows/.tests-python.yml b/.github/workflows/.tests-python.yml index 77aefb14..48262595 100644 --- a/.github/workflows/.tests-python.yml +++ b/.github/workflows/.tests-python.yml @@ -183,3 +183,60 @@ jobs: sleep 5 nohup flask worker --processes=1 >> nohup.out 2>&1 & pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444 + + end2end_package_update: + name: e2e tests after update + runs-on: ubuntu-latest + needs: ["python"] + container: python:3.11 + services: + postgres: + image: postgres:15 + env: + POSTGRES_DB: fittrackee_test + POSTGRES_USER: fittrackee + POSTGRES_PASSWORD: fittrackee + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + selenium: + image: selenium/standalone-firefox + mailhog: + image: mailhog/mailhog:latest + redis: + image: redis:latest + env: + APP_SETTINGS: fittrackee.config.End2EndTestingConfig + EMAIL_URL: "smtp://mailhog:1025" + REDIS_URL: "redis://redis:6379" + HOST: "0.0.0.0" + PORT: 5000 + steps: + - uses: actions/checkout@v3 + - name: Update pip and install build + run: python3 -m pip install --upgrade pip build + - name: Create and source virtual environment + run: | + python3 -m venv .venv + . .venv/bin/activate + - name: Install previous version of fittrackee from PyPI + run: python3 -m pip install fittrackee + - name: Run migrations + run: ftcli db upgrade + - name: Build fittrackee package + run: python3 -m build + - name: Install fittrackee package to update instance + run: python3 -m pip install dist/fittrackee-$(cat VERSION).tar.gz + - name: Run migrations to update database + run: ftcli db upgrade + - name: Install pytest and selenium + run: python3 -m pip install pytest==7.4.0 pytest-selenium==4.0.1 selenium==4.9.0 pytest-html==3.2.0 + - name: Start application and run tests with Selenium + run: | + setsid nohup fittrackee >> nohup.out 2>&1 & + export TEST_APP_URL=http://$(hostname --ip-address):5000 + sleep 5 + nohup flask worker --processes=1 >> nohup.out 2>&1 & + pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444 \ No newline at end of file