-
Notifications
You must be signed in to change notification settings - Fork 2
123 lines (117 loc) · 4.17 KB
/
python.yaml
File metadata and controls
123 lines (117 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: "Python"
on:
push: { branches: [ "develop" ], tags: [ "*" ] }
pull_request: { branches: [ "develop" ] }
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
continue-on-error: ${{ matrix.python-version == '3.15' }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"
allow-prereleases: true
- run: uv sync --group dev
- run: uv run pytest databind/src/ -vv
- run: uv run black --check --config pyproject.toml databind/src/
- run: uv run isort --check-only databind/src/
- run: uv run flake8 databind/src/
- if: matrix.python-version == '3.12'
run: uv run mypy
- run: uv build --package databind && uv build --package databind.core && uv build --package databind.json
documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- uses: actions/setup-python@v5
with: { python-version: "3.12" }
- run: uv sync --group docs
- run: cd docs && uv run mkdocs build --site-dir _site
- uses: JamesIves/github-pages-deploy-action@4.1.4
with: { branch: gh-pages, folder: docs/_site, ssh-key: "${{ secrets.DEPLOY_KEY }}" }
if: github.ref == 'refs/heads/develop'
build:
if: startsWith(github.ref, 'refs/tags/')
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
package:
- { name: "databind", artifact: "dist-databind" }
- { name: "databind.core", artifact: "dist-databind-core" }
- { name: "databind.json", artifact: "dist-databind-json" }
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- uses: actions/setup-python@v5
with: { python-version: "3.12" }
- run: uv build --package ${{ matrix.package.name }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.package.artifact }}
path: dist/
publish:
needs: build
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with: { name: dist-databind, path: dist/databind }
- uses: actions/download-artifact@v4
with: { name: dist-databind-core, path: dist/databind-core }
- uses: actions/download-artifact@v4
with: { name: dist-databind-json, path: dist/databind-json }
- uses: pypa/gh-action-pypi-publish@release/v1
with: { packages-dir: dist/databind }
- uses: pypa/gh-action-pypi-publish@release/v1
with: { packages-dir: dist/databind-core }
- uses: pypa/gh-action-pypi-publish@release/v1
with: { packages-dir: dist/databind-json }
github-release:
needs: publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Generate release notes
id: notes
run: |
VERSION="${GITHUB_REF#refs/tags/}"
CHANGELOG=".changelog/${VERSION}.toml"
if [ ! -f "$CHANGELOG" ]; then
echo "body=Release ${VERSION}" >> "$GITHUB_OUTPUT"
else
BODY=$(python3 -c "
import tomllib, pathlib, sys
data = tomllib.loads(pathlib.Path(sys.argv[1]).read_text())
lines = []
for e in data.get('entries', []):
t = e.get('type', 'change')
d = e.get('description', '')
pr = e.get('pr', '')
suffix = f' ({pr})' if pr else ''
lines.append(f'- **{t}**: {d}{suffix}')
print('\n'.join(lines) if lines else 'No changelog entries.')
" "$CHANGELOG")
{
echo "body<<GHEOF"
echo "$BODY"
echo "GHEOF"
} >> "$GITHUB_OUTPUT"
fi
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${{ github.ref_name }}" \
--title "${{ github.ref_name }}" \
--notes "${{ steps.notes.outputs.body }}"