Skip to content

Commit 990eab4

Browse files
colyerdengShawnDen-coder
authored andcommitted
chore: update tools
1 parent fb5b2d5 commit 990eab4

13 files changed

+240
-406
lines changed

.cz.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
commitizen:
2+
major_version_zero: true
3+
name: cz_conventional_commits
4+
tag_format: $version
5+
update_changelog_on_bump: true
6+
version_provider: uv
7+
version_scheme: semver2

.github/workflows/bump_version.yaml

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,25 @@
11
name: Bump version
2-
32
on:
43
push:
54
branches:
65
- master
76
- main
8-
workflow_dispatch:
9-
inputs:
10-
increment:
11-
description: 'Version increment (major, minor, patch)'
12-
required: false
13-
type: choice
14-
options:
15-
- major
16-
- minor
17-
- patch
18-
default: patch
19-
207
permissions:
21-
contents: write # 用于创建和推送标签
22-
pull-requests: write # 用于创建 PR
23-
8+
contents: write # 用于创建和推送标签
9+
pull-requests: write # 用于创建 PR
2410
jobs:
2511
bump-version:
26-
if: "!startsWith(github.event.head_commit.message, 'bump:')"
12+
if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }}
2713
runs-on: ubuntu-latest
28-
name: "Bump version and create changelog with commitizen"
14+
name: Bump version and create changelog with commitizen
2915
steps:
30-
- name: Load secret
31-
uses: 1password/load-secrets-action@v2
32-
with:
33-
export-env: true
34-
env:
35-
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
36-
PERSONAL_ACCESS_TOKEN: op://shawndengdev/github_access_token/credential
37-
3816
- name: Check out
3917
uses: actions/checkout@v4
4018
with:
4119
fetch-depth: 0
42-
token: '${{ env.PERSONAL_ACCESS_TOKEN }}'
43-
20+
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
4421
- name: Create bump and changelog
4522
uses: commitizen-tools/commitizen-action@master
4623
with:
47-
github_token: ${{ env.PERSONAL_ACCESS_TOKEN }}
24+
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
4825
branch: master

.github/workflows/deploy_docs.yaml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,22 @@
11
name: Deploy Docs
2-
32
on:
43
push:
54
tags:
6-
- '[0-9]+.[0-9]+.[0-9]+' # 匹配类似 1.0.0, 2.1.3 等格式的标签
5+
- '[0-9]+.[0-9]+.[0-9]+' # 匹配类似 1.0.0, 2.1.3 等格式的标签
76
workflow_dispatch:
8-
97
permissions:
10-
contents: write # 用于部署到 GitHub Pages
11-
8+
contents: write # 用于部署到 GitHub Pages
129
jobs:
1310
deploy:
1411
runs-on: ubuntu-latest
1512
steps:
1613
- name: Checkout code
1714
uses: actions/checkout@v4
18-
19-
- name: Setup Python
20-
uses: actions/setup-python@v5
21-
with:
22-
python-version: "3.12"
23-
15+
- name: Install Task
16+
uses: arduino/setup-task@v2
2417
- name: Install uv
2518
uses: astral-sh/setup-uv@v5
26-
27-
- name: Install dependencies
28-
run: uv sync --extra=docs
29-
3019
- name: Build and deploy documentation
31-
run: uv run mkdocs gh-deploy --force
20+
run: task deploy:gh-pages
3221
env:
3322
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/lint.yaml

Lines changed: 0 additions & 89 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: lint_and_unittest
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- master
7+
pull_request:
8+
workflow_dispatch:
9+
permissions:
10+
contents: read
11+
jobs:
12+
check:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
- name: Install Task
18+
uses: arduino/setup-task@v2
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
21+
- name: Install dependencies
22+
run: task init
23+
- name: Run lint checks
24+
id: lint
25+
run: task lint
26+
- name: Run test all versions
27+
run: task test:all

.github/workflows/release_build.yaml

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,31 @@
11
name: release-build
2-
32
on:
43
push:
54
tags:
6-
- '[0-9]+.[0-9]+.[0-9]+' # 匹配类似 1.0.0, 2.1.3 等格式的标签
7-
workflow_dispatch:
8-
inputs:
9-
version:
10-
description: 'Version to release (e.g. 1.0.0)'
11-
required: true
12-
type: string
13-
5+
- '[0-9]+.[0-9]+.[0-9]+' # 匹配类似 1.0.0, 2.1.3 等格式的标签
146
permissions:
15-
contents: write # 用于创建 release
16-
id-token: write # 用于发布到 PyPI
17-
7+
contents: write # 用于创建 release
8+
id-token: write # 用于发布到 PyPI
189
jobs:
1910
release-build:
2011
runs-on: ubuntu-latest
2112
permissions:
22-
contents: write # 用于创建 GitHub Release
13+
contents: write # 用于创建 GitHub Release
2314
steps:
2415
- uses: actions/checkout@v4
25-
26-
- name: Load secret
27-
uses: 1password/load-secrets-action@v2
28-
with:
29-
export-env: true
30-
env:
31-
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
32-
PERSONAL_ACCESS_TOKEN: op://shawndengdev/github_access_token/credential
33-
PYPI_TOKEN: op://shawndengdev/pypi_token/credential
34-
35-
- uses: actions/setup-python@v5
36-
with:
37-
python-version: "3.12"
38-
16+
- name: Install Task
17+
uses: arduino/setup-task@v2
3918
- name: Install uv
4019
uses: astral-sh/setup-uv@v5
41-
with:
42-
version: ">=0.4.0"
43-
44-
- name: Install dependencies
45-
run: uv sync --extra dev
46-
47-
- name: Build and test
20+
- name: init environment and test
4821
run: |
49-
uvx nox -s lint
50-
uvx nox -s test
51-
uvx nox -s build
52-
22+
task init # 初始化项目环境
23+
task lint # 运行代码检查
24+
task test:all # 运行所有测试
5325
- name: Publish to PyPI
5426
env:
55-
UV_PUBLISH_TOKEN: ${{ env.PYPI_TOKEN }}
56-
run: uv publish
57-
27+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
28+
run: task deploy:pypi
5829
- name: Release
5930
uses: softprops/action-gh-release@v2
6031
with:
@@ -63,4 +34,4 @@ jobs:
6334
dist/*.whl
6435
generate_release_notes: true
6536
env:
66-
GITHUB_TOKEN: ${{ env.PERSONAL_ACCESS_TOKEN }}
37+
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/uv-pre-commit
3+
rev: 0.7.8
4+
hooks:
5+
- id: uv-lock # Update the uv lockfile
6+
- repo: https://github.com/google/yamlfmt
7+
rev: v0.14.0
8+
hooks:
9+
- id: yamlfmt
10+
- repo: https://github.com/python-jsonschema/check-jsonschema
11+
rev: 0.33.0
12+
hooks:
13+
- id: check-github-workflows
14+
args: [--verbose]
15+
- repo: https://github.com/rhysd/actionlint
16+
rev: v1.7.7
17+
hooks:
18+
- id: actionlint # lint github actions

.python-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.ruff.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
include = ["pyproject.toml", "repo_scaffold/**/*.py", "tests/**/*.py"]
2+
exclude = ["repo_scaffold/templates/**/*"]
3+
line-length = 120
4+
target-version = "py312"
5+
6+
[lint]
7+
extend-ignore = [
8+
"D100", # Missing docstring in public module
9+
"D104", # Missing docstring in public package
10+
# airflow dags are not required to have docstrings
11+
"D203", # 1 blank line required before class docstring
12+
"D213" # Multi-line docstring summary should start at the second line
13+
]
14+
ignore = [
15+
"W191", # indentation contains tabs
16+
"D401" # imperative mood
17+
]
18+
select = [
19+
"E", # pycodestyle errors
20+
"W", # pycodestyle warnings
21+
"F", # pyflakes
22+
"I", # isort
23+
"B", # flake8-bugbear
24+
"C4", # flake8-comprehensions
25+
"D", # pydocstyle
26+
"UP", # pyupgrade
27+
"RUF", # Ruff-specific rules
28+
"SIM" # flake8-simplify
29+
]
30+
31+
[lint.isort]
32+
force-single-line = true
33+
lines-after-imports = 2
34+
35+
[lint.pydocstyle]
36+
convention = "google"

0 commit comments

Comments
 (0)