Skip to content

Commit 9d16794

Browse files
authored
Merge pull request #1 from jentic/feat/model-implementation
feat(repo): Added Python and TypeScript packages for RFC 9457 Problem Details
2 parents 0ebed6e + 50dc5ad commit 9d16794

28 files changed

Lines changed: 5407 additions & 13 deletions

.github/workflows/ci.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
python:
13+
name: Python ${{ matrix.python-version }}
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: ["3.11", "3.12", "3.13"]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v5
29+
with:
30+
enable-cache: true
31+
32+
- name: Install dependencies
33+
working-directory: python
34+
run: |
35+
uv pip install --system -e ".[dev]"
36+
37+
- name: Run tests
38+
working-directory: python
39+
run: |
40+
pytest tests/ -v --cov=jentic.problem_details --cov-report=term-missing
41+
42+
typescript:
43+
name: TypeScript
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
- name: Set up Node.js
50+
uses: actions/setup-node@v4
51+
with:
52+
node-version: '20'
53+
cache: 'npm'
54+
cache-dependency-path: typescript/package-lock.json
55+
56+
- name: Install dependencies
57+
working-directory: typescript
58+
run: npm ci
59+
60+
- name: Build
61+
working-directory: typescript
62+
run: npm run build
63+
64+
- name: Run tests
65+
working-directory: typescript
66+
run: npm test
67+
68+
- name: Type check
69+
working-directory: typescript
70+
run: npm run typecheck

.github/workflows/release.yaml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to release (e.g., 1.0.0)'
8+
required: true
9+
type: string
10+
11+
concurrency: release
12+
13+
jobs:
14+
release:
15+
name: Release packages
16+
runs-on: ubuntu-latest
17+
if: github.ref == 'refs/heads/main'
18+
environment:
19+
name: npm-release
20+
url: https://www.npmjs.com/org/jentic
21+
permissions:
22+
contents: write
23+
id-token: write # Required for PyPI OIDC and NPM provenance
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: '3.12'
35+
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@v5
38+
39+
- name: Set up Node.js
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: '20'
43+
registry-url: 'https://registry.npmjs.org'
44+
45+
- name: Configure Git
46+
run: |
47+
git config user.name "github-actions[bot]"
48+
git config user.email "github-actions[bot]@users.noreply.github.com"
49+
50+
- name: Update Python package version
51+
working-directory: python
52+
run: |
53+
sed -i 's/^version = .*/version = "${{ inputs.version }}"/' pyproject.toml
54+
55+
- name: Update TypeScript package version
56+
working-directory: typescript
57+
run: |
58+
npm version ${{ inputs.version }} --no-git-tag-version
59+
60+
- name: Commit version changes and create tag
61+
env:
62+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
run: |
64+
git add python/pyproject.toml typescript/package.json typescript/package-lock.json
65+
git commit -m "chore: release v${{ inputs.version }}"
66+
git tag -a "v${{ inputs.version }}" -m "Release v${{ inputs.version }}"
67+
git push origin main --tags
68+
69+
- name: Install Python dependencies and build
70+
working-directory: python
71+
run: |
72+
uv pip install --system build
73+
python -m build
74+
75+
- name: Build TypeScript package
76+
working-directory: typescript
77+
run: |
78+
npm ci
79+
npm run build
80+
81+
- name: Prepare release artifacts
82+
run: |
83+
mkdir -p release-assets
84+
cp python/dist/* release-assets/
85+
86+
echo "📦 Release artifacts:"
87+
ls -la release-assets/
88+
89+
- name: Create GitHub Release
90+
env:
91+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
run: |
93+
echo "🚀 Creating GitHub release..."
94+
VERSION="${{ inputs.version }}"
95+
96+
# Try to extract changelog for this version
97+
CHANGELOG_CONTENT="$(sed -n '/^## v'$VERSION'/,/^## /p' CHANGELOG.md 2>/dev/null | sed '$d')"
98+
99+
if [ -z "$CHANGELOG_CONTENT" ]; then
100+
CHANGELOG_CONTENT="Release v$VERSION"
101+
fi
102+
103+
gh release create "v$VERSION" \
104+
--title "v$VERSION" \
105+
--notes "$CHANGELOG_CONTENT" \
106+
release-assets/*
107+
108+
- name: Publish Python package to PyPI
109+
id: pypi_publish
110+
continue-on-error: true # TODO: Remove after Trusted Publisher is configured on PyPI
111+
uses: pypa/gh-action-pypi-publish@release/v1
112+
with:
113+
packages-dir: python/dist/
114+
attestations: false
115+
116+
- name: Publish TypeScript package to NPM
117+
id: npm_publish
118+
working-directory: typescript
119+
run: npm publish --access public --provenance
120+
121+
- name: Release Summary
122+
run: |
123+
echo "🎉 RELEASE COMPLETED"
124+
echo "Released version: ${{ inputs.version }}"
125+
echo ""
126+
if [ "${{ steps.pypi_publish.outcome }}" == "success" ]; then
127+
echo "Published to PyPI: ✓"
128+
else
129+
echo "Published to PyPI: ⚠️ SKIPPED (Trusted Publisher not configured yet)"
130+
fi
131+
echo "Published to NPM: ✓"
132+
echo "GitHub release created: ✓"

.gitignore

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
MANIFEST
23+
24+
# Virtual environments
25+
venv/
26+
ENV/
27+
env/
28+
.venv/
29+
30+
# Testing
31+
.pytest_cache/
32+
.coverage
33+
htmlcov/
34+
.tox/
35+
coverage/
36+
.hypothesis/
37+
38+
# TypeScript/JavaScript
39+
node_modules/
40+
dist/
41+
*.tsbuildinfo
42+
npm-debug.log*
43+
yarn-debug.log*
44+
yarn-error.log*
45+
.pnpm-debug.log*
46+
47+
# IDEs
48+
.vscode/
49+
.idea/
50+
*.swp
51+
*.swo
52+
*.sublime-project
53+
*.sublime-workspace
54+
55+
# OS
56+
.DS_Store
57+
.DS_Store?
58+
._*
59+
.Spotlight-V100
60+
.Trashes
61+
ehthumbs.db
62+
Thumbs.db
63+
64+
# Type checking
65+
.mypy_cache/
66+
.dmypy.json
67+
dmypy.json
68+
.pytype/
69+
70+
# Build outputs
71+
*.log

0 commit comments

Comments
 (0)