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
54 changes: 54 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Tests and package checks

on:
pull_request:
push:
branches: ['**']
workflow_call:

permissions:
contents: read

jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python: '3.8'
extras: test
- os: ubuntu-latest
python: '3.12'
extras: 'test,full'
- os: ubuntu-latest
python: '3.14'
extras: 'test,full'
- os: windows-latest
python: '3.14'
extras: test
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
cache: pip
- name: Install package and test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[${{ matrix.extras }}]" "setuptools>=61" build wheel twine
- name: Run deterministic regression and integration tests
run: python -m pytest
- name: Build and validate distributions
run: |
python -m build --no-isolation
python -m twine check dist/*
- name: Smoke test the installed wheel outside the source import path
run: |
python -m pip install --no-deps --force-reinstall dist/*.whl
python -I tests/wheel_smoke.py
79 changes: 57 additions & 22 deletions .github/workflows/tfq0seo-publish.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,71 @@
name: Publish to PyPI

on:
release:
types: [created]
push:
tags:
- 'v*' # Trigger on version tags
- 'v*'

permissions:
contents: read

jobs:
checks:
if: github.event.deleted == false
uses: ./.github/workflows/tests.yml
build:
needs: checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version: '3.14'
- name: Install build tools
run: python -m pip install build twine
- name: Build package
run: python -m build
- name: Validate release version and distributions
env:
RELEASE_TAG: ${{ github.ref_name }}
run: |
python -m twine check dist/*
python - <<'PY'
import os
from email.parser import BytesParser
from pathlib import Path
from zipfile import ZipFile

wheel, = Path('dist').glob('*.whl')
with ZipFile(wheel) as archive:
metadata_path, = (
name for name in archive.namelist()
if name.endswith('.dist-info/METADATA')
)
metadata = BytesParser().parsebytes(archive.read(metadata_path))
expected = 'v' + metadata['Version']
if os.environ['RELEASE_TAG'] != expected:
raise SystemExit('Release tag must match package version: ' + expected)
PY
- name: Store validated distributions
uses: actions/upload-artifact@v7
with:
name: python-distributions
path: dist/
if-no-files-found: error

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/tfq0seo
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

id-token: write
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: python -m build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Download validated distributions
uses: actions/download-artifact@v8
with:
name: python-distributions
path: dist/
- name: Publish distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ cython_debug/
# Reports
reports/
*.html
# Bundled report templates are source files, not generated reports.
!tfq0seo/templates/*.html
*.csv
*.xlsx
*.json
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ include requirements.txt
include pyproject.toml
recursive-include tfq0seo/templates *.html
recursive-include tfq0seo *.py
recursive-include tests *.py
recursive-include docs *.md *.benchmark
global-exclude __pycache__
global-exclude *.py[co]
global-exclude .DS_Store
Loading
Loading