Skip to content

Commit 170b03c

Browse files
authored
Merge pull request #44 from rafsaf/release-6.0
Release 6.0
2 parents 32101f2 + 4d34829 commit 170b03c

File tree

85 files changed

+3942
-3156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+3942
-3156
lines changed

.env.example

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
SECURITY__JWT_SECRET_KEY=DVnFmhwvjEhJZpuhndxjhlezxQPJmBIIkMDEmFREWQADPcUnrG
2+
SECURITY__BACKEND_CORS_ORIGINS=["http://localhost:3000","http://localhost:8001"]
3+
SECURITY__ALLOWED_HOSTS=["localhost", "127.0.0.1"]
4+
5+
DATABASE__HOSTNAME=localhost
6+
DATABASE__USERNAME=rDGJeEDqAz
7+
DATABASE__PASSWORD=XsPQhCoEfOQZueDjsILetLDUvbvSxAMnrVtgVZpmdcSssUgbvs
8+
DATABASE__PORT=5455
9+
DATABASE__DB=default_db

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 5
8+
allow:
9+
- dependency-type: "all"
10+
groups:
11+
all-dependencies:
12+
patterns:
13+
- "*"
14+
exclude-patterns:
15+
- "pytest-asyncio"
16+
17+
- package-ecosystem: github-actions
18+
directory: /
19+
schedule:
20+
interval: weekly
21+
22+
- package-ecosystem: docker
23+
directory: /
24+
schedule:
25+
interval: weekly

.github/workflows/build_docker_image.yml

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

.github/workflows/dev_build.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: dev-build
2+
on:
3+
workflow_run:
4+
workflows: ["tests"]
5+
branches: [main]
6+
types:
7+
- completed
8+
9+
workflow_dispatch:
10+
inputs:
11+
tag:
12+
description: "Docker image tag"
13+
required: true
14+
default: "latest"
15+
16+
env:
17+
IMAGE_TAG: ${{ github.event.inputs.tag || 'latest' }}
18+
19+
jobs:
20+
dev_build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Login to DockerHub
26+
uses: docker/login-action@v3
27+
with:
28+
username: ${{ secrets.DOCKER_USER }}
29+
password: ${{ secrets.DOCKER_PASS }}
30+
31+
- name: Build and push image
32+
uses: docker/build-push-action@v5
33+
with:
34+
file: Dockerfile
35+
push: true
36+
tags: rafsaf/minimal-fastapi-postgres-template:${{ env.IMAGE_TAG }}

.github/workflows/manual_build_docker_image.yml

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

.github/workflows/tests.yml

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
name: Run tests
2-
1+
name: tests
32
on:
43
push:
4+
branches:
5+
- "**"
6+
tags-ignore:
7+
- "*.*"
58

69
jobs:
7-
build:
8-
runs-on: ubuntu-20.04
10+
tests:
11+
runs-on: ubuntu-latest
912
services:
1013
postgres:
1114
image: postgres
@@ -19,47 +22,36 @@ jobs:
1922
ports:
2023
- 5432:5432
2124
steps:
22-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v4
2326

2427
- name: Set up Python
25-
uses: actions/setup-python@v2
28+
uses: actions/setup-python@v5
2629
with:
27-
python-version: "3.12"
28-
29-
# Below will create fresh template in path: minimal_project
30-
- name: Generate project from template using cookiecutter
31-
run: |
32-
pip install cookiecutter
33-
python tests/create_minimal_project.py
30+
python-version: "3.12.2"
3431

3532
- name: Install Poetry
3633
uses: snok/install-poetry@v1
3734
with:
3835
virtualenvs-create: true
39-
virtualenvs-in-project: true
36+
virtualenvs-in-project: false
37+
virtualenvs-path: /opt/venv
4038

41-
# run tests from folder minimal_project
4239
- name: Load cached venv
43-
id: cached-poetry-dependencies-template
44-
uses: actions/cache@v2
40+
id: cached-poetry-dependencies
41+
uses: actions/cache@v4
4542
with:
46-
path: minimal_project/.venv
47-
key: venv-${{ runner.os }}-${{ hashFiles('minimal_project/poetry.lock') }}
43+
path: /opt/venv
44+
key: venv-${{ runner.os }}-python-3.12.2-${{ hashFiles('poetry.lock') }}
4845

49-
- name: Install template minimal dependencies
50-
if: steps.cached-poetry-dependencies-template.outputs.cache-hit != 'true'
46+
- name: Install dependencies and actiavte virtualenv
47+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
5148
run: |
52-
cd minimal_project
5349
poetry install --no-interaction --no-root
5450
55-
- name: Run template minimal flake8 and then tests
51+
- name: Run tests
5652
env:
57-
TEST_DATABASE_HOSTNAME: localhost
58-
TEST_DATABASE_PASSWORD: postgres
59-
TEST_DATABASE_PORT: 5432
60-
TEST_DATABASE_USER: postgres
61-
TEST_DATABASE_DB: postgres
53+
SECURITY__JWT_SECRET_KEY: very-not-secret
54+
DATABASE__HOSTNAME: localhost
55+
DATABASE__PASSWORD: postgres
6256
run: |
63-
cd minimal_project
64-
poetry run ruff app
65-
poetry run coverage run -m pytest
57+
poetry run pytest

.github/workflows/type_check.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: type-check
2+
on:
3+
push:
4+
branches:
5+
- "**"
6+
tags-ignore:
7+
- "*.*"
8+
9+
jobs:
10+
type_check:
11+
strategy:
12+
matrix:
13+
check: ["ruff check", "mypy --check", "ruff format --check"]
14+
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.12.2"
23+
24+
- name: Install Poetry
25+
uses: snok/install-poetry@v1
26+
with:
27+
virtualenvs-create: true
28+
virtualenvs-in-project: true
29+
30+
- name: Install Poetry
31+
uses: snok/install-poetry@v1
32+
with:
33+
virtualenvs-create: true
34+
virtualenvs-in-project: false
35+
virtualenvs-path: /opt/venv
36+
37+
- name: Load cached venv
38+
id: cached-poetry-dependencies
39+
uses: actions/cache@v4
40+
with:
41+
path: /opt/venv
42+
key: venv-${{ runner.os }}-python-3.12.2-${{ hashFiles('poetry.lock') }}
43+
44+
- name: Install dependencies and actiavte virtualenv
45+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
46+
run: |
47+
poetry install --no-interaction --no-root
48+
49+
- name: Run ${{ matrix.check }}
50+
run: |
51+
poetry run ${{ matrix.check }} .

0 commit comments

Comments
 (0)