-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* f/add uv, ruff-format, metrics * improve metrics * update actions * on pr * update needs * bug fixes * setup containers & env to test * fix needs * bf/healtcheck with stdlib * don't expose port * test-order * add pytest cov * asyncmy * improve dependencies
- Loading branch information
1 parent
944969a
commit 6d59932
Showing
19 changed files
with
1,410 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
runs: | ||
using: composite | ||
steps: | ||
- name: "Install UV" | ||
shell: bash | ||
run: | | ||
curl -LsSf https://astral.sh/uv/install.sh | sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
name: hetzner production workflow | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
push: | ||
branches: | ||
- main | ||
|
@@ -16,11 +20,71 @@ env: | |
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
lock_file: | ||
runs-on: [self-hosted, "hetzner"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
- run: uv lock --locked | ||
linting: | ||
runs-on: [self-hosted, "hetzner"] | ||
needs: [lock_file] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
- run: uvx ruff check . | ||
formatting: | ||
runs-on: [self-hosted, "hetzner"] | ||
needs: [lock_file] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
- run: uvx ruff format --check . | ||
# type_consistency: | ||
# runs-on: [self-hosted, "hetzner"] | ||
# needs: [lock_file] | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - uses: ./.github/actions/setup | ||
# - run: uv run pyright | ||
tests: | ||
runs-on: [self-hosted, "hetzner"] | ||
needs: [linting, formatting] | ||
env: | ||
ENV: "DVP" | ||
DATABASE_URL: "mysql+aiomysql://root:root_bot_buster@mysql:3306/playerdata" | ||
KAFKA_HOST: "localhost:9092" | ||
POOL_RECYCLE: 60 | ||
POOL_TIMEOUT: 30 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version-file: ".python-version" | ||
- name: Setup Docker Containers | ||
run: | | ||
docker-compose up --build --quiet-pull -d | ||
- name: Check API is Up | ||
uses: cygnetdigital/[email protected] | ||
with: | ||
url: "http://localhost:5000/docs" | ||
responseCode: "200,500" | ||
timeout: 120000 # wait up to 120 seconds | ||
interval: 5000 # poll every 5 seconds | ||
- run: uv run pytest -v --durations=0 --cov --cov-report=xml | ||
|
||
# This workflow contains two jobs: build_image and update_image_version | ||
build_image: | ||
# The type of runner that the job will run on | ||
runs-on: [self-hosted, "hetzner"] | ||
if: github.repository_owner == 'Bot-detector' | ||
needs: [tests] | ||
# Run only on manual trigger | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
|
@@ -50,8 +114,9 @@ jobs: | |
update_image_version: | ||
runs-on: [self-hosted, "hetzner"] | ||
if: github.repository_owner == 'Bot-detector' | ||
needs: build_image # This ensures that the build_image job is completed before running this job | ||
needs: build_image | ||
# Run only on manual trigger | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
|
||
steps: | ||
- name: Checkout Target Repository | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[project] | ||
name = "public-api" | ||
version = "0.1.0" | ||
description = "Add your description here" | ||
readme = "README.md" | ||
requires-python = ">=3.12" | ||
dependencies = [ | ||
"aiokafka>=0.12.0", | ||
"aiokafkaengine>=0.0.4", | ||
"aiomysql[rsa]>=0.2.0", | ||
"asyncmy>=0.2.9", | ||
"fastapi[standard]>=0.115.5", | ||
"prometheus-client>=0.21.0", | ||
"pydantic-settings>=2.6.1", | ||
"pydantic>=2.10.1", | ||
"sqlalchemy>=2.0.36", | ||
] | ||
|
||
[dependency-groups] | ||
dev = [ | ||
"pytest-asyncio>=0.24.0", | ||
"ruff>=0.7.4", | ||
"pre-commit>=4.0.1", | ||
"pyright>=1.1.389", | ||
"httpx>=0.27.2", | ||
"pytest-cov>=6.0.0", | ||
] | ||
[tool.pyright] | ||
include = [ | ||
"src" | ||
] | ||
# exclude = [ | ||
# "tests/", | ||
# "kafka_setup/" | ||
# ] |
Oops, something went wrong.