fix: add gunicorn and workflow tweaks #7
This file contains hidden or 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
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| name: CI/CD | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install deps | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Lint (ruff) | |
| run: ruff check . --fix | |
| - name: Run tests | |
| run: pytest -q | |
| deploy: | |
| needs: build-test | |
| runs-on: ubuntu-latest | |
| environment: production | |
| # Hard-code the app name here to avoid VS Code warnings from vars.* | |
| env: | |
| AZURE_WEBAPP_NAME: devops-starter-webapp-dev31 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Sanity check: ensure secret exists at runtime (won’t print it) | |
| - name: Check publish profile presence | |
| run: | | |
| if [ -z "${{ secrets['AZURE_WEBAPP_PUBLISH_PROFILE'] }}" ]; then | |
| echo "❌ Missing secret: AZURE_WEBAPP_PUBLISH_PROFILE"; exit 1 | |
| else | |
| echo "✅ Publish profile secret present" | |
| fi | |
| - name: Azure WebApp Deploy | |
| uses: azure/webapps-deploy@v3 | |
| with: | |
| app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
| # Use bracket notation; the action reads the secret at runtime | |
| publish-profile: ${{ secrets['AZURE_WEBAPP_PUBLISH_PROFILE'] }} | |
| package: . |