From b091c9ef98d0fd060778350eb06ed3969d1f3503 Mon Sep 17 00:00:00 2001 From: Arya Patil <81981954+ShutterStack@users.noreply.github.com> Date: Thu, 29 May 2025 15:48:51 +0530 Subject: [PATCH 1/3] compatible change --- makefile | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/makefile b/makefile index cebf7c5..39cc1f3 100644 --- a/makefile +++ b/makefile @@ -37,7 +37,7 @@ push: ## ๐Ÿ“ค Push container image to registry docker push $(IMAGE_REG)/$(IMAGE_REPO):$(IMAGE_TAG) run: venv ## ๐Ÿƒ Run the server locally using Python & Flask - . $(SRC_DIR)/.venv/bin/activate \ + call $(SRC_DIR)\.venv\Scripts\activate.bat \ && python src/run.py deploy: ## ๐Ÿš€ Deploy to Azure Web App @@ -53,12 +53,10 @@ undeploy: ## ๐Ÿ’€ Remove from Azure az group delete -n $(AZURE_RES_GROUP) -o table --no-wait test: venv ## ๐ŸŽฏ Unit tests for Flask app - . $(SRC_DIR)/.venv/bin/activate \ - && pytest -v + call $(SRC_DIR)\.venv\Scripts\activate.bat && pytest -v test-report: venv ## ๐ŸŽฏ Unit tests for Flask app (with report output) - . $(SRC_DIR)/.venv/bin/activate \ - && pytest -v --junitxml=test-results.xml + call $(SRC_DIR)\.venv\Scripts\activate.bat && pytest -v --junitxml=test-results.xml test-api: .EXPORT_ALL_VARIABLES ## ๐Ÿšฆ Run integration API tests, server must be running cd tests \ @@ -66,20 +64,21 @@ test-api: .EXPORT_ALL_VARIABLES ## ๐Ÿšฆ Run integration API tests, server must && ./node_modules/.bin/newman run ./postman_collection.json --env-var apphost=$(TEST_HOST) clean: ## ๐Ÿงน Clean up project - rm -rf $(SRC_DIR)/.venv - rm -rf tests/node_modules - rm -rf tests/package* - rm -rf test-results.xml - rm -rf $(SRC_DIR)/app/__pycache__ - rm -rf $(SRC_DIR)/app/tests/__pycache__ - rm -rf .pytest_cache - rm -rf $(SRC_DIR)/.pytest_cache + if exist "$(SRC_DIR)\.venv" rd /s /q "$(SRC_DIR)\.venv" + if exist "tests\node_modules" rd /s /q "tests\node_modules" + if exist "tests\package*" del /f /q "tests\package*" + if exist "test-results.xml" del /f /q "test-results.xml" + if exist "$(SRC_DIR)\app\__pycache__" rd /s /q "$(SRC_DIR)\app\__pycache__" + if exist "$(SRC_DIR)\app\tests\__pycache__" rd /s /q "$(SRC_DIR)\app\tests\__pycache__" + if exist ".pytest_cache" rd /s /q ".pytest_cache" + if exist "$(SRC_DIR)\.pytest_cache" rd /s /q "$(SRC_DIR)\.pytest_cache" # ============================================================================ venv: $(SRC_DIR)/.venv/touchfile $(SRC_DIR)/.venv/touchfile: $(SRC_DIR)/requirements.txt - python3 -m venv $(SRC_DIR)/.venv - . $(SRC_DIR)/.venv/bin/activate; pip install -Ur $(SRC_DIR)/requirements.txt - touch $(SRC_DIR)/.venv/touchfile + python -m venv $(SRC_DIR)/.venv + call $(SRC_DIR)\.venv\Scripts\activate.bat && python -m pip install --upgrade pip + call $(SRC_DIR)\.venv\Scripts\activate.bat && pip install -Ur $(SRC_DIR)/requirements.txt + type nul > $(SRC_DIR)/.venv/touchfile From 814d8bced4a3216276c92599d80b29632853b4b1 Mon Sep 17 00:00:00 2001 From: Arya Patil <81981954+ShutterStack@users.noreply.github.com> Date: Thu, 29 May 2025 15:49:39 +0530 Subject: [PATCH 2/3] updated requriements --- src/requirements.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/requirements.txt b/src/requirements.txt index de4fe88..c97dc09 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -1,7 +1,8 @@ -Flask==1.1.2 -py-cpuinfo==7.0.0 -psutil==5.8.0 +Flask==2.0.1 +Werkzeug==2.0.3 gunicorn==20.1.0 -black==20.8b1 -flake8==3.9.0 -pytest==6.2.2 \ No newline at end of file +py-cpuinfo==9.0.0 # Updated to latest version for better Python 3.10 support +psutil==6.1.0 # Updated to latest version, supports PEP 517 +black==24.8.0 # Updated to latest version for Python 3.10 compatibility +flake8==7.1.1 # Updated to latest version +pytest==7.4.4 # Pinned to a stable version >=7.0.0 From 44baf11db616b4aa9d51552ade4f6eaa22a69d41 Mon Sep 17 00:00:00 2001 From: Arya Patil <81981954+ShutterStack@users.noreply.github.com> Date: Thu, 29 May 2025 15:52:30 +0530 Subject: [PATCH 3/3] yml file required for ci/cd pipeline gitlabs --- .gitlab-ci.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..74b5da6 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,33 @@ +variables: + IMAGE_NAME: shutterstack04/demo-gitlab + IMAGE_TAG: python-app-1.0 + +stages: + - test + - build + +run_tests: + stage: test + image: python:3.10 + cache: + paths: + - src/.venv/ + before_script: + - apt-get update && apt-get install -y make + - pip install --upgrade pip + script: + - make test + +build_images: + stage: build + image: docker:20.10.16 + services: + - docker:20.10.16-dind + variables: + DOCKER_TLS_CERTDIR: "/certs" + before_script: + - apt-get update && apt-get install -y make + - docker login -u $REGISTRY_USER -p $REGISTRY_PASS + script: + - docker build -t $IMAGE_NAME:$IMAGE_TAG . + - docker push $IMAGE_NAME:$IMAGE_TAG