From f6b867f076ed985739f8efbee584a2ab3bd8e8ac Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 14 Jul 2023 17:29:29 +0200 Subject: [PATCH] CI - test packaged version of fittrackee --- .github/workflows/.tests-python.yml | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/.github/workflows/.tests-python.yml b/.github/workflows/.tests-python.yml index 7f701496..6c1dc844 100644 --- a/.github/workflows/.tests-python.yml +++ b/.github/workflows/.tests-python.yml @@ -129,3 +129,55 @@ 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: + runs-on: ubuntu-latest + needs: ["python"] + container: python:3.10 + services: + postgres: + image: postgres:14 + 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@v2 + - 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: Build fittrackee package + run: python3 -m build + - name: Install fittrackee package + run: python3 -m pip install dist/fittrackee-$(cat VERSION).tar.gz + - name: Run migrations + 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 + - 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