Compare commits
3 Commits
695e5b6541
...
1ac724603a
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ac724603a | |||
| 907b911e95 | |||
| 383447d050 |
64
.github/workflows/ci.yml
vendored
Normal file
64
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v7
|
||||||
|
with:
|
||||||
|
enable-cache: true
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: uv sync --locked
|
||||||
|
|
||||||
|
- name: Run ruff check
|
||||||
|
run: uv run ruff check src/ tests/
|
||||||
|
|
||||||
|
- name: Run ruff format check
|
||||||
|
run: uv run ruff format --check src/ tests/
|
||||||
|
|
||||||
|
typecheck:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v7
|
||||||
|
with:
|
||||||
|
enable-cache: true
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: uv sync --locked
|
||||||
|
|
||||||
|
- name: Run mypy
|
||||||
|
run: uv run mypy src/
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
python-version: ["3.12", "3.13", "3.14"]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v7
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
enable-cache: true
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: uv sync --locked
|
||||||
|
|
||||||
|
- name: Run tests with coverage
|
||||||
|
run: uv run pytest --cov=rp --cov-report=term-missing
|
||||||
124
.github/workflows/release.yml
vendored
Normal file
124
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
checks:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
python-version: ["3.12", "3.13", "3.14"]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v7
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
enable-cache: true
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: uv sync --locked
|
||||||
|
|
||||||
|
- name: Run release checks
|
||||||
|
run: |
|
||||||
|
uv run ruff check src/ tests/
|
||||||
|
uv run ruff format --check src/ tests/
|
||||||
|
uv run mypy src/
|
||||||
|
uv run pytest --tb=short -q
|
||||||
|
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: checks
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v7
|
||||||
|
with:
|
||||||
|
python-version: "3.12"
|
||||||
|
enable-cache: true
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: uv sync --locked
|
||||||
|
|
||||||
|
- name: Validate release version
|
||||||
|
run: |
|
||||||
|
package_version="$(grep '^version = ' pyproject.toml | cut -d '"' -f 2)"
|
||||||
|
module_version="$(grep '^__version__ = ' src/rp/__init__.py | cut -d '"' -f 2)"
|
||||||
|
expected_tag="v${package_version}"
|
||||||
|
|
||||||
|
if [ "$package_version" != "$module_version" ]; then
|
||||||
|
printf 'Version mismatch: pyproject.toml=%s src/rp/__init__.py=%s\n' "$package_version" "$module_version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${{ github.ref_name }}" != "$expected_tag" ]; then
|
||||||
|
printf 'Tag %s does not match package version %s\n' "${{ github.ref_name }}" "$expected_tag"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build release artifacts
|
||||||
|
run: |
|
||||||
|
rm -rf dist
|
||||||
|
uv build
|
||||||
|
cd dist
|
||||||
|
sha256sum *.tar.gz *.whl > SHA256SUMS
|
||||||
|
|
||||||
|
- name: Generate release notes
|
||||||
|
run: |
|
||||||
|
tag="${{ github.ref_name }}"
|
||||||
|
release_target="${tag}^"
|
||||||
|
previous_tag="$(git tag --list 'v*' --sort=-version:refname | awk -v tag="$tag" '$0 == tag { found = 1; next } found { print; exit }')"
|
||||||
|
|
||||||
|
if ! git rev-parse --verify "$release_target" >/dev/null 2>&1; then
|
||||||
|
release_target="$tag"
|
||||||
|
fi
|
||||||
|
|
||||||
|
{
|
||||||
|
printf '# %s\n\n' "$tag"
|
||||||
|
if [ -n "$previous_tag" ]; then
|
||||||
|
printf '## Changes since %s\n\n' "$previous_tag"
|
||||||
|
git log --no-merges --pretty='- %s (%h)' "${previous_tag}..${release_target}"
|
||||||
|
else
|
||||||
|
printf '## Changes\n\n'
|
||||||
|
git log --no-merges --pretty='- %s (%h)' "$release_target"
|
||||||
|
fi
|
||||||
|
} > release-notes.md
|
||||||
|
|
||||||
|
- name: Create GitHub release
|
||||||
|
if: ${{ github.server_url == 'https://github.com' }}
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
name: ${{ github.ref_name }}
|
||||||
|
tag_name: ${{ github.ref_name }}
|
||||||
|
body_path: release-notes.md
|
||||||
|
files: |
|
||||||
|
dist/*.tar.gz
|
||||||
|
dist/*.whl
|
||||||
|
dist/SHA256SUMS
|
||||||
|
|
||||||
|
- name: Create Gitea release
|
||||||
|
if: ${{ github.server_url == 'https://gitea.yunxiao.xyz' }}
|
||||||
|
uses: akkuman/gitea-release-action@v1
|
||||||
|
env:
|
||||||
|
NODE_OPTIONS: --experimental-fetch
|
||||||
|
with:
|
||||||
|
server_url: https://gitea.yunxiao.xyz
|
||||||
|
token: ${{ secrets.RELEASE_TOKEN_GITEA }}
|
||||||
|
name: ${{ github.ref_name }}
|
||||||
|
tag_name: ${{ github.ref_name }}
|
||||||
|
body_path: release-notes.md
|
||||||
|
files: |
|
||||||
|
dist/*.tar.gz
|
||||||
|
dist/*.whl
|
||||||
|
dist/SHA256SUMS
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -13,3 +13,4 @@ build/
|
|||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
.coverage
|
.coverage
|
||||||
.env
|
.env
|
||||||
|
.opencode/state
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ classifiers = [
|
|||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.12",
|
"Programming Language :: Python :: 3.12",
|
||||||
"Programming Language :: Python :: 3.13",
|
"Programming Language :: Python :: 3.13",
|
||||||
|
"Programming Language :: Python :: 3.14",
|
||||||
"Topic :: Utilities",
|
"Topic :: Utilities",
|
||||||
"Typing :: Typed",
|
"Typing :: Typed",
|
||||||
]
|
]
|
||||||
@@ -29,8 +30,8 @@ dependencies = [
|
|||||||
rp = "rp.cli:app"
|
rp = "rp.cli:app"
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
Homepage = "https://github.com/yunxiaoxu/rich-viewer"
|
Homepage = "https://gitea.yunxiao.xyz/YunxiaoXu/rich-print"
|
||||||
Repository = "https://github.com/yunxiaoxu/rich-viewer"
|
Repository = "https://gitea.yunxiao.xyz/YunxiaoXu/rich-print.git"
|
||||||
|
|
||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
dev = [
|
dev = [
|
||||||
|
|||||||
Reference in New Issue
Block a user