Skip to content

Commit

Permalink
Merge branch 'nix' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Defelo committed Dec 22, 2023
2 parents aa7b4fb + 4132330 commit a12f996
Show file tree
Hide file tree
Showing 13 changed files with 255 additions and 159 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: build

on:
push:
branches: [develop]
pull_request:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
name: build (${{ matrix.system }})
strategy:
matrix:
system: [x86_64-linux, aarch64-linux]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: sudo apt-get install -y qemu-user-static
- name: Setup Nix
uses: cachix/install-nix-action@v24
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
extra_nix_config: |
system = ${{ matrix.system }}
- name: Setup Cachix
uses: cachix/cachix-action@v13
with:
name: bootstrap-academy
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build
54 changes: 0 additions & 54 deletions .github/workflows/docker.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,5 @@ dmypy.json

.idea
.direnv

result
49 changes: 0 additions & 49 deletions Dockerfile

This file was deleted.

10 changes: 10 additions & 0 deletions api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def _get_version() -> str:
import tomllib
from pathlib import Path
from typing import cast

with Path(__file__).parent.parent.joinpath("pyproject.toml").open("rb") as file:
return cast(str, tomllib.load(file)["tool"]["poetry"]["version"])


__version__ = _get_version()
6 changes: 3 additions & 3 deletions api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
from fastapi.responses import Response
from starlette.exceptions import HTTPException as StarletteHTTPException

from . import __version__
from .database import db, db_context
from .endpoints import ROUTER, TAGS
from .logger import get_logger, setup_sentry
from .models.premium_autopay import run_autopay
from .settings import settings
from .utils.debug import check_responses
from .utils.docs import add_endpoint_links_to_openapi_docs
from .version import get_version


T = TypeVar("T")
Expand All @@ -29,7 +29,7 @@
app = FastAPI(
title="Bootstrap Academy Backend: Shop Microservice",
description=__doc__,
version=get_version().description,
version=__version__,
root_path=settings.root_path,
root_path_in_servers=False,
servers=[{"url": settings.root_path}] if settings.root_path else None,
Expand All @@ -46,7 +46,7 @@ def setup_app() -> None:

if settings.sentry_dsn:
logger.debug("initializing sentry")
setup_sentry(app, settings.sentry_dsn, "shop-ms", get_version().description)
setup_sentry(app, settings.sentry_dsn, "shop-ms", __version__)

if settings.debug:
app.add_middleware(
Expand Down
2 changes: 1 addition & 1 deletion api/utils/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
logger = get_logger(__name__)


env = Environment(loader=FileSystemLoader("templates"), autoescape=True)
env = Environment(loader=FileSystemLoader(Path(__file__).parent / "../../templates"), autoescape=True)


@dataclass
Expand Down
15 changes: 0 additions & 15 deletions api/version.py

This file was deleted.

130 changes: 129 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a12f996

Please sign in to comment.