diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3c352ad --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,53 @@ +name: ci + +# Runs the local checks of the README on every push to main and on pull requests. +# Actions are pinned by commit SHA, with the version in a comment. + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +# A new push to a pull request cancels the run it replaces. Every other run has a group of its own. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + +jobs: + test: + name: py${{ matrix.python }}${{ matrix.lint && ', lint, types and build' || '' }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + # The oldest and the newest Python the package supports. The lint, type and build checks run once. + - python: "3.10" + - python: "3.14" + lint: true + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: ${{ matrix.python }} + cache: pip + cache-dependency-path: pyproject.toml + # The dev tools are a PEP 735 dependency group, which pip installs from version 25.1. + - run: python -m pip install --upgrade "pip>=25.1" + - run: pip install -e . --group dev + - run: pytest -q + - if: matrix.lint + run: ruff check . + - if: matrix.lint + run: ruff format --check . + - if: matrix.lint + run: mypy + - if: matrix.lint + run: | + pip install build twine + python -m build + twine check dist/* diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..52d0ba3 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,65 @@ +name: publish + +# Publishes to PyPI when a GitHub Release is published. Provenance: +# faxforagents/sdk-python/.github/workflows/publish.yml (2026-11-17), actions pinned by SHA. +# +# PyPI Trusted Publishing (OIDC): no API token is stored anywhere. PyPI verifies this workflow's +# identity. One-time setup on PyPI (Manage project, Publishing, Add a trusted publisher): +# Owner: faxforagents Repository: haystack-tools Workflow name: publish.yml Environment: pypi + +on: + release: + types: [published] + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + name: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: "3.12" + # The dev tools are a PEP 735 dependency group, which pip installs from version 25.1. + - run: python -m pip install --upgrade "pip>=25.1" + - run: pip install -e . --group dev build twine + - name: Test before publishing + run: pytest -q + - name: Assert the tag matches the package version + if: github.event_name == 'release' + run: | + TAG="${GITHUB_REF_NAME#v}" + PKG="$(python -c 'import tomllib;print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"])')" + if [ "$TAG" != "$PKG" ]; then + echo "::error::release tag ($TAG) does not match pyproject version ($PKG)" + exit 1 + fi + echo "tag and version agree: $PKG" + - run: python -m build + - run: twine check dist/* + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: dist + path: dist/ + + publish: + name: publish to PyPI + needs: build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/faxforagents-haystack + permissions: + id-token: write + steps: + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: dist + path: dist/ + - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 + with: + attestations: true diff --git a/README.md b/README.md index e446726..6e79db6 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@
+
+
@@ -234,6 +236,7 @@ uv run mypy
uv build
```
+CI runs these checks with Python 3.10 and 3.14 on every push to main and on each pull request.
Tests use fake SDK resources and mocked HTTP responses.
They cover validation, approvals, idempotency, untrusted data, serialization, ToolInvoker execution, and the offline Agent.
No live fax is sent during verification.