Review findings: RELEASING.md claimed publishing happens exclusively from release.yml with no registry tokens, but typescript.yml and python.yml still carried release:[published] publish jobs — never fired (releases are created with GITHUB_TOKEN, which suppresses workflow triggers) and unable to succeed under OIDC (typescript.yml's still referenced the deleted NPM_TOKEN). Remove both jobs and their release triggers; the workflows are now pure CI. Also: - add skip-existing to the PyPI publish action so re-runs tolerate already-uploaded files, and describe the per-registry guard accurately in RELEASING.md (npm aborts; PyPI skips) - correct the fresh-dispatch note: same-day dispatches collide on the date-granular tag rather than minting a new version Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AViME1R9ES2UXT1uQDx1TG
95 lines
2.6 KiB
YAML
95 lines
2.6 KiB
YAML
name: Python
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
jobs:
|
|
detect-packages:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
packages: ${{ steps.find-packages.outputs.packages }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Find Python packages
|
|
id: find-packages
|
|
working-directory: src
|
|
run: |
|
|
PACKAGES=$(find . -name pyproject.toml -exec dirname {} \; | sed 's/^\.\///' | jq -R -s -c 'split("\n")[:-1]')
|
|
echo "packages=$PACKAGES" >> $GITHUB_OUTPUT
|
|
|
|
test:
|
|
needs: [detect-packages]
|
|
strategy:
|
|
matrix:
|
|
package: ${{ fromJson(needs.detect-packages.outputs.packages) }}
|
|
name: Test ${{ matrix.package }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v3
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version-file: "src/${{ matrix.package }}/.python-version"
|
|
|
|
- name: Install dependencies
|
|
working-directory: src/${{ matrix.package }}
|
|
run: uv sync --frozen --all-extras --dev
|
|
|
|
- name: Check if tests exist
|
|
id: check-tests
|
|
working-directory: src/${{ matrix.package }}
|
|
run: |
|
|
if [ -d "tests" ] || [ -d "test" ] || grep -q "pytest" pyproject.toml; then
|
|
echo "has-tests=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "has-tests=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Run tests
|
|
if: steps.check-tests.outputs.has-tests == 'true'
|
|
working-directory: src/${{ matrix.package }}
|
|
run: uv run pytest
|
|
|
|
build:
|
|
needs: [detect-packages, test]
|
|
strategy:
|
|
matrix:
|
|
package: ${{ fromJson(needs.detect-packages.outputs.packages) }}
|
|
name: Build ${{ matrix.package }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v3
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version-file: "src/${{ matrix.package }}/.python-version"
|
|
|
|
- name: Install dependencies
|
|
working-directory: src/${{ matrix.package }}
|
|
run: uv sync --locked --all-extras --dev
|
|
|
|
- name: Run pyright
|
|
working-directory: src/${{ matrix.package }}
|
|
run: uv run --frozen pyright
|
|
|
|
- name: Build package
|
|
working-directory: src/${{ matrix.package }}
|
|
run: uv build
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: dist-${{ matrix.package }}
|
|
path: src/${{ matrix.package }}/dist/
|