Skip to content

Commit

Permalink
Merge pull request #44 from rafsaf/release-6.0
Browse files Browse the repository at this point in the history
Release 6.0
  • Loading branch information
rafsaf committed Mar 5, 2024
2 parents 32101f2 + 4d34829 commit 170b03c
Show file tree
Hide file tree
Showing 85 changed files with 3,942 additions and 3,156 deletions.
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SECURITY__JWT_SECRET_KEY=DVnFmhwvjEhJZpuhndxjhlezxQPJmBIIkMDEmFREWQADPcUnrG
SECURITY__BACKEND_CORS_ORIGINS=["http://localhost:3000","http://localhost:8001"]
SECURITY__ALLOWED_HOSTS=["localhost", "127.0.0.1"]

DATABASE__HOSTNAME=localhost
DATABASE__USERNAME=rDGJeEDqAz
DATABASE__PASSWORD=XsPQhCoEfOQZueDjsILetLDUvbvSxAMnrVtgVZpmdcSssUgbvs
DATABASE__PORT=5455
DATABASE__DB=default_db
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2
updates:
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 5
allow:
- dependency-type: "all"
groups:
all-dependencies:
patterns:
- "*"
exclude-patterns:
- "pytest-asyncio"

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly

- package-ecosystem: docker
directory: /
schedule:
interval: weekly
42 changes: 0 additions & 42 deletions .github/workflows/build_docker_image.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/dev_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: dev-build
on:
workflow_run:
workflows: ["tests"]
branches: [main]
types:
- completed

workflow_dispatch:
inputs:
tag:
description: "Docker image tag"
required: true
default: "latest"

env:
IMAGE_TAG: ${{ github.event.inputs.tag || 'latest' }}

jobs:
dev_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}

- name: Build and push image
uses: docker/build-push-action@v5
with:
file: Dockerfile
push: true
tags: rafsaf/minimal-fastapi-postgres-template:${{ env.IMAGE_TAG }}
40 changes: 0 additions & 40 deletions .github/workflows/manual_build_docker_image.yml

This file was deleted.

54 changes: 23 additions & 31 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: Run tests

name: tests
on:
push:
branches:
- "**"
tags-ignore:
- "*.*"

jobs:
build:
runs-on: ubuntu-20.04
tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
Expand All @@ -19,47 +22,36 @@ jobs:
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.12"

# Below will create fresh template in path: minimal_project
- name: Generate project from template using cookiecutter
run: |
pip install cookiecutter
python tests/create_minimal_project.py
python-version: "3.12.2"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-in-project: false
virtualenvs-path: /opt/venv

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

- name: Install template minimal dependencies
if: steps.cached-poetry-dependencies-template.outputs.cache-hit != 'true'
- name: Install dependencies and actiavte virtualenv
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
cd minimal_project
poetry install --no-interaction --no-root
- name: Run template minimal flake8 and then tests
- name: Run tests
env:
TEST_DATABASE_HOSTNAME: localhost
TEST_DATABASE_PASSWORD: postgres
TEST_DATABASE_PORT: 5432
TEST_DATABASE_USER: postgres
TEST_DATABASE_DB: postgres
SECURITY__JWT_SECRET_KEY: very-not-secret
DATABASE__HOSTNAME: localhost
DATABASE__PASSWORD: postgres
run: |
cd minimal_project
poetry run ruff app
poetry run coverage run -m pytest
poetry run pytest
51 changes: 51 additions & 0 deletions .github/workflows/type_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: type-check
on:
push:
branches:
- "**"
tags-ignore:
- "*.*"

jobs:
type_check:
strategy:
matrix:
check: ["ruff check", "mypy --check", "ruff format --check"]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12.2"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: false
virtualenvs-path: /opt/venv

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: /opt/venv
key: venv-${{ runner.os }}-python-3.12.2-${{ hashFiles('poetry.lock') }}

- name: Install dependencies and actiavte virtualenv
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --no-interaction --no-root
- name: Run ${{ matrix.check }}
run: |
poetry run ${{ matrix.check }} .
Loading

0 comments on commit 170b03c

Please sign in to comment.