From 61a45fddae35367de608a4a6f087b1cbfdb1d1cd Mon Sep 17 00:00:00 2001 From: jcpitre Date: Thu, 4 Jun 2026 13:11:00 -0400 Subject: [PATCH 1/5] Add GitHub Actions workflows for CI and automated PyPI publishing --- .github/workflows/python-release.yml | 41 ++++++++++++++++++++++++++++ .github/workflows/python-test.yml | 30 ++++++++++++++++++++ README.md | 26 +++++++++++++++++- 3 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/python-release.yml create mode 100644 .github/workflows/python-test.yml diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml new file mode 100644 index 0000000..43400b5 --- /dev/null +++ b/.github/workflows/python-release.yml @@ -0,0 +1,41 @@ +name: Python Release + +on: + release: + types: [published] + +jobs: + test: + uses: ./.github/workflows/python-test.yml + + publish: + needs: test + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/gtfs-diff-engine/ + permissions: + id-token: write # Required for PyPI Trusted Publisher (OIDC) + contents: read + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install build backend + run: | + python -m pip install --upgrade pip + pip install build + + - name: Build distributions + run: | + python -m build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml new file mode 100644 index 0000000..a1ce3d7 --- /dev/null +++ b/.github/workflows/python-test.yml @@ -0,0 +1,30 @@ +name: Python Tests + +on: + push: + branches: [ main ] + pull_request: + workflow_call: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12", "3.13"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install package + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Run tests + run: python -m pytest tests/ -v diff --git a/README.md b/README.md index 4f0684d..6482b44 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ pip install gtfs-diff-engine For a development (editable) install with test dependencies: ```bash -git clone https://github.com/your-org/gtfs-diff-engine +git clone https://github.com/MobilityData/gtfs-diff-engine cd gtfs-diff-engine pip install -e ".[dev]" ``` @@ -240,6 +240,30 @@ pip install -e ".[dev]" pytest tests/ -v ``` +## Releasing a New Version + +1. **Bump the version** in `pyproject.toml`: + ```toml + [project] + version = "x.y.z" + ``` + +2. **Commit and push** the version bump to `main`. + +3. **Create a GitHub Release** via the GitHub UI (or `gh release create`): + - Set the tag to `vx.y.z` (e.g. `v0.2.0`) + - Write a release title and notes summarising changes + - Click **Publish release** + +4. **The publish workflow fires automatically.** The [`Publish to PyPI`](.github/workflows/publish.yml) GitHub Actions workflow triggers on release publication, builds the package, and pushes it to PyPI via [Trusted Publisher (OIDC)](https://docs.pypi.org/trusted-publishers/) — no API token required. + +5. **Verify** the new version appears on [https://pypi.org/project/gtfs-diff-engine](https://pypi.org/project/gtfs-diff-engine) and is installable: + ```bash + pip install gtfs-diff-engine==x.y.z + ``` + +> **One-time PyPI setup:** A maintainer must configure the repository as a Trusted Publisher on PyPI before the first automated release. Go to the [gtfs-diff-engine PyPI project](https://pypi.org/manage/project/gtfs-diff-engine/settings/publishing/), add a publisher for `MobilityData/gtfs-diff-engine`, workflow `publish.yml`, environment `pypi`. + ## License See [LICENSE](LICENSE). From cd6f8bb3f5c802d3384b160c59809762c235646b Mon Sep 17 00:00:00 2001 From: jcpitre Date: Thu, 4 Jun 2026 13:30:53 -0400 Subject: [PATCH 2/5] Added manual trigger for the test workflow. --- .github/workflows/python-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index a1ce3d7..379f598 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -5,6 +5,7 @@ on: branches: [ main ] pull_request: workflow_call: + workflow_dispatch: jobs: test: From e91abed708bb1ed189ecad3bb6de64e3c91ff1d7 Mon Sep 17 00:00:00 2001 From: jcpitre Date: Thu, 4 Jun 2026 14:04:31 -0400 Subject: [PATCH 3/5] Removed some triggers for the test workflows since they are handled by ci.yml. --- .github/workflows/python-test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 379f598..d92914d 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -1,9 +1,6 @@ name: Python Tests on: - push: - branches: [ main ] - pull_request: workflow_call: workflow_dispatch: From 07f7f5c89a328e841255c08fa39c5f8b51113c69 Mon Sep 17 00:00:00 2001 From: jcpitre Date: Thu, 4 Jun 2026 14:07:45 -0400 Subject: [PATCH 4/5] Trim python-test.yml to oldest and latest Python versions only --- .github/workflows/python-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index d92914d..6985fb4 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -9,7 +9,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.10", "3.11", "3.12", "3.13"] + # Oldest and latest supported versions — sufficient to catch compatibility issues + python-version: ["3.10", "3.13"] steps: - uses: actions/checkout@v4 From 0ad648ef67487e4fbd69c44abde4cad0957bfcf8 Mon Sep 17 00:00:00 2001 From: jcpitre Date: Mon, 8 Jun 2026 09:18:12 -0400 Subject: [PATCH 5/5] Used the same versions in ci.yml and python-test.yml --- .github/workflows/python-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 6985fb4..f715615 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: # Oldest and latest supported versions — sufficient to catch compatibility issues - python-version: ["3.10", "3.13"] + python-version: ["3.10", "3.12", "3.14"] steps: - uses: actions/checkout@v4