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 01/10] 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 02/10] 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 03/10] 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 04/10] 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 05/10] 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 06/10] 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 07/10] 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 08/10] 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 From 3d6f8c7cc6d14652d5e714dfd16b18d9e11f2bcf Mon Sep 17 00:00:00 2001 From: djeck1432 Date: Tue, 26 Nov 2024 15:32:09 +0100 Subject: [PATCH 09/10] fix test cases --- .../handler_tools/data_parser/serializers/zklend.py | 2 -- apps/data_handler/tests/test_zklend_transformer.py | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/data_handler/handler_tools/data_parser/serializers/zklend.py b/apps/data_handler/handler_tools/data_parser/serializers/zklend.py index 9a732991..b5f492c9 100644 --- a/apps/data_handler/handler_tools/data_parser/serializers/zklend.py +++ b/apps/data_handler/handler_tools/data_parser/serializers/zklend.py @@ -181,9 +181,7 @@ class CollateralEnabledDisabledEventData(BaseModel): Attributes: user: The user address for whom collateral is being enabled/disabled. token: The token address being enabled/disabled as collateral. - enabled: Boolean indicating if collateral is being enabled (True) or disabled (False). """ user: str token: str - enabled: bool diff --git a/apps/data_handler/tests/test_zklend_transformer.py b/apps/data_handler/tests/test_zklend_transformer.py index 29b6258c..02b8dbed 100644 --- a/apps/data_handler/tests/test_zklend_transformer.py +++ b/apps/data_handler/tests/test_zklend_transformer.py @@ -376,10 +376,9 @@ def test_save_collateral_enabled_event(transformer, sample_collateral_enabled_ev Test saving a collateral enabled event. """ transformer.api_connector.get_data.return_value = [sample_collateral_enabled_event_data] - expected_parsed_data = CollateralEnabledDisabledEventData( user=sample_collateral_enabled_event_data['data'][0], - token=sample_collateral_enabled_event_data['data'][1] + token=sample_collateral_enabled_event_data['data'][1], ) transformer.fetch_and_transform_events( From e699ae97d4040654094356f1689da021d53fa4c1 Mon Sep 17 00:00:00 2001 From: djeck1432 Date: Tue, 26 Nov 2024 15:44:25 +0100 Subject: [PATCH 10/10] fix pipeline --- .github/workflows/ci.yml | 8 +------- .github/workflows/pylint.yml | 8 +------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72563426..33c3193e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,6 @@ name: CI Workflow -on: - push: - branches: - - master - pull_request: - branches: - - master +on: [push, pull_request] jobs: diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index dd642dd9..598f8a6b 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -1,12 +1,6 @@ name: Pylint Check -on: - push: - branches: - - master - pull_request: - branches: - - master +on: [push, pull_request] jobs: lint: