Skip to content

Commit

Permalink
Merge pull request #2 from pamelafox/workflow
Browse files Browse the repository at this point in the history
Workflow improvements
  • Loading branch information
bobtabor-msft authored Jul 16, 2024
2 parents 3c51a0d + 588bd24 commit 33c01a9
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 245 deletions.
33 changes: 0 additions & 33 deletions .cruft.json

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/audit-bicep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ on:
push:
branches:
- main
- cruft/update
paths:
- "infra/**"
pull_request:
branches:
- main
- cruft/update
paths:
- "infra/**"
workflow_dispatch:
Expand Down
39 changes: 0 additions & 39 deletions .github/workflows/azure-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
push:
branches:
- main
- cruft/update

# GitHub Actions workflow to deploy to Azure using azd
# To configure required secrets for connecting to Azure, simply run `azd pipeline config`
Expand All @@ -19,8 +18,6 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
outputs:
uri: ${{ steps.output.outputs.uri }}
env:
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
Expand Down Expand Up @@ -69,39 +66,3 @@ jobs:
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}

- name: Output Deployment URI
id: output
run: |
azd env get-values > .env
source .env
echo "uri=$BACKEND_URI" >> "$GITHUB_OUTPUT"
smoketests:
runs-on: ubuntu-latest
needs: build
steps:

- name: Basic smoke test (curl)
env:
URI: ${{needs.build.outputs.uri}}
run: |
echo "Sleeping 1 minute due to https://github.com/Azure/azure-dev/issues/2669"
sleep 60
curl -sSf $URI
- name: Checkout
uses: actions/checkout@v3

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.12

- name: End-to-end smoke tests (playwright)
env:
URI: ${{needs.build.outputs.uri}}
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-dev.txt
python3 -m playwright install chromium --with-deps
python3 -m pytest --exitfirst src/tests/smoke/smoketests.py --live-server-url $URI
68 changes: 0 additions & 68 deletions .github/workflows/cruft.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ on:
branches: [ main ]
paths-ignore:
- '**.md'
- 'lab/**'
- 'assets/**'

pull_request:
branches: [ main ]
paths-ignore:
- '**.md'
- 'lab/**'
- 'assets/**'

jobs:
checks-format:
Expand Down
69 changes: 0 additions & 69 deletions .github/workflows/tests.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
"module": "uvicorn",
"args": [
"fastapi_app:app",
"--reload"
"--reload",
"--port=8888"
],
"justMyCode": false
},
{
"name": "Python: Debug Tests",
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ export POSTGRES_PASSWORD=<YOUR PASSWORD>
python3 -m pip install -r src/requirements.txt
```


1. Install the app as an editable package:

```sh
python3 -m pip install -e src
```


1. Apply database migrations and seed initial data:

```sh
Expand All @@ -67,7 +65,6 @@ If you're running the app inside VS Code or GitHub Codespaces, you can use the "
python3 -m uvicorn fastapi_app:app --reload --port=8000
```
## Running tests
1. Install the development requirements:
Expand Down Expand Up @@ -122,4 +119,3 @@ to be stored as Github action secrets. To set that up, run:
```shell
azd pipeline config
```
4 changes: 2 additions & 2 deletions azure.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json


name: azure-fastapi-postgres-flexible-appservice
name: python-app-service-postgresql-fastapi
metadata:
template: azure-fastapi-postgres-flexible-appservice@0.0.1
template: python-app-service-postgresql-fastapi@0.0.1
infra:
provider: "bicep"
services:
Expand Down
11 changes: 3 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
[tool.ruff]
line-length = 120

[tool.ruff.lint]
select = ["E", "F", "I", "UP"]
ignore = ["D203"]
extend-exclude = ["src/flaskapp/migrations/"]

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["fastapi_app"]

[tool.pytest.ini_options]
addopts = "-ra -vv"

[tool.coverage.report]
show_missing = true
14 changes: 0 additions & 14 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
-r src/requirements.txt

# Cookiecutter Support
cruft
pip-tools

# Testing Tools
pytest
ephemeral-port-reserve
pytest-playwright
coverage
pytest-cov
axe-playwright-python

# Linters
ruff
2 changes: 1 addition & 1 deletion src/fastapi_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# ruff: noqa: UP006
import os
import typing

from datetime import datetime

from sqlmodel import Field, SQLModel, create_engine

POSTGRES_USERNAME = os.environ.get("POSTGRES_USERNAME")
Expand Down

0 comments on commit 33c01a9

Please sign in to comment.