Skip to content

Commit 4a1ab08

Browse files
authored
Merge pull request #14 from Azure-Samples/cruft/update
manual cruft update
2 parents 8fa41c7 + 0d4339f commit 4a1ab08

28 files changed

+183
-102
lines changed

.cruft.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"template": "https://github.com/kjaymiller/cookiecutter-relecloud",
3-
"commit": "6a54aabb6ec52cd3ad8588728e747a300f043b03",
3+
"commit": "5361c11e1ead790f7eb0b7a15cd6e803c44c4d7e",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
77
"project_name": "azure",
8+
"python_version": "3.12",
89
"project_backend": "flask",
910
"db_resource": "postgres-flexible",
1011
"project_host": "aca",

.devcontainer/Dockerfile_dev

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
FROM mcr.microsoft.com/devcontainers/python:3.11-bullseye
1+
FROM mcr.microsoft.com/devcontainers/python:3.12-bullseye
22

33
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
44
&& apt-get -y install --no-install-recommends postgresql-client \
55
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
66

7+
8+
COPY requirements-dev.txt requirements-dev.txt
9+
COPY src/requirements.txt src/requirements.txt
710
RUN python -m pip install --upgrade pip
11+
RUN python -m pip install -r requirements-dev.txt

.devcontainer/devcontainer.json

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,40 +22,34 @@
2222
"ms-azuretools.vscode-bicep",
2323
"charliermarsh.ruff",
2424
"ms-python.python",
25-
"ms-python.black-formatter",
2625
"ms-azuretools.vscode-docker",
27-
"mtxr.sqltools",
28-
"mtxr.sqltools-driver-pg",
2926
"bierner.github-markdown-preview"
3027
],
3128
"settings": {
32-
"sqltools.connections": [
33-
{
34-
"name": "Local database",
35-
"driver": "PostgreSQL",
36-
"server": "db",
37-
"port": 5432,
38-
"database": "relecloud",
39-
"username": "postgres",
40-
"password": "postgres"
41-
}
42-
],
4329
"python.defaultInterpreterPath": "/usr/local/bin/python",
4430
"python.testing.pytestEnabled": true,
4531
"python.testing.unittestEnabled": false,
4632
"files.exclude": {
4733
".coverage": true,
4834
".pytest_cache": true,
4935
"__pycache__": true
36+
},
37+
"[python]": {
38+
"editor.formatOnSave": true,
39+
"editor.defaultFormatter": "charliermarsh.ruff",
40+
"editor.codeActionsOnSave": {
41+
"source.organizeImports": true,
42+
"source.fixAll": true
43+
}
5044
}
5145
}
5246
}
5347
},
5448
"features": {
55-
"ghcr.io/azure/azure-dev/azd:latest": {},
5649
// Required for azd to package the app to ACA
57-
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
50+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
51+
"ghcr.io/azure/azure-dev/azd:latest": {}
5852
},
59-
"postCreateCommand": "pip install -r requirements-dev.in && pip install -e src && python3 -m flask --app src/flaskapp db upgrade --directory src/flaskapp/migrations && python3 -m flask --app src/flaskapp seed --filename src/seed_data.json"
53+
"postCreateCommand": "playwright install chromium --with-deps && pip install -e src && python3 -m flask --app src/flaskapp db upgrade --directory src/flaskapp/migrations && python3 -m flask --app src/flaskapp seed --filename src/seed_data.json"
6054
}
6155

.devcontainer/docker-compose_dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ services:
2121

2222
app:
2323
build:
24-
context: .
25-
dockerfile: Dockerfile_dev
24+
context: ..
25+
dockerfile: ./.devcontainer/Dockerfile_dev
2626
depends_on:
2727
db:
2828
condition: service_healthy

.github/workflows/azure-dev.yml

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@ on:
55
push:
66
branches:
77
- main
8-
- cruft/update
8+
- cruft/update*
99

1010
# GitHub Actions workflow to deploy to Azure using azd
1111
# To configure required secrets for connecting to Azure, simply run `azd pipeline config`
12-
12+
1313
# Set up permissions for deploying with secretless Azure federated credentials
1414
# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication
1515
permissions:
1616
id-token: write
1717
contents: read
18-
18+
1919
jobs:
2020
build:
2121
runs-on: ubuntu-latest
22+
outputs:
23+
uri: ${{ steps.output.outputs.uri }}
2224
env:
2325
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
2426
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
@@ -27,10 +29,10 @@ jobs:
2729
steps:
2830
- name: Checkout
2931
uses: actions/checkout@v3
30-
32+
3133
- name: Install azd
3234
uses: Azure/[email protected]
33-
35+
3436
- name: Log in with Azure (Federated Credentials)
3537
if: ${{ env.AZURE_CLIENT_ID != '' }}
3638
run: |
@@ -39,31 +41,67 @@ jobs:
3941
--federated-credential-provider "github" `
4042
--tenant-id "$Env:AZURE_TENANT_ID"
4143
shell: pwsh
42-
44+
4345
- name: Log in with Azure (Client Credentials)
4446
if: ${{ env.AZURE_CREDENTIALS != '' }}
4547
run: |
4648
$info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable;
4749
Write-Host "::add-mask::$($info.clientSecret)"
48-
50+
4951
azd auth login `
5052
--client-id "$($info.clientId)" `
5153
--client-secret "$($info.clientSecret)" `
5254
--tenant-id "$($info.tenantId)"
5355
shell: pwsh
5456
env:
5557
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
56-
58+
5759
- name: Provision Infrastructure
5860
run: azd provision --no-prompt
5961
env:
6062
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
6163
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
6264
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
63-
65+
6466
- name: Deploy Application
6567
run: azd deploy --no-prompt
6668
env:
6769
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
6870
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
6971
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
72+
73+
- name: Output Deployment URI
74+
id: output
75+
run: |
76+
azd env get-values > .env
77+
source .env
78+
echo "uri=$BACKEND_URI" >> "$GITHUB_OUTPUT"
79+
80+
smoketests:
81+
runs-on: ubuntu-latest
82+
needs: build
83+
steps:
84+
85+
- name: Basic smoke test (curl)
86+
env:
87+
URI: ${{needs.build.outputs.uri}}
88+
run: |
89+
echo "Sleeping 1 minute due to https://github.com/Azure/azure-dev/issues/2669"
90+
sleep 60
91+
curl -sSf $URI
92+
- name: Checkout
93+
uses: actions/checkout@v3
94+
95+
- name: Setup python
96+
uses: actions/setup-python@v4
97+
with:
98+
python-version: 3.12
99+
100+
- name: End-to-end smoke tests (playwright)
101+
env:
102+
URI: ${{needs.build.outputs.uri}}
103+
run: |
104+
python3 -m pip install --upgrade pip
105+
python3 -m pip install -r requirements-dev.txt
106+
python3 -m playwright install --with-deps
107+
python3 -m pytest --exitfirst src/tests/smoke/smoketests.py --live-server-url $URI

.github/workflows/cruft.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ jobs:
2828

2929
- uses: actions/setup-python@v4
3030
with:
31-
python-version: "3.10"
31+
python-version: "3.12"
3232

3333
- name: Install Cruft
34-
run: pip3 install -r requirements-dev.in
34+
run: pip3 install -r requirements-dev.txt
3535

3636
- name: Check if update is available
3737
continue-on-error: false

.github/workflows/format.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ jobs:
1818
- uses: actions/checkout@v3
1919
- uses: actions/setup-python@v4
2020
with:
21-
python-version: 3.11
21+
python-version: 3.12
2222
cache: 'pip'
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip
26-
pip install -r requirements-dev.in
26+
pip install -r requirements-dev.txt
2727
- name: Lint with ruff
28-
run: ruff .
29-
- name: Check formatting with black
30-
run: black . --check --verbose
28+
run: |
29+
ruff check .
30+
ruff format .

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
os: ["ubuntu-20.04"]
18-
python_version: ["3.8", "3.9", "3.10", "3.11"]
18+
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1919
services:
2020
db:
2121
image: postgres:14
@@ -36,14 +36,14 @@ jobs:
3636
- name: Install dependencies
3737
run: |
3838
python3 -m pip install --upgrade pip
39-
python3 -m pip install -r requirements-dev.in
39+
python3 -m pip install -r requirements-dev.txt
4040
playwright install --with-deps
4141
python3 -m pip install -e src
4242
- name: Seed data and run Pytest tests
4343
run: |
4444
python3 -m flask --app src.flaskapp db upgrade --directory src/flaskapp/migrations
4545
python3 -m flask --app src.flaskapp seed --filename src/seed_data.json
46-
python3 -m pytest
46+
python3 -m pytest
4747
env:
4848
POSTGRES_HOST: localhost
4949
POSTGRES_USERNAME: postgres

.markdownlint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"MD013": false
3+
}

CHANGELOG.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)