initial commit
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
name: Code Quality Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
code-quality:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ vars.PYTHON_VERSION }}
|
||||
|
||||
- name: Install uv
|
||||
run: pip install uv
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv pip install --group dev --system
|
||||
|
||||
- name: Ruff lint
|
||||
run: ruff check .
|
||||
|
||||
- name: Ruff format
|
||||
run: ruff format --check .
|
||||
|
||||
- name: Pyupgrade check
|
||||
run: pyupgrade --py313-plus $(git ls-files '*.py') && git diff --exit-code
|
||||
|
||||
- name: Install prettier
|
||||
run: npm install --save-dev --save-exact prettier
|
||||
|
||||
- name: Prettier format
|
||||
run: npx prettier --check .
|
||||
@@ -0,0 +1,36 @@
|
||||
name: Dependency Update Bot
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 3 * * 1" # Every Monday at 03:00 UTC
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
renovate-like:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ vars.PYTHON_VERSION }}
|
||||
|
||||
- name: Install uv and pip-review
|
||||
run: |
|
||||
pip install uv pip-review
|
||||
|
||||
- name: Update dependencies in pyproject.toml
|
||||
run: |
|
||||
uv pip update --all --group dev
|
||||
uv pip compile --all
|
||||
|
||||
- name: Commit and push changes
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
with:
|
||||
commit-message: "chore(deps): update dependencies [automated]"
|
||||
branch: "renovate/auto-deps-update"
|
||||
title: "chore(deps): update dependencies"
|
||||
body: "This PR was created automatically to update dependencies."
|
||||
token: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||
@@ -0,0 +1,44 @@
|
||||
# Gitea Actions workflow to build and publish Python package to Gitea Package Registry
|
||||
|
||||
name: Publish Python Package
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
jobs:
|
||||
build-and-publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ vars.PYTHON_VERSION }}
|
||||
|
||||
- name: Install uv
|
||||
run: pip install uv
|
||||
|
||||
- name: Update version in pyproject.toml to match tag
|
||||
run: |
|
||||
TAG_VERSION="${GITHUB_REF##*/}"
|
||||
VERSION="${TAG_VERSION#v}"
|
||||
sed -i.bak -E "s/^version = \".*\"/version = \"${VERSION}\"/" pyproject.toml
|
||||
rm pyproject.toml.bak
|
||||
|
||||
- name: Build package
|
||||
run: |
|
||||
uv pip install build --system
|
||||
uv build
|
||||
|
||||
- name: Publish to Gitea Package Registry
|
||||
env:
|
||||
TWINE_USERNAME: __token__
|
||||
TWINE_PASSWORD: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||
TWINE_REPOSITORY_URL: ${{ vars.REPOSITORY_URL }}
|
||||
run: |
|
||||
uv pip install twine --system
|
||||
twine upload dist/*
|
||||
@@ -0,0 +1,30 @@
|
||||
name: Security Audit
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * 0" # Weekly
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
safety:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ vars.PYTHON_VERSION }}
|
||||
|
||||
- name: Install uv
|
||||
run: pip install uv
|
||||
|
||||
- name: Install safety
|
||||
run: pip install safety
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv pip install --group dev --system
|
||||
|
||||
- name: Run safety check
|
||||
run: safety check
|
||||
@@ -0,0 +1,41 @@
|
||||
name: Sync pyproject.toml Version
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Publish Python Package"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
commit-version-update:
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.workflow_run.head_branch }}
|
||||
token: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ vars.PYTHON_VERSION }}
|
||||
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config user.name "CI Bot"
|
||||
git config user.email "[email protected]"
|
||||
|
||||
- name: Update version in pyproject.toml to match tag
|
||||
run: |
|
||||
TAG_VERSION="${{ github.event.workflow_run.head_branch }}"
|
||||
VERSION="${TAG_VERSION#v}"
|
||||
sed -i.bak -E "s/^version = \".*\"/version = \"${VERSION}\"/" pyproject.toml
|
||||
rm pyproject.toml.bak
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
git add pyproject.toml
|
||||
git commit -m "chore: update version in pyproject.toml to ${VERSION} [skip ci]" || echo "No changes to commit"
|
||||
git push
|
||||
@@ -0,0 +1,30 @@
|
||||
name: Test Python Package
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ vars.PYTHON_VERSION }}
|
||||
|
||||
- name: Install uv
|
||||
run: pip install uv
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv pip install --group dev --system
|
||||
|
||||
- name: Run pytest
|
||||
env:
|
||||
PYTHONPATH: .
|
||||
run: pytest
|
||||
@@ -0,0 +1,28 @@
|
||||
name: Type Check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
type-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ vars.PYTHON_VERSION }}
|
||||
|
||||
- name: Install uv
|
||||
run: pip install uv
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv pip install --group dev --system
|
||||
|
||||
- name: Run mypy
|
||||
run: mypy monitor_utils
|
||||
Reference in New Issue
Block a user