Skip to content

Commit 1cc508a

Browse files
authored
Moderize and restructure codebase (#582)
1 parent abc3d0e commit 1cc508a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+4628
-2395
lines changed

.config.dist.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Kumiko's main configuration
2+
token: ""
3+
dev_mode: False
4+
5+
prometheus:
6+
enabled: True
7+
host: localhost
8+
port: 8770
9+
10+
postgres_uri: ""
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# The location of where Kumiko's configuration is stored.
2-
# The configuration can be found under the config-example.yml
3-
# MUST be absolute path
4-
CONFIG_LOCATION=./config.yml
5-
6-
# Connection secret for the postgres user. You should change it to a random password
7-
DB_PASSWORD=password
8-
9-
# The values below this line do not need to be changed
10-
###################################################################################
11-
DB_USERNAME=postgres
12-
DB_DATABASE_NAME=kumiko
1+
# The location of where Kumiko's configuration is stored.
2+
# The configuration can be found under the config-example.yml
3+
# MUST be absolute path
4+
CONFIG_LOCATION=./config.yml
5+
6+
# Connection secret for the postgres user. You should change it to a random password
7+
DB_PASSWORD=password
8+
9+
# The values below this line do not need to be changed
10+
###################################################################################
11+
DB_USERNAME=postgres
12+
DB_DATABASE=kumiko

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The following is a set of guidelines for contributing to the repository. These a
99

1010
Generally, there are much better resources that are available. These include:
1111

12-
- The official support server: [https://discord.gg/ns3e74frqn]
12+
- The official support server: <https://discord.gg/ns3e74frqn>
1313
- FAQ in the documentation
1414

1515
Make sure to not ask questions in the issue tracker.

.github/dependabot.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
version: 2
22
updates:
3-
- package-ecosystem: "pip"
4-
directory: "/"
3+
- package-ecosystem: uv
4+
directory: /backend
55
schedule:
6-
interval: "weekly"
6+
interval: weekly
77
commit-message:
8-
prefix: "[pip]"
8+
prefix: "[uv]"
99
include: "scope"
10-
target-branch: "main"
1110
groups:
12-
dev-deps:
13-
dependency-type: "development"
14-
prod-deps:
15-
dependency-type: "production"
11+
dependencies:
12+
applies-to: version-updates
13+
patterns:
14+
- "*"

.github/workflows/auto-approve.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on: pull_request_target
44

55
jobs:
66
auto-approve:
7+
name: auto-approve
78
runs-on: ubuntu-24.04
89

910
permissions:
@@ -12,4 +13,5 @@ jobs:
1213
if: github.actor == 'dependabot[bot]'
1314

1415
steps:
15-
- uses: hmarr/auto-approve-action@v4
16+
- name: Auto Approve
17+
uses: hmarr/auto-approve-action@8f929096a962e83ccdfa8afcf855f39f12d4dac7 # 4.0.0

.github/workflows/codeql.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@ name: "CodeQL"
33
on:
44
push:
55
branches: [main]
6-
6+
77
pull_request:
88
branches: [main]
99

1010
jobs:
1111
Analyze:
1212
name: Analyze
1313
runs-on: ubuntu-24.04
14+
1415
permissions:
1516
actions: read
1617
contents: read
1718
security-events: write
1819

20+
env:
21+
UV_CACHE_DIR: /tmp/.uv-cache
22+
1923
steps:
2024
- name: Checkout Repository
2125
uses: actions/checkout@v4
@@ -25,21 +29,28 @@ jobs:
2529
uses: actions/setup-python@v5
2630
with:
2731
python-version: '3.x'
28-
32+
33+
- name: Install uv
34+
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # 6.8.0
35+
with:
36+
version: "latest"
37+
enable-cache: true
38+
2939
- name: Cache Dependencies
30-
id: cache-pip
40+
id: cache-uv
3141
uses: actions/cache@v4
3242
with:
33-
path: ~/.cache/pip
34-
key: ${{ runner.os }}-codeql-pip-${{ hashFiles('**/requirements.txt') }}
43+
path: /tmp/.uv-cache
44+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
3545
restore-keys: |
36-
${{ runner.os }}-codeql-pip-
37-
46+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
47+
uv-${{ runner.os }}
48+
3849
- name: Install Dependencies
39-
if: steps.cache-pip.outputs.cache-hit != 'true'
50+
if: steps.cache-uv.outputs.cache-hit != 'true'
4051
run: |
41-
pip install -r requirements.txt
42-
52+
uv sync --frozen --no-default-groups
53+
4354
- name: Initialize CodeQL
4455
uses: github/codeql-action/init@v3
4556
with:
@@ -48,4 +59,8 @@ jobs:
4859
- name: Perform CodeQL Analysis
4960
uses: github/codeql-action/analyze@v3
5061
with:
51-
upload: true
62+
upload: true
63+
64+
- name: Minimize uv cache
65+
run: |
66+
uv cache prune --ci

.github/workflows/dependabot-auto-merge.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
types: [opened]
55

66
workflow_run:
7-
workflows: ["Lint"]
7+
workflows: ["Lint", "CodeQL"]
88
branches: [main]
99
types: [completed]
1010

@@ -15,16 +15,18 @@ permissions:
1515
jobs:
1616
dependabot:
1717
runs-on: ubuntu-24.04
18+
1819
if: ${{ github.actor == 'dependabot[bot]'}}
1920
steps:
21+
2022
- name: Dependabot metadata
2123
id: metadata
2224
uses: dependabot/fetch-metadata@v2
2325
with:
2426
github-token: "${{ secrets.GITHUB_TOKEN }}"
25-
27+
2628
- name: Enable auto-merge for Dependabot PRs
27-
if: ${{steps.metadata.outputs.update-type != 'version-update:semver-major'}}
29+
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' }}
2830
run: gh pr merge --auto --squash "$PR_URL"
2931
env:
3032
PR_URL: ${{ github.event.pull_request.html_url }}

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
uses: docker/login-action@v3
3838
with:
3939
registry: ghcr.io
40-
username: no767
40+
username: ${{ github.repository_owner }}
4141
password: ${{ secrets.GITHUB_TOKEN }}
4242

4343
- name: Build and push image

.github/workflows/lint.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,60 @@ on:
88

99
jobs:
1010
Check:
11+
name: Check (${{ matrix.version }})
1112
runs-on: ubuntu-24.04
1213

1314
strategy:
1415
fail-fast: false
1516
matrix:
1617
version: ['3.10', '3.11', '3.12', '3.13']
1718

19+
env:
20+
# Configure a constant location for the uv cache
21+
UV_CACHE_DIR: /tmp/.uv-cache
22+
1823
steps:
1924
- name: Checkout Repository
2025
uses: actions/checkout@v4
2126

2227
- name: Set up Python ${{ matrix.version }}
23-
id: setup-python
24-
uses: actions/setup-python@v5
28+
uses: actions/setup-python@v6
2529
with:
2630
python-version: ${{ matrix.version }}
2731

28-
- name: Install Tox
32+
- name: Install uv
33+
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # 6.8.0
34+
with:
35+
version: "latest"
36+
enable-cache: true
37+
38+
- name: Cache Dependencies
39+
id: cache-uv
40+
uses: actions/cache@v4
41+
with:
42+
path: /tmp/.uv-cache
43+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
44+
restore-keys: |
45+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
46+
uv-${{ runner.os }}
47+
48+
- name: Install Dependencies
49+
if: steps.cache-uv.outputs.cache-hit != 'true'
50+
run: |
51+
uv sync --frozen
52+
53+
- name: Check typing
54+
run: |
55+
uv run pyright src
56+
57+
- name: Check codebase
58+
run: |
59+
uv run ruff check src --exit-non-zero-on-fix
60+
61+
- name: Check for formatting
2962
run: |
30-
pip install "tox>=4.23.2,<5"
63+
uv run ruff format src --check
3164
32-
- name: Lint Codebase
65+
- name: Minimize uv cache
3366
run: |
34-
RAW_PYTHON_VERSION=${{ matrix.version }}
35-
PYTHON_VERSION=$(echo $RAW_PYTHON_VERSION | sed 's/\.//')
36-
tox -e $PYTHON_VERSION
67+
uv cache prune --ci

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ jobs:
6767
token: ${{ secrets.PAT_TOKEN }}
6868
tag: ${{ steps.tag_version.outputs.new_tag }}
6969
name: ${{ steps.tag_version.outputs.new_tag }}
70-
artifacts: "releases/kumiko-docker.zip,releases/kumiko-docker.tar.gz"
70+
artifacts: "releases/kumiko-docker.zip,releases/kumiko-docker.tar.gz"

0 commit comments

Comments
 (0)