Skip to content

Commit 2eb328a

Browse files
committed
chore: modernize to uv, hatchling, ruff, single CI
1 parent ed5b11d commit 2eb328a

24 files changed

+318
-2287
lines changed

.bumpversion.cfg

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
groups:
8+
python-deps:
9+
patterns: ["*"]
10+
11+
- package-ecosystem: github-actions
12+
directory: /
13+
schedule:
14+
interval: weekly
15+
groups:
16+
actions:
17+
patterns: ["*"]

.github/workflows/auto-merge.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Auto Merge
2+
3+
on: pull_request
4+
5+
permissions:
6+
contents: write
7+
pull-requests: write
8+
9+
jobs:
10+
auto-merge:
11+
name: Auto Merge
12+
if: github.actor == 'dependabot[bot]'
13+
runs-on: ubuntu-latest
14+
steps:
15+
- run: gh pr merge --squash "$PR_URL"
16+
env:
17+
PR_URL: ${{ github.event.pull_request.html_url }}
18+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_run:
8+
workflows: ["Auto Merge"]
9+
types: [completed]
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
lint:
16+
name: Lint
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v6
20+
- uses: astral-sh/setup-uv@v7
21+
- uses: actions/setup-python@v6
22+
with:
23+
python-version: "3.13"
24+
- name: Install dependencies
25+
run: uv sync --group dev
26+
- name: Lint
27+
run: uv run ruff check pirebok tests
28+
29+
test:
30+
name: Test
31+
strategy:
32+
matrix:
33+
os: [ubuntu-latest, macos-latest, windows-latest]
34+
runs-on: ${{ matrix.os }}
35+
steps:
36+
- uses: actions/checkout@v6
37+
- uses: astral-sh/setup-uv@v7
38+
- uses: actions/setup-python@v6
39+
with:
40+
python-version: "3.13"
41+
- name: Install dependencies
42+
run: uv sync --group dev
43+
- name: Test
44+
run: uv run pytest --cov=pirebok --cov-branch --cov-report=xml --cov-report=term-missing tests
45+
- uses: codecov/codecov-action@v5
46+
with:
47+
files: coverage.xml
48+
49+
release:
50+
name: Release
51+
needs: [lint, test]
52+
if: >-
53+
(github.ref == 'refs/heads/main' && github.event_name == 'push') ||
54+
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
55+
runs-on: ubuntu-latest
56+
permissions:
57+
contents: write
58+
pages: write
59+
steps:
60+
- uses: actions/checkout@v6
61+
with:
62+
fetch-depth: 0
63+
- uses: astral-sh/setup-uv@v7
64+
- uses: actions/setup-python@v6
65+
with:
66+
python-version: "3.13"
67+
68+
- name: Install dependencies
69+
run: uv sync --group dev
70+
71+
- name: Determine next version
72+
id: next_version
73+
run: |
74+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
75+
76+
if [ -z "$LATEST_TAG" ]; then
77+
NEW_VERSION="0.0.1"
78+
else
79+
VERSION=${LATEST_TAG#v}
80+
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
81+
82+
COMMITS=$(git log "${LATEST_TAG}..HEAD" --pretty=format:"%s")
83+
84+
BUMP="patch"
85+
if echo "$COMMITS" | grep -qiE "^feat(\(.+\))?!:|BREAKING CHANGE"; then
86+
BUMP="major"
87+
elif echo "$COMMITS" | grep -qiE "^feat(\(.+\))?:"; then
88+
BUMP="minor"
89+
fi
90+
91+
case $BUMP in
92+
major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;;
93+
minor) MINOR=$((MINOR + 1)); PATCH=0 ;;
94+
patch) PATCH=$((PATCH + 1)) ;;
95+
esac
96+
97+
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
98+
fi
99+
100+
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
101+
echo "tag=v$NEW_VERSION" >> $GITHUB_OUTPUT
102+
echo "Releasing v$NEW_VERSION"
103+
104+
- name: Create tag
105+
run: |
106+
git tag ${{ steps.next_version.outputs.tag }}
107+
git push origin ${{ steps.next_version.outputs.tag }}
108+
109+
- name: Build documentation
110+
run: uv run mkdocs build
111+
112+
- name: Publish documentation
113+
uses: peaceiris/actions-gh-pages@v4
114+
with:
115+
github_token: ${{ secrets.GITHUB_TOKEN }}
116+
publish_dir: ./site
117+
118+
- name: Build wheels and source tarball
119+
run: uv build
120+
121+
- name: Create GitHub release
122+
uses: softprops/action-gh-release@v2
123+
with:
124+
tag_name: ${{ steps.next_version.outputs.tag }}
125+
generate_release_notes: true
126+
files: dist/*.whl
127+
draft: false
128+
prerelease: false
129+
130+
- name: Publish to PyPI
131+
uses: pypa/gh-action-pypi-publish@release/v1
132+
with:
133+
user: __token__
134+
password: ${{ secrets.PYPI_TOKEN }}
135+
skip-existing: true

.github/workflows/dev.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/preview.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 0 additions & 80 deletions
This file was deleted.

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ wheels/
3131
*.egg
3232

3333
# PyInstaller
34-
# Usually these files are written by a python script from a template
35-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
3634
*.manifest
3735
*.spec
3836

@@ -113,3 +111,9 @@ ENV/
113111

114112
# mkdocs build dir
115113
site/
114+
115+
# uv
116+
uv.lock
117+
118+
# auto-generated version file
119+
pirebok/_version.py

0 commit comments

Comments
 (0)