Skip to content
Merged
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
7 changes: 7 additions & 0 deletions .cz.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
commitizen:
major_version_zero: true
name: cz_conventional_commits
tag_format: $version
update_changelog_on_bump: true
version_provider: uv
version_scheme: semver2
35 changes: 6 additions & 29 deletions .github/workflows/bump_version.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,25 @@
name: Bump version

on:
push:
branches:
- master
- main
workflow_dispatch:
inputs:
increment:
description: 'Version increment (major, minor, patch)'
required: false
type: choice
options:
- major
- minor
- patch
default: patch

permissions:
contents: write # 用于创建和推送标签
pull-requests: write # 用于创建 PR

contents: write # 用于创建和推送标签
pull-requests: write # 用于创建 PR
jobs:
bump-version:
if: "!startsWith(github.event.head_commit.message, 'bump:')"
if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }}
runs-on: ubuntu-latest
name: "Bump version and create changelog with commitizen"
name: Bump version and create changelog with commitizen
steps:
- name: Load secret
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
PERSONAL_ACCESS_TOKEN: op://shawndengdev/github_access_token/credential

- name: Check out
uses: actions/checkout@v4
with:
fetch-depth: 0
token: '${{ env.PERSONAL_ACCESS_TOKEN }}'

token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Create bump and changelog
uses: commitizen-tools/commitizen-action@master
with:
github_token: ${{ env.PERSONAL_ACCESS_TOKEN }}
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
branch: master
21 changes: 5 additions & 16 deletions .github/workflows/deploy_docs.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
name: Deploy Docs

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+' # 匹配类似 1.0.0, 2.1.3 等格式的标签
- '[0-9]+.[0-9]+.[0-9]+' # 匹配类似 1.0.0, 2.1.3 等格式的标签
workflow_dispatch:

permissions:
contents: write # 用于部署到 GitHub Pages

contents: write # 用于部署到 GitHub Pages
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Task
uses: arduino/setup-task@v2
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: uv sync --extra=docs

- name: Build and deploy documentation
run: uv run mkdocs gh-deploy --force
run: task deploy:gh-pages
env:
GITHUB_TOKEN: ${{ github.token }}
89 changes: 0 additions & 89 deletions .github/workflows/lint.yaml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/lint_and_unittest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: lint_and_unittest
on:
push:
branches:
- main
- master
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Task
uses: arduino/setup-task@v2
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: task init
- name: Run lint checks
id: lint
run: task lint
- name: Run test all versions
run: task test:all
55 changes: 13 additions & 42 deletions .github/workflows/release_build.yaml
Original file line number Diff line number Diff line change
@@ -1,60 +1,31 @@
name: release-build

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+' # 匹配类似 1.0.0, 2.1.3 等格式的标签
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g. 1.0.0)'
required: true
type: string

- '[0-9]+.[0-9]+.[0-9]+' # 匹配类似 1.0.0, 2.1.3 等格式的标签
permissions:
contents: write # 用于创建 release
id-token: write # 用于发布到 PyPI

contents: write # 用于创建 release
id-token: write # 用于发布到 PyPI
jobs:
release-build:
runs-on: ubuntu-latest
permissions:
contents: write # 用于创建 GitHub Release
contents: write # 用于创建 GitHub Release
steps:
- uses: actions/checkout@v4

- name: Load secret
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
PERSONAL_ACCESS_TOKEN: op://shawndengdev/github_access_token/credential
PYPI_TOKEN: op://shawndengdev/pypi_token/credential

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Task
uses: arduino/setup-task@v2
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: ">=0.4.0"

- name: Install dependencies
run: uv sync --extra dev

- name: Build and test
- name: init environment and test
run: |
uvx nox -s lint
uvx nox -s test
uvx nox -s build

task init # 初始化项目环境
task lint # 运行代码检查
task test:all # 运行所有测试
- name: Publish to PyPI
env:
UV_PUBLISH_TOKEN: ${{ env.PYPI_TOKEN }}
run: uv publish

UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: task deploy:pypi
- name: Release
uses: softprops/action-gh-release@v2
with:
Expand All @@ -63,4 +34,4 @@ jobs:
dist/*.whl
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ env.PERSONAL_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.7.8
hooks:
- id: uv-lock # Update the uv lockfile
- repo: https://github.com/google/yamlfmt
rev: v0.14.0
hooks:
- id: yamlfmt
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.33.0
hooks:
- id: check-github-workflows
args: [--verbose]
- repo: https://github.com/rhysd/actionlint
rev: v1.7.7
hooks:
- id: actionlint # lint github actions
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

36 changes: 36 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
include = ["pyproject.toml", "repo_scaffold/**/*.py", "tests/**/*.py"]
exclude = ["repo_scaffold/templates/**/*"]
line-length = 120
target-version = "py312"

[lint]
extend-ignore = [
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package
# airflow dags are not required to have docstrings
"D203", # 1 blank line required before class docstring
"D213" # Multi-line docstring summary should start at the second line
]
ignore = [
"W191", # indentation contains tabs
"D401" # imperative mood
]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"D", # pydocstyle
"UP", # pyupgrade
"RUF", # Ruff-specific rules
"SIM" # flake8-simplify
]

[lint.isort]
force-single-line = true
lines-after-imports = 2

[lint.pydocstyle]
convention = "google"
Loading