Skip to content

Commit

Permalink
Restructure Codebase (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
No767 authored Apr 27, 2024
1 parent 7c66dff commit ab4b4c9
Show file tree
Hide file tree
Showing 88 changed files with 258 additions and 5,085 deletions.
26 changes: 0 additions & 26 deletions .deepsource.toml

This file was deleted.

File renamed without changes.
28 changes: 14 additions & 14 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Auto approve

on: pull_request_target

jobs:
auto-approve:
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: github.actor == 'dependabot[bot]'
steps:
- uses: hmarr/auto-approve-action@v3
with:
github-token: ${{ secrets.PAT_TOKEN }}
name: Auto approve

on: pull_request_target

jobs:
auto-approve:
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: github.actor == 'dependabot[bot]'
steps:
- uses: hmarr/auto-approve-action@v4
with:
github-token: ${{ secrets.PAT_TOKEN }}
107 changes: 55 additions & 52 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,55 @@
name: "CodeQL"

on:
push:
branches:
- master
- dev

pull_request:
branches:
- dev
schedule:
- cron: '36 7 * * 0'

jobs:
Analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Python 3.11
id: setup-python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Set up Poetry
uses: Gr1N/setup-poetry@v8
- name: Cache Poetry
id: cache-poetry
uses: actions/[email protected]
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-codeql-python-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry Dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
poetry install
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: python
setup-python-dependencies: false
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
upload: true
name: "CodeQL"

on:
push:
branches:
- dev

pull_request:
branches:
- dev
schedule:
- cron: '36 7 * * 0'

jobs:
Analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

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

- name: Set up Python 3.12
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Cache Dependencies
id: cache-pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-codeql-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-codeql-pip-
- name: Install Dependencies
if: steps.cache-pip.outputs.cache-hit != 'true'
run: |
pip install -r requirements.txt
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: python

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
upload: true
62 changes: 31 additions & 31 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
name: Dependabot Auto-Merge
on:
pull_request_target:
types:
- opened
workflow_run:
workflows: ["Tests", "CodeQL", "Snyk", "Docker Build"]
branches: [dev]
types:
- completed

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]'}}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: ${{steps.metadata.outputs.update-type != 'version-update:semver-major'}}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
name: Dependabot Auto-Merge
on:
pull_request_target:
types:
- opened
workflow_run:
workflows: ["Tests", "CodeQL", "Docker Build"]
branches: [dev]
types:
- completed

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]'}}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: ${{steps.metadata.outputs.update-type != 'version-update:semver-major'}}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
23 changes: 6 additions & 17 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,10 @@ jobs:
images: |
ghcr.io/no767/kumiko
tags: |
type=semver,pattern={{raw}},suffix=-bookworm
type=semver,pattern={{version}},suffix=-bookworm
type=semver,pattern={{major}}.{{minor}},suffix=-bookworm
type=semver,pattern={{major}},suffix=-bookworm
type=semver,pattern={{raw}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=edge,branch=dev
type=edge,branch=dev,suffix=-bookworm
- name: Setup Docker Buildx
id: buildx
Expand All @@ -49,14 +43,15 @@ jobs:
password: ${{ secrets.GHCR_PACKAGE_TOKEN }}

- name: Cache Docker layers
uses: actions/cache@v4.0.2
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-debian-ghcr-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-debian-ghcr-
- name: Build and push
uses: docker/build-push-action@v5.3.0
uses: docker/build-push-action@v5
with:
context: .
file: ./Docker/Dockerfile
Expand Down Expand Up @@ -84,16 +79,10 @@ jobs:
images: |
no767/kumiko
tags: |
type=semver,pattern={{raw}},suffix=-bookworm
type=semver,pattern={{version}},suffix=-bookworm
type=semver,pattern={{major}}.{{minor}},suffix=-bookworm
type=semver,pattern={{major}},suffix=-bookworm
type=semver,pattern={{raw}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=edge,branch=dev
type=edge,branch=dev,suffix=-bookworm
- name: Setup Docker Buildx
id: buildx
Expand All @@ -108,18 +97,18 @@ jobs:
password: ${{ secrets.DOCKER_TOKEN }}

- name: Cache Docker layers
uses: actions/cache@v4.0.2
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-debian-hub-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-debian-hub-
- name: Build and push
uses: docker/build-push-action@v5.3.0
uses: docker/build-push-action@v5
with:
context: .
file: ./Docker/Dockerfile
file: ./docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
Expand Down
88 changes: 36 additions & 52 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,36 @@
name: Lint
on:
push:
branches:
- dev

pull_request:
branches:
- dev

jobs:
Analyze:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
version: [3.8, 3.9, '3.10', '3.11']

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

- name: Set up Python ${{ matrix.version }}
id: setup-python
uses: actions/[email protected]
with:
python-version: ${{ matrix.version }}

- name: Set up Poetry
uses: Gr1N/setup-poetry@v8

- name: Cache Poetry
id: cache-poetry
uses: actions/[email protected]
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-lint-${{ matrix.version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install Poetry Dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
poetry install --with dev
- name: Run Pyright
run: |
poetry run pyright Bot
- name: Run Ruff
# the rewrite for using PEP8 standards will come later
run: |
poetry run ruff Bot
name: Lint
on:
push:
branches:
- dev

pull_request:
branches:
- dev

jobs:
Analyze:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
version: [3.9, '3.10', '3.11', '3.12']

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

- name: Set up Python ${{ matrix.version }}
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}

- name: Install Tox
run: |
pip install "tox>=4.13.0,<5"
- name: Lint Codebase
run: |
tox -e lint
Loading

0 comments on commit ab4b4c9

Please sign in to comment.