From 9615d42052ec3e1f08aa1810d6d2bd714771d8f8 Mon Sep 17 00:00:00 2001 From: Mamdouh Jaber <15077216+mjaber95@users.noreply.github.com> Date: Tue, 9 Jun 2026 16:03:41 -0400 Subject: [PATCH 01/12] changed app.py --- app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app.py b/app.py index 1df5df4..02cfd84 100644 --- a/app.py +++ b/app.py @@ -5,3 +5,4 @@ st.write(root()) st.write('This is obviously very simple, in reality one would rather use this page to display API results more nicely! :)') +st.write('This is obviously very simple, in reality one would rather use this page to display API results more nicely! :)') From 9a6272b94f6b3268962d9554e68d1a1f6f39f179 Mon Sep 17 00:00:00 2001 From: Mamdouh Jaber <15077216+mjaber95@users.noreply.github.com> Date: Tue, 9 Jun 2026 16:04:24 -0400 Subject: [PATCH 02/12] modified app.py --- app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app.py b/app.py index 02cfd84..f455786 100644 --- a/app.py +++ b/app.py @@ -6,3 +6,4 @@ st.write('This is obviously very simple, in reality one would rather use this page to display API results more nicely! :)') st.write('This is obviously very simple, in reality one would rather use this page to display API results more nicely! :)') +st.write('This is obviously very simple, in reality one would rather use this page to display API results more nicely! :)') From 735089f471fd34ecfdb5dda29495340907934f17 Mon Sep 17 00:00:00 2001 From: Mamdouh Jaber <15077216+mjaber95@users.noreply.github.com> Date: Wed, 10 Jun 2026 07:08:25 -0400 Subject: [PATCH 03/12] removed lines --- app.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/app.py b/app.py index f455786..1df5df4 100644 --- a/app.py +++ b/app.py @@ -5,5 +5,3 @@ st.write(root()) st.write('This is obviously very simple, in reality one would rather use this page to display API results more nicely! :)') -st.write('This is obviously very simple, in reality one would rather use this page to display API results more nicely! :)') -st.write('This is obviously very simple, in reality one would rather use this page to display API results more nicely! :)') From 52a08874e1d16f9a37880f0d05af6446c2ffdc9f Mon Sep 17 00:00:00 2001 From: Mamdouh Jaber <15077216+mjaber95@users.noreply.github.com> Date: Wed, 10 Jun 2026 07:48:25 -0400 Subject: [PATCH 04/12] testing this --- app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app.py b/app.py index 1df5df4..02cfd84 100644 --- a/app.py +++ b/app.py @@ -5,3 +5,4 @@ st.write(root()) st.write('This is obviously very simple, in reality one would rather use this page to display API results more nicely! :)') +st.write('This is obviously very simple, in reality one would rather use this page to display API results more nicely! :)') From 37a547b51d36cc12740962d2c03844b9ef327f44 Mon Sep 17 00:00:00 2001 From: Mamdouh Jaber <15077216+mjaber95@users.noreply.github.com> Date: Wed, 10 Jun 2026 07:52:32 -0400 Subject: [PATCH 05/12] modified yml files --- .github/workflows/python-ci-docker.yml | 44 +++++++++++++++++++++ .github/workflows/python-ci.yml | 53 ++++++++++---------------- 2 files changed, 64 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/python-ci-docker.yml diff --git a/.github/workflows/python-ci-docker.yml b/.github/workflows/python-ci-docker.yml new file mode 100644 index 0000000..427d56b --- /dev/null +++ b/.github/workflows/python-ci-docker.yml @@ -0,0 +1,44 @@ +# python-ci.yml +name: Test API on Push + +on: + push: + branches: [master, main] + pull_request: + branches: [master, main] + +jobs: + build-and-run-pytest: + runs-on: ubuntu-latest + + steps: + # 1. Checkout to the branch that triggered the event + - uses: actions/checkout@v3 + + # 2. Install python 3.10 + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: "3.10" + + # 3. Install python packages using a requirements file + - name: Install dependencies + run: | + python -m pip install --upgrade pip cython wheel + pip install -r tests/requirements.txt + + # 4. Build test image + - name: Build test Docker image + run: docker build -f tests/Dockerfile.test -t api-test . + + # 5. Run test container + - name: Run testing Container + run: docker run -d -e PORT=8000 --name api-test-container -p 8080:8000 api-test + + # 6. Run tests + - name: Run tests on API + run: make + + # Last step: Stop and remove container + - name: Stop API Container + run: docker stop api-test-container && docker rm api-test-container diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 8142826..b603aba 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -3,43 +3,30 @@ name: Test API on Push on: push: - branches: [ master, main ] + branches: [master, main] pull_request: - branches: [ master, main ] + branches: [master, main] jobs: build-and-run-pytest: - runs-on: ubuntu-latest steps: - # 1. Checkout to the branch that triggered the event - - uses: actions/checkout@v3 - - # 2. Install python 3.10 - - name: Set up Python 3.10 - uses: actions/setup-python@v2 - with: - python-version: "3.10" - - # 3. Install python packages using a requirements file - - name: Install dependencies - run: | - python -m pip install --upgrade pip cython wheel - pip install -r tests/requirements.txt - - # 4. Build test image - - name: Build test Docker image - run: docker build -f tests/Dockerfile.test -t api-test . - - # 5. Run test container - - name: Run testing Container - run: docker run -d -e PORT=8000 --name api-test-container -p 8080:8000 api-test - - # 6. Run tests - - name: Run tests on API - run: make - - # Last step: Stop and remove container - - name: Stop API Container - run: docker stop api-test-container && docker rm api-test-container + # 1. Checkout to the branch that triggered the event + - uses: actions/checkout@v3 + + # 2. Install python 3.10 + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: "3.10" + + # 3. Install python packages using a requirements file + - name: Install dependencies + run: | + python -m pip install --upgrade pip cython wheel + pip install -r tests/requirements.txt + + # 4. Run tests + - name: Run tests on API + run: make From 07a42f255401e149770e108e68613f87aee15ef9 Mon Sep 17 00:00:00 2001 From: Mamdouh Jaber <15077216+mjaber95@users.noreply.github.com> Date: Wed, 10 Jun 2026 07:53:18 -0400 Subject: [PATCH 06/12] edit --- .github/workflows/python-ci-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-ci-docker.yml b/.github/workflows/python-ci-docker.yml index 427d56b..a38c28f 100644 --- a/.github/workflows/python-ci-docker.yml +++ b/.github/workflows/python-ci-docker.yml @@ -1,5 +1,5 @@ # python-ci.yml -name: Test API on Push +name: Test API on Push with Docker on: push: From e80e94442d9aeb3c41c6dd58e637cff3fc137d31 Mon Sep 17 00:00:00 2001 From: Mamdouh Jaber <15077216+mjaber95@users.noreply.github.com> Date: Wed, 10 Jun 2026 07:56:46 -0400 Subject: [PATCH 07/12] changes --- Makefile | 13 ++++++++++++- app.py | 1 - 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1a00479..a010541 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,18 @@ +PROJECT := hip-voyager-421200 +IMAGE := test-app +REGION := europe-west1 +DOCKER_REPO_NAME := my-docker-repo +TAG := 0.1 + +IMAGE_URI := $(REGION)-docker.pkg.dev/$(PROJECT)/$(DOCKER_REPO_NAME)/$(IMAGE):$(TAG) + default: pylint pytest pylint: - find . -iname "*.py" -not -path "./tests/*" | xargs -n1 -I {} pylint --output-format=colorized {}; true + find . -iname "*.py" -not -path "./tests/*" | xargs -n1 -I {} pylint --output-format=colorized {}; true pytest: PYTHONDONTWRITEBYTECODE=1 pytest -v --color=yes + +print-image: + @echo $(IMAGE_URI) diff --git a/app.py b/app.py index 02cfd84..1df5df4 100644 --- a/app.py +++ b/app.py @@ -5,4 +5,3 @@ st.write(root()) st.write('This is obviously very simple, in reality one would rather use this page to display API results more nicely! :)') -st.write('This is obviously very simple, in reality one would rather use this page to display API results more nicely! :)') From adaa0f2f1ee3106785934e2e9f82ccbd5e38069d Mon Sep 17 00:00:00 2001 From: Mamdouh Jaber <15077216+mjaber95@users.noreply.github.com> Date: Wed, 10 Jun 2026 07:57:52 -0400 Subject: [PATCH 08/12] added english greeting --- api/fast.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/fast.py b/api/fast.py index dc3b65e..122de6b 100644 --- a/api/fast.py +++ b/api/fast.py @@ -17,7 +17,8 @@ def root(): response = { 'greeting': 'Servus, griaß di!', # This is a typical Bavarian greeting ;) - 'timestamp': datetime.now() + 'timestamp': datetime.now(), + 'greeting_english': "English" } return response From 263c8afe0c45c4ca663c208d42c706168b20a9ca Mon Sep 17 00:00:00 2001 From: Mamdouh Jaber <15077216+mjaber95@users.noreply.github.com> Date: Wed, 10 Jun 2026 08:00:24 -0400 Subject: [PATCH 09/12] removed english --- api/fast.py | 1 - 1 file changed, 1 deletion(-) diff --git a/api/fast.py b/api/fast.py index 122de6b..982359c 100644 --- a/api/fast.py +++ b/api/fast.py @@ -18,7 +18,6 @@ def root(): response = { 'greeting': 'Servus, griaß di!', # This is a typical Bavarian greeting ;) 'timestamp': datetime.now(), - 'greeting_english': "English" } return response From e79d656d772546fd9b485751dc0cbd0f460b818d Mon Sep 17 00:00:00 2001 From: Mamdouh Jaber <15077216+mjaber95@users.noreply.github.com> Date: Wed, 10 Jun 2026 08:02:11 -0400 Subject: [PATCH 10/12] added docker commands --- Makefile | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a010541..f2777b3 100644 --- a/Makefile +++ b/Makefile @@ -8,11 +8,32 @@ IMAGE_URI := $(REGION)-docker.pkg.dev/$(PROJECT)/$(DOCKER_REPO_NAME)/$(IMAGE):$( default: pylint pytest +# ------------------------- +# Python checks +# ------------------------- + pylint: - find . -iname "*.py" -not -path "./tests/*" | xargs -n1 -I {} pylint --output-format=colorized {}; true + find . -iname "*.py" -not -path "./tests/*" | xargs -n1 pylint --output-format=colorized; true pytest: PYTHONDONTWRITEBYTECODE=1 pytest -v --color=yes +# ------------------------- +# Docker +# ------------------------- + +build: + docker build --platform=linux/amd64 -t $(IMAGE_URI) . + +push: build + docker push $(IMAGE_URI) + +run: + docker run --rm -p 8080:8080 $(IMAGE_URI) + +# ------------------------- +# Debug helpers +# ------------------------- + print-image: @echo $(IMAGE_URI) From 06aaf698c8e6987ba9c10e3c7cc7e185c8e8ef65 Mon Sep 17 00:00:00 2001 From: Mamdouh Jaber <15077216+mjaber95@users.noreply.github.com> Date: Wed, 10 Jun 2026 08:38:50 -0400 Subject: [PATCH 11/12] removed --- tests/test_api_root.py | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 tests/test_api_root.py diff --git a/tests/test_api_root.py b/tests/test_api_root.py deleted file mode 100644 index 87bc7b3..0000000 --- a/tests/test_api_root.py +++ /dev/null @@ -1,17 +0,0 @@ -# pylint: disable-all - -import unittest -import requests -import time - -class TestApiRoot(unittest.TestCase): - def test_api_root(self): - # Adding a 15s sleep timer to ensure - # that the container has time to start up - time.sleep(15) - - # Call API and assign to a variable - url = 'http://localhost:8080' - result = requests.get(url).json() - - self.assertEqual(result['greeting'], 'Servus, griaß di!') From dfbaba90751eb82ca2ce3e839f855ebb5fec9e21 Mon Sep 17 00:00:00 2001 From: Mamdouh Jaber <15077216+mjaber95@users.noreply.github.com> Date: Wed, 10 Jun 2026 09:18:09 -0400 Subject: [PATCH 12/12] added german translation --- api/fast.py | 1 + 1 file changed, 1 insertion(+) diff --git a/api/fast.py b/api/fast.py index 982359c..5f49107 100644 --- a/api/fast.py +++ b/api/fast.py @@ -18,6 +18,7 @@ def root(): response = { 'greeting': 'Servus, griaß di!', # This is a typical Bavarian greeting ;) 'timestamp': datetime.now(), + 'greeting_german': "Servus, grüß Dich" } return response