Merge pull request #7 from IE-BCSAI-2024/main #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ie-bank-backend | |
on: | |
push: | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
id-token: write | |
env: | |
BACKEND_WEBAPP_DEV: aguadamillas-be-dev | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
ENV: ghci | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.11" | |
- name: Upgrade pip | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
- name: Lint with flake8 | |
run: | | |
pip install flake8 pytest | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with pytest | |
run: | | |
python -m pytest --cov=iebank_api -v | |
- name: Upload artifact for deployment jobs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: python-app | |
path: | | |
. | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: 'Development' | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v2 | |
with: | |
name: python-app | |
path: . | |
- uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: 'Deploy to Azure Web App' | |
uses: azure/webapps-deploy@v2 | |
id: deploy-to-webapp | |
with: | |
app-name: ${{ env.BACKEND_WEBAPP_DEV }} | |
package: . | |