From 22674e915a21ad96bda4a44b27b84bf94bc7a8db Mon Sep 17 00:00:00 2001 From: Holger Bruch Date: Wed, 4 Nov 2026 15:52:24 +0100 Subject: [PATCH 1/8] chore: add test, build and publish action --- .github/workflows/test_build_and_publish.yml | 78 ++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/test_build_and_publish.yml diff --git a/.github/workflows/test_build_and_publish.yml b/.github/workflows/test_build_and_publish.yml new file mode 100644 index 0000000..a0adcef --- /dev/null +++ b/.github/workflows/test_build_and_publish.yml @@ -0,0 +1,78 @@ +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: + test: + name: Run tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v6 + + - name: Install project and dev dependencies + run: uv sync --locked --all-extras --dev + + - name: Run pytest + run: uv run pytest + + build: + name: Build distributions + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v6 + + - name: Build sdist and wheel + run: uv build + + - name: Upload dist artifacts + uses: actions/upload-artifact@v4 + 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@v4 + with: + name: dist + path: dist/ + + - name: Install uv + uses: astral-sh/setup-uv@v6 + + - 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 From b65f188ec2a72e10a13c56bf8234fe0e6903acb5 Mon Sep 17 00:00:00 2001 From: Holger Bruch Date: Wed, 4 Nov 2026 16:05:51 +0100 Subject: [PATCH 2/8] chore: add linting check --- .github/workflows/test_build_and_publish.yml | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/test_build_and_publish.yml b/.github/workflows/test_build_and_publish.yml index a0adcef..6a44016 100644 --- a/.github/workflows/test_build_and_publish.yml +++ b/.github/workflows/test_build_and_publish.yml @@ -18,6 +18,27 @@ permissions: contents: read jobs: + lint: + name: Lint and type-check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v6 + + - 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 From 15b90ee270a9d8484c8d049f6cccbc095c4d6d96 Mon Sep 17 00:00:00 2001 From: Holger Bruch Date: Fri, 6 Nov 2026 11:47:05 +0100 Subject: [PATCH 3/8] fix: remove duplicate tools.mypy section --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4df2402..ceeccc6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -130,9 +130,6 @@ testpaths = ["tests"] [tool.mypy] python_version = "3.12" -[tool.mypy] -python_version = "3.14" - [[tool.mypy.overrides]] module = [ "jsonata", From a8ecec9b11c0a87de1e270673e934ab91546d725 Mon Sep 17 00:00:00 2001 From: Holger Bruch Date: Fri, 6 Nov 2026 11:47:56 +0100 Subject: [PATCH 4/8] chore: bump action versions --- .github/workflows/test_build_and_publish.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test_build_and_publish.yml b/.github/workflows/test_build_and_publish.yml index 6a44016..b3155be 100644 --- a/.github/workflows/test_build_and_publish.yml +++ b/.github/workflows/test_build_and_publish.yml @@ -22,10 +22,10 @@ jobs: name: Lint and type-check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7.0.1 - name: Install uv - uses: astral-sh/setup-uv@v6 + uses: astral-sh/setup-uv@v10.2.3 - name: Install project and dev dependencies run: uv sync --locked --all-extras --dev @@ -43,10 +43,10 @@ jobs: name: Run tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7.0.1 - name: Install uv - uses: astral-sh/setup-uv@v6 + uses: astral-sh/setup-uv@v10.2.3 - name: Install project and dev dependencies run: uv sync --locked --all-extras --dev @@ -59,16 +59,16 @@ jobs: if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7.0.1 - name: Install uv - uses: astral-sh/setup-uv@v6 - + uses: astral-sh/setup-uv@v10.2.3 + - name: Build sdist and wheel run: uv build - name: Upload dist artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.2 with: name: dist path: dist/ @@ -85,13 +85,13 @@ jobs: id-token: write # required for trusted publishing (OIDC); uv picks the token up automatically. steps: - name: Download dist artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.2 with: name: dist path: dist/ - name: Install uv - uses: astral-sh/setup-uv@v6 + uses: astral-sh/setup-uv@v10.3.2 - name: Publish to PyPI env: From a9c38c723f23a384142950495162aeb8037b1b11 Mon Sep 17 00:00:00 2001 From: Holger Bruch Date: Fri, 6 Nov 2026 11:49:06 +0100 Subject: [PATCH 5/8] fix: let build depend on lint and test --- .github/workflows/test_build_and_publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_build_and_publish.yml b/.github/workflows/test_build_and_publish.yml index b3155be..75cfa58 100644 --- a/.github/workflows/test_build_and_publish.yml +++ b/.github/workflows/test_build_and_publish.yml @@ -57,6 +57,7 @@ jobs: build: name: Build distributions if: startsWith(github.ref, 'refs/tags/') + needs: [lint,test] runs-on: ubuntu-latest steps: - uses: actions/checkout@v7.0.1 From 75835a379655cdf6e17ce60759869ccf799c590b Mon Sep 17 00:00:00 2001 From: Holger Bruch Date: Fri, 6 Nov 2026 11:54:27 +0100 Subject: [PATCH 6/8] chore: set version dynamically --- .github/workflows/test_build_and_publish.yml | 7 +++++++ pyproject.toml | 1 + 2 files changed, 8 insertions(+) diff --git a/.github/workflows/test_build_and_publish.yml b/.github/workflows/test_build_and_publish.yml index 75cfa58..6b5a4d5 100644 --- a/.github/workflows/test_build_and_publish.yml +++ b/.github/workflows/test_build_and_publish.yml @@ -65,6 +65,13 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v10.2.3 + - name: Set package version from release tag + env: + TAG: ${{ github.event.release.tag_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 diff --git a/pyproject.toml b/pyproject.toml index ceeccc6..dead5d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" }, From 59a1c4cf2580dab3636d2157ed357755ee614df5 Mon Sep 17 00:00:00 2001 From: Holger Bruch Date: Fri, 6 Nov 2026 11:58:34 +0100 Subject: [PATCH 7/8] fix: fix and bump action versions --- .github/workflows/test_build_and_publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_build_and_publish.yml b/.github/workflows/test_build_and_publish.yml index 6b5a4d5..c899614 100644 --- a/.github/workflows/test_build_and_publish.yml +++ b/.github/workflows/test_build_and_publish.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/checkout@v7.0.1 - name: Install uv - uses: astral-sh/setup-uv@v10.2.3 + uses: astral-sh/setup-uv@v10.3.3 - name: Install project and dev dependencies run: uv sync --locked --all-extras --dev @@ -46,7 +46,7 @@ jobs: - uses: actions/checkout@v7.0.1 - name: Install uv - uses: astral-sh/setup-uv@v10.2.3 + uses: astral-sh/setup-uv@v10.3.3 - name: Install project and dev dependencies run: uv sync --locked --all-extras --dev @@ -63,7 +63,7 @@ jobs: - uses: actions/checkout@v7.0.1 - name: Install uv - uses: astral-sh/setup-uv@v10.2.3 + uses: astral-sh/setup-uv@v10.3.3 - name: Set package version from release tag env: @@ -99,7 +99,7 @@ jobs: path: dist/ - name: Install uv - uses: astral-sh/setup-uv@v10.3.2 + uses: astral-sh/setup-uv@v10.3.3 - name: Publish to PyPI env: From a9e756aac83e85764af74476d38183ac60199ae6 Mon Sep 17 00:00:00 2001 From: Holger Bruch Date: Sat, 7 Nov 2026 10:20:17 +0100 Subject: [PATCH 8/8] fix: use github.ref_name to refer to tag --- .github/workflows/test_build_and_publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_build_and_publish.yml b/.github/workflows/test_build_and_publish.yml index c899614..a3d0667 100644 --- a/.github/workflows/test_build_and_publish.yml +++ b/.github/workflows/test_build_and_publish.yml @@ -67,7 +67,7 @@ jobs: - name: Set package version from release tag env: - TAG: ${{ github.event.release.tag_name }} + TAG: ${{ github.ref_name}} run: | uv version --no-sync "${TAG#v}" printf "__version__ = '%s'\n" "${TAG#v}" > src/datex2_xml2json/_version.py