From 2464a6106ff1ca2cbbb5f06205d311bc812586e4 Mon Sep 17 00:00:00 2001 From: yogi <52026525+yogitakhtr597@users.noreply.github.com> Date: Thu, 26 Dec 2024 15:01:56 +0530 Subject: [PATCH 1/3] Add or update the Azure App Service build and deployment workflow config --- .github/workflows/main_ykwebappassignment.yml | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/main_ykwebappassignment.yml diff --git a/.github/workflows/main_ykwebappassignment.yml b/.github/workflows/main_ykwebappassignment.yml new file mode 100644 index 000000000..b1560c47f --- /dev/null +++ b/.github/workflows/main_ykwebappassignment.yml @@ -0,0 +1,78 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions +# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions + +name: Build and deploy Python app to Azure Web App - ykwebappassignment + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python version + uses: actions/setup-python@v5 + with: + python-version: '3.9' + + - name: Create and start virtual environment + run: | + python -m venv venv + source venv/bin/activate + + - name: Install dependencies + run: pip install -r requirements.txt + + # Optional: Add step to run tests here (PyTest, Django test suites, etc.) + + - name: Zip artifact for deployment + run: zip release.zip ./* -r + + - name: Upload artifact for deployment jobs + uses: actions/upload-artifact@v4 + with: + name: python-app + path: | + release.zip + !venv/ + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: 'Production' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + permissions: + id-token: write #This is required for requesting the JWT + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v4 + with: + name: python-app + + - name: Unzip artifact for deployment + run: unzip release.zip + + + - name: Login to Azure + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_438940670AF546CE82F5B7C5DD8055BF }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_30735201D62648F2A2562A4AD2C90E48 }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_02084083EE964160B4966424741E7244 }} + + - name: 'Deploy to Azure Web App' + uses: azure/webapps-deploy@v3 + id: deploy-to-webapp + with: + app-name: 'ykwebappassignment' + slot-name: 'Production' + \ No newline at end of file From 9e3f66dcaea5ea8a00315237505e02ac18cc4912 Mon Sep 17 00:00:00 2001 From: yogi <52026525+yogitakhtr597@users.noreply.github.com> Date: Fri, 10 Jan 2025 17:19:25 +0530 Subject: [PATCH 2/3] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..b7f9931c5 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,36 @@ +# Python package +# Create and test a Python package on multiple Python versions. +# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/python + +trigger: +- main + +pool: ykpool1 + +strategy: + matrix: + Python38: + python.version: '3.8' + Python39: + python.version: '3.9' + Python310: + python.version: '3.10' + Python311: + python.version: '3.11' + +steps: +- task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + displayName: 'Use Python $(python.version)' + +- script: | + python -m pip install --upgrade pip + pip install -r requirements.txt + displayName: 'Install dependencies' + +- script: | + pip install pytest pytest-azurepipelines + pytest + displayName: 'pytest' From bcea699947c428cce5a1b793870cb2cb3ffb84b2 Mon Sep 17 00:00:00 2001 From: yogi <52026525+yogitakhtr597@users.noreply.github.com> Date: Fri, 31 Jan 2025 06:56:25 +0530 Subject: [PATCH 3/3] Add or update the Azure App Service build and deployment workflow config --- .github/workflows/main_hexawebapp.yml | 81 +++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/main_hexawebapp.yml diff --git a/.github/workflows/main_hexawebapp.yml b/.github/workflows/main_hexawebapp.yml new file mode 100644 index 000000000..c47dbafb1 --- /dev/null +++ b/.github/workflows/main_hexawebapp.yml @@ -0,0 +1,81 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions +# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions + +name: Build and deploy Python app to Azure Web App - hexawebapp + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read #This is required for actions/checkout + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python version + uses: actions/setup-python@v5 + with: + python-version: '3.9' + + - name: Create and start virtual environment + run: | + python -m venv venv + source venv/bin/activate + + - name: Install dependencies + run: pip install -r requirements.txt + + # Optional: Add step to run tests here (PyTest, Django test suites, etc.) + + - name: Zip artifact for deployment + run: zip release.zip ./* -r + + - name: Upload artifact for deployment jobs + uses: actions/upload-artifact@v4 + with: + name: python-app + path: | + release.zip + !venv/ + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: 'Production' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + permissions: + id-token: write #This is required for requesting the JWT + contents: read #This is required for actions/checkout + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v4 + with: + name: python-app + + - name: Unzip artifact for deployment + run: unzip release.zip + + + - name: Login to Azure + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_EC99AD326DA146DDAC9DF07A77EF46AB }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_9C9A39C8EE204E8985C1F00009EECCBC }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_C1494BDEA60946669B56F7AD4527AE32 }} + + - name: 'Deploy to Azure Web App' + uses: azure/webapps-deploy@v3 + id: deploy-to-webapp + with: + app-name: 'hexawebapp' + slot-name: 'Production' + \ No newline at end of file