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

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

jobs:
tests:
name: Tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install package and test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e . pytest

- name: Run tests
run: pytest

package:
name: Package build
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Build distributions
run: |
python -m pip install --upgrade pip
python -m pip install build twine
python -m build
python -m twine check dist/*
60 changes: 60 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish to PyPI

on:
push:
tags:
- "v*"

permissions:
contents: read

jobs:
build:
name: Build distributions
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Build and check distributions
run: |
python -m pip install --upgrade pip
python -m pip install build twine
python -m build
python -m twine check dist/*

- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
if-no-files-found: error

publish:
name: Publish distributions
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/csvsmith/
permissions:
contents: read
id-token: write

steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
26 changes: 26 additions & 0 deletions docs/source/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,32 @@ To build the documentation locally, you need Sphinx installed.

The generated HTML files will be in `docs/build/html`.

Release publishing
------------------

PyPI publishing is handled by GitHub Actions when a version tag is pushed.
The workflow uses PyPI Trusted Publishing, so no long-lived PyPI API token is
stored in GitHub.

Before the first automated publish, configure a Trusted Publisher for the
``csvsmith`` project on PyPI with these values:

- Owner: ``yeiichi``
- Repository name: ``csvsmith``
- Workflow name: ``pypi.yml``
- Environment name: ``pypi``

To publish a release, make sure ``pyproject.toml`` contains the intended
version, then create and push the matching tag:

.. code-block:: bash

git tag v0.10.0
git push origin v0.10.0

The PyPI workflow builds the source distribution and wheel, checks them with
Twine, and publishes them to PyPI.

Contributing
------------

Expand Down
2 changes: 1 addition & 1 deletion tests/test_normalize.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File: tests/test_normalize.py

from src.csvsmith.utils.normalize import normalize
from csvsmith.utils.normalize import normalize


def test_normalize_with_spaces():
Expand Down
Loading