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
14 changes: 14 additions & 0 deletions docs/gen_home_pages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Generate the home pages."""
import mkdocs_gen_files
import os

# Read README.md from project root
readme_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "README.md")

# Read the content of README.md
with open(readme_path, 'r', encoding='utf-8') as f:
content = f.read()

# Write the content to index.md in the docs directory
with mkdocs_gen_files.open("index.md", "w") as f:
f.write(content)
1 change: 0 additions & 1 deletion docs/gen_ref_pages.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Generate the code reference pages."""

from pathlib import Path

import mkdocs_gen_files

nav = mkdocs_gen_files.Nav()
Expand Down
11 changes: 0 additions & 11 deletions docs/index.md

This file was deleted.

1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ plugins:
- gen-files:
scripts:
- docs/gen_ref_pages.py
- docs/gen_home_pages.py
- literate-nav:
nav_file: SUMMARY.md
- mkdocstrings:
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ docs = [
"mkdocs-gen-files>=0.5.0",
"mkdocs-literate-nav>=0.6.1",
"pymdown-extensions>=10.7",
"pymdown-extensions>=10.7",
]

[project.scripts]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,7 @@ permissions:
pull-requests: write # 用于在 PR 中添加评论

jobs:
setup:
uses: ./.github/workflows/setup.yaml
with:
install-deps: dev
python-version: "{{cookiecutter.max_python_version}}" # 使用最新版本
secrets:
OP_SERVICE_ACCOUNT_TOKEN: {% raw %}${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}{% endraw %}
PERSONAL_ACCESS_TOKEN: {% raw %}${{ secrets.PERSONAL_ACCESS_TOKEN }}{% endraw %}

lint:
needs: setup
check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -37,12 +27,15 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5

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

- name: Run lint checks
id: lint
run: uv tool run nox -s lint
run: uvx nox -s lint
continue-on-error: true

- name: Comment on PR
- name: Comment on PR (Lint)
if: github.event_name == 'pull_request' && steps.lint.outcome == 'failure'
uses: actions/github-script@v7
with:
Expand All @@ -62,27 +55,20 @@ jobs:
if: steps.lint.outcome == 'failure'
run: exit 1

test-all:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "{{cookiecutter.max_python_version}}"

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Run tests on all Python versions
- name: Run tests
id: test
run: uv tool run nox -s test_all
run: uvx nox -s test_all
continue-on-error: true

- name: Comment on PR
- name: Upload coverage reports
if: success()
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests

- name: Comment on PR (Tests)
if: github.event_name == 'pull_request' && steps.test.outcome == 'failure'
uses: actions/github-script@v7
with:
Expand All @@ -101,3 +87,4 @@ jobs:
- name: Check test result
if: steps.test.outcome == 'failure'
run: exit 1

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Generate the home pages."""
import mkdocs_gen_files
import os

# Read README.md from project root
readme_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "README.md")

# Read the content of README.md
with open(readme_path, 'r', encoding='utf-8') as f:
content = f.read()

# Write the content to index.md in the docs directory
with mkdocs_gen_files.open("index.md", "w") as f:
f.write(content)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Generate the code reference pages."""

from pathlib import Path

import mkdocs_gen_files

nav = mkdocs_gen_files.Nav()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ plugins:
- gen-files:
scripts:
- docs/gen_ref_pages.py
- docs/gen_home_pages.py
- literate-nav:
nav_file: SUMMARY.md
- mkdocstrings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ docs = [
"mkdocstrings>=0.24.0",
"mkdocstrings-python>=1.7.5",
"mkdocs-gen-files>=0.5.0",
"pymdown-extensions>=10.7",
"mkdocs-literate-nav>=0.6.1",
]
{% endif %}
Expand All @@ -46,7 +47,7 @@ build-backend = "hatchling.build"
[tool.ruff]
line-length = 120
include = ["pyproject.toml", "{{cookiecutter.project_slug}}/**/*.py"]
target-version = "{{cookiecutter.min_python_version}}"
target-version = "py{{ cookiecutter.min_python_version | replace('.', '') }}"

[tool.ruff.lint]
select = [
Expand Down
4 changes: 3 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading