From 5f67670ae8d3395337a285fac40efdfb2c3d38d4 Mon Sep 17 00:00:00 2001 From: Chukwuemeka-James <“official.chukwuemekajames@gmail.com”> Date: Thu, 21 Nov 2024 17:27:38 +0100 Subject: [PATCH 1/8] Added Web App workflow --- .github/workflows/wep_app_ci.yml | 59 ++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/wep_app_ci.yml diff --git a/.github/workflows/wep_app_ci.yml b/.github/workflows/wep_app_ci.yml new file mode 100644 index 00000000..fe42072d --- /dev/null +++ b/.github/workflows/wep_app_ci.yml @@ -0,0 +1,59 @@ +name: Web App CI Workflow + +on: [push, pull_request] + +jobs: + run_tests: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:16 + env: + POSTGRES_HOST_AUTH_METHOD: trust + ports: + - 5434:5432 + options: >- + --health-cmd "pg_isready -U postgres" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV + + - name: Install dependencies for Web App + working-directory: ./apps/web_app + run: | + echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV + poetry lock --no-update + poetry install + + - name: Run Tests for Web App + working-directory: ./apps/web_app + run: | + echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV + poetry run pytest + + - name: Install dependencies for Shared + working-directory: ./apps/shared + run: | + echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV + poetry lock --no-update + poetry install + + - name: Run Tests for Shared + working-directory: ./apps/shared + run: | + echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV + poetry run pytest From 0de4d66d38d75a158b70918d793404cb012596d6 Mon Sep 17 00:00:00 2001 From: Chukwuemeka-James <“official.chukwuemekajames@gmail.com”> Date: Thu, 21 Nov 2024 22:08:58 +0100 Subject: [PATCH 2/8] Added .env.test file --- apps/web_app/.env.test | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 apps/web_app/.env.test diff --git a/apps/web_app/.env.test b/apps/web_app/.env.test new file mode 100644 index 00000000..3a124b02 --- /dev/null +++ b/apps/web_app/.env.test @@ -0,0 +1,2 @@ +TELEGRAM_API_KEY=# +TELEGRAM_CHAT_ID= # From c7078e8749387ca5106c59db111f64643b387ba2 Mon Sep 17 00:00:00 2001 From: Chukwuemeka-James <“official.chukwuemekajames@gmail.com”> Date: Thu, 21 Nov 2024 23:02:54 +0100 Subject: [PATCH 3/8] feat: add env.test file --- apps/web_app/.env.test | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/web_app/.env.test b/apps/web_app/.env.test index 3a124b02..e171ccbf 100644 --- a/apps/web_app/.env.test +++ b/apps/web_app/.env.test @@ -1,2 +1,10 @@ -TELEGRAM_API_KEY=# -TELEGRAM_CHAT_ID= # +# DB connection +DB_NAME=# +DB_USER=# +DB_PASSWORD=# +DB_HOST=db +DB_PORT=# + +# Telegram credentials +TELEGRAM_API_KEY=# +TELEGRAM_CHAT_ID=# From be766049d8c80a40105113a65dc7c776d34710b5 Mon Sep 17 00:00:00 2001 From: Chukwuemeka-James <“official.chukwuemekajames@gmail.com”> Date: Fri, 22 Nov 2024 17:09:03 +0100 Subject: [PATCH 4/8] Added cp .env.test .env to webapp yml --- .github/workflows/wep_app_ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wep_app_ci.yml b/.github/workflows/wep_app_ci.yml index fe42072d..e74e86bb 100644 --- a/.github/workflows/wep_app_ci.yml +++ b/.github/workflows/wep_app_ci.yml @@ -43,8 +43,9 @@ jobs: working-directory: ./apps/web_app run: | echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV + cp .env.test .env poetry run pytest - + - name: Install dependencies for Shared working-directory: ./apps/shared run: | From 4ffb0f5c57ac76a63c4f91c2a3113f700d602067 Mon Sep 17 00:00:00 2001 From: Chukwuemeka-James <“official.chukwuemekajames@gmail.com”> Date: Fri, 22 Nov 2024 17:37:32 +0100 Subject: [PATCH 5/8] Added telegram token --- apps/web_app/.env.test | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/web_app/.env.test b/apps/web_app/.env.test index e171ccbf..1e433bab 100644 --- a/apps/web_app/.env.test +++ b/apps/web_app/.env.test @@ -8,3 +8,4 @@ DB_PORT=# # Telegram credentials TELEGRAM_API_KEY=# TELEGRAM_CHAT_ID=# +TELEGRAM_TOKEN=# your telegram bot token \ No newline at end of file From 148a55aaaeb86ec15761c66d3df12b80343f0e05 Mon Sep 17 00:00:00 2001 From: Chukwuemeka James Date: Sun, 24 Nov 2024 09:28:22 +0100 Subject: [PATCH 6/8] Updated Web_App_ci_replaced .env.test with .env.example --- .github/workflows/wep_app_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wep_app_ci.yml b/.github/workflows/wep_app_ci.yml index e74e86bb..2cf19105 100644 --- a/.github/workflows/wep_app_ci.yml +++ b/.github/workflows/wep_app_ci.yml @@ -43,7 +43,7 @@ jobs: working-directory: ./apps/web_app run: | echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV - cp .env.test .env + cp .env.example .env poetry run pytest - name: Install dependencies for Shared From 67398cd10559ad77088e36a910ffef4ba257cb51 Mon Sep 17 00:00:00 2001 From: Chukwuemeka-James <“official.chukwuemekajames@gmail.com”> Date: Sun, 24 Nov 2024 18:57:01 +0100 Subject: [PATCH 7/8] Updated web_app and .env.test --- .github/workflows/wep_app_ci.yml | 37 ++++++++++++++------------------ apps/web_app/.env.test | 11 +++++----- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/.github/workflows/wep_app_ci.yml b/.github/workflows/wep_app_ci.yml index 2cf19105..d1e18e1e 100644 --- a/.github/workflows/wep_app_ci.yml +++ b/.github/workflows/wep_app_ci.yml @@ -1,6 +1,12 @@ name: Web App CI Workflow -on: [push, pull_request] +on: + push: + branches: + - master + pull_request: + branches: + - master jobs: run_tests: @@ -30,31 +36,20 @@ jobs: - name: Install Poetry run: | curl -sSL https://install.python-poetry.org | python3 - - echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV + echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Install dependencies for Web App working-directory: ./apps/web_app - run: | - echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV - poetry lock --no-update - poetry install + run: poetry install - name: Run Tests for Web App working-directory: ./apps/web_app run: | - echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV - cp .env.example .env - poetry run pytest - - - name: Install dependencies for Shared - working-directory: ./apps/shared - run: | - echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV - poetry lock --no-update - poetry install + cp .env.test .env + poetry run pytest --junitxml=results.xml - - name: Run Tests for Shared - working-directory: ./apps/shared - run: | - echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV - poetry run pytest + - name: Upload Test Results + uses: actions/upload-artifact@v3 + with: + name: test-results + path: ./apps/web_app/results.xml diff --git a/apps/web_app/.env.test b/apps/web_app/.env.test index 1e433bab..82043795 100644 --- a/apps/web_app/.env.test +++ b/apps/web_app/.env.test @@ -1,11 +1,10 @@ -# DB connection DB_NAME=# DB_USER=# DB_PASSWORD=# DB_HOST=db DB_PORT=# - -# Telegram credentials -TELEGRAM_API_KEY=# -TELEGRAM_CHAT_ID=# -TELEGRAM_TOKEN=# your telegram bot token \ No newline at end of file +IP_INFO_TOKEN=# +TELEGRAM_TOKEN= # token telegram from botfather +REDIS_HOST=redis +REDIS_PORT=6379 +DATA_HANDLER_URL=# url to data handler \ No newline at end of file From 2e65c795cb2345314114c265f21098e84c49ee8f Mon Sep 17 00:00:00 2001 From: Chukwuemeka James Date: Mon, 25 Nov 2024 07:21:45 +0100 Subject: [PATCH 8/8] Update wep_app_ci.yml-- [dependency installation] --- .github/workflows/wep_app_ci.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/wep_app_ci.yml b/.github/workflows/wep_app_ci.yml index d1e18e1e..f564696c 100644 --- a/.github/workflows/wep_app_ci.yml +++ b/.github/workflows/wep_app_ci.yml @@ -17,7 +17,7 @@ jobs: env: POSTGRES_HOST_AUTH_METHOD: trust ports: - - 5434:5432 + - 5433:5432 options: >- --health-cmd "pg_isready -U postgres" --health-interval 10s @@ -38,11 +38,15 @@ jobs: curl -sSL https://install.python-poetry.org | python3 - echo "$HOME/.local/bin" >> $GITHUB_PATH - - name: Install dependencies for Web App + - name: Install dependencies for Web_App working-directory: ./apps/web_app - run: poetry install + run: | + echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV + poetry lock --no-update + poetry install + - - name: Run Tests for Web App + - name: Run Tests for Web_App working-directory: ./apps/web_app run: | cp .env.test .env