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
107 changes: 107 additions & 0 deletions .github/workflows/test_build_and_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Build wheels

on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-*"
pull_request:
workflow_dispatch:
inputs:
repository_url:
description: "Override PyPI repository URL (leave blank to use the environment's PYPI_REPOSITORY_URL variable, or fall back to PyPI prod)"
required: false
default: ""
type: string

permissions:
contents: read

jobs:
lint:
name: Lint and type-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1

- name: Install uv
uses: astral-sh/setup-uv@v10.3.3

- name: Install project and dev dependencies
run: uv sync --locked --all-extras --dev

- name: Ruff lint
run: uv run ruff check .

- name: Ruff format check
run: uv run ruff format --check .

- name: Mypy
run: uv run mypy .

test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1

- name: Install uv
uses: astral-sh/setup-uv@v10.3.3

- name: Install project and dev dependencies
run: uv sync --locked --all-extras --dev

- name: Run pytest
run: uv run pytest

build:
Comment thread
the-infinity marked this conversation as resolved.
Resolved
name: Build distributions
if: startsWith(github.ref, 'refs/tags/')
needs: [lint,test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1

- name: Install uv
uses: astral-sh/setup-uv@v10.3.3

- name: Set package version from release tag
env:
TAG: ${{ github.ref_name}}
run: |
uv version --no-sync "${TAG#v}"
printf "__version__ = '%s'\n" "${TAG#v}" > src/datex2_xml2json/_version.py

- name: Build sdist and wheel
run: uv build
Comment thread
the-infinity marked this conversation as resolved.
Resolved

- name: Upload dist artifacts
uses: actions/upload-artifact@v7.0.2
with:
name: dist
path: dist/

publish:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/${{ github.event.repository.name }}/
permissions:
id-token: write # required for trusted publishing (OIDC); uv picks the token up automatically.
steps:
- name: Download dist artifacts
uses: actions/download-artifact@v8.0.2
with:
name: dist
path: dist/

- name: Install uv
uses: astral-sh/setup-uv@v10.3.3

- name: Publish to PyPI
env:
UV_PUBLISH_URL: ${{ inputs.repository_url || vars.PYPI_REPOSITORY_URL || 'https://upload.pypi.org/legacy/' }}
run: uv publish --trusted-publishing always
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build-backend = "uv_build"

[project]
name = "datex2-xml2json"
# The version is bumped from the git tag in CI via `uv version` on release; see .github/workflows/test_build_and_publish.yml
version = "0.0.1"
authors = [
{ name="Holger Bruch", email="hb@mfdz.de" },
Expand Down Expand Up @@ -130,9 +131,6 @@ testpaths = ["tests"]
[tool.mypy]
python_version = "3.12"

[tool.mypy]
python_version = "3.14"

[[tool.mypy.overrides]]
module = [
"jsonata",
Expand Down
Loading