Skip to content
Closed
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
19 changes: 10 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
name: Build image

on:
push:
branches:
- main
pull_request:
workflow_call: # temporarily disable

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

env:
REGISTRY: ghcr.io # Only used for labeling, if you want to push it make sure you have permissions to push.
IMAGE_NAME: ${{ github.repository }}
IMAGE_NAME: kbluescode/dumbkv

jobs:
build-image:
Expand All @@ -20,8 +17,12 @@ jobs:
permissions:
contents: read

# https://github.com/marketplace/actions/build-and-push-docker-images
steps:
- name: Checkout
uses: actions/checkout@v4

# TODO: Maybe there's an action that does this for us.
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
push: false
tags: ${{ env.IMAGE_NAME }}
39 changes: 39 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CICD

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

env:
REGISTRY: ghcr.io # Only used for labeling, if you want to push it make sure you have permissions to push.
IMAGE_NAME: kbluescode/dumbkv

jobs:
build-image:
runs-on: ubuntu-latest

permissions:
contents: read

# https://github.com/marketplace/actions/build-and-push-docker-images
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
push: false
tags: ${{ env.IMAGE_NAME }}

test-image:
needs: build-image
runs-on: ubuntu-latest
permissions:
contents: read

if: github.event_name == 'pull_request'
steps:
- name: Run pytest
run: docker run --rm -it kbluescode/dumbkv:latest uv run python -m pytest
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python 3.12.11
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-reco

RUN uv python install 3.12

# TODO: Install the python packages and run uvicorn
COPY . /app

RUN uv sync

ENV HOST="0.0.0.0" PORT="8000" LOG_CONFIG="logging.yaml"
CMD uv run uvicorn main:api --host $HOST --port $PORT --log-config $LOG_CONFIG
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ The manifests can be saved in a `manifests` directory.

## Monitoring
- [ ] Create a service monitor objects for prometheus to scrape the metrics
- [ ] Create a markdown document describing what SLO you would set for this application
- [ ] Create a markdown document describing what SLO you would set for this applicationhi
29 changes: 29 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# https://just.systems

_default:
@just --list

HOST := '0.0.0.0'
PORT := '8000'
LOG_CONFIG := 'logging.yaml'

run:
uv run uvicorn main:api --host {{HOST}} --port {{PORT}} --log-config {{LOG_CONFIG}}

[group('docker')]
build:
docker build -t kbluescode/dumbkv .

[group('docker')]
run-image:
docker run --rm -it -p {{PORT}}:{{PORT}} kbluescode/dumbkv

[group('testing')]
test:
uv run python -m pytest

DATABASE_URI := 'postgres://postgres:postgres@127.0.0.1/postgres'

[group('testing')]
test-pg:
uv run python -m pytest -v --database-location={{DATABASE_URI}}
Loading