Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .ci-test.md
Binary file not shown.
43 changes: 43 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CD

on:
push:
branches:
- main

jobs:
build-and-push:
name: Build and Push Docker Image
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/simple-service:latest
cache-from: type=gha
cache-to: type=gha,mode=max

deploy:
name: Deploy to Render
runs-on: ubuntu-latest
needs: build-and-push

steps:
- name: Trigger Render deployment
run: |
curl "${{ secrets.RENDER_DEPLOY_HOOK_URL }}&imgURL=docker.io%2F${{ secrets.DOCKERHUB_USERNAME }}%2Fsimple-service%3Alatest"
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
pull_request:
branches:
- main

jobs:
code-quality:
name: Code Quality Checks
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version

- name: Install dependencies
run: uv sync --all-groups --frozen

- name: Lint with ruff
run: uv run ruff check .

- name: Check formatting with ruff
run: uv run ruff format --check .

- name: Static type check with pyright
run: uv run pyright

- name: Run tests with pytest
run: uv run pytest
10 changes: 10 additions & 0 deletions .idea/.gitignore

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

9 changes: 9 additions & 0 deletions .idea/CCIC.iml

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

6 changes: 6 additions & 0 deletions .idea/misc.xml

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

8 changes: 8 additions & 0 deletions .idea/modules.xml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.6
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: local
hooks:
- id: pyright
name: pyright
entry: uv run pyright
language: system
types: [python]
pass_filenames: false
- id: pytest
name: pytest
entry: uv run pytest
language: system
types: [python]
pass_filenames: false
19 changes: 3 additions & 16 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,14 @@
from app.application.get_dice_roll import get_dice_roll












def create_app() -> FastAPI:
app = FastAPI()

app.add_api_route(path="/", endpoint=lambda: RedirectResponse(app.url_path_for(get_dice_roll.__name__)), methods=["GET"], include_in_schema=False,)
app.add_api_route(path="/", endpoint=lambda: RedirectResponse(app.url_path_for(get_dice_roll.__name__)), methods=["GET"], include_in_schema=False)

app.add_api_route(
path="/dice/roll",
endpoint=get_dice_roll
)
app.add_api_route(path="/dice/roll", endpoint=get_dice_roll)

return app


app = create_app()
app = create_app()
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies = [

[dependency-groups]
dev = [
"pre-commit>=4.5.1",
"pyright>=1.1.394",
"pytest>=8.3.4",
"ruff>=0.9.6",
Expand Down
Loading