Skip to content

Commit a0cd289

Browse files
Migrate to unified test workflow with build-and-inspect
- Replace separate main.yml and deploy.yml with unified test.yml - Use hynek/build-and-inspect-python-package@v2 for building - Remove SETUPTOOLS_SCM_PRETEND_VERSION hack (no longer needed) - Test actual built wheel artifacts instead of source - Migrate from hatch to uv for faster dependency management - Add uv caching with astral-sh/setup-uv@v7 - Use trusted publishing with correct environment names - Enable build provenance attestations for supply chain security 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4fa1d19 commit a0cd289

3 files changed

Lines changed: 102 additions & 89 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: test
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
jobs:
6+
build-and-inspect:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
14+
- name: Build and inspect package
15+
uses: hynek/build-and-inspect-python-package@v2
16+
with:
17+
attest-build-provenance-github: true
18+
19+
test:
20+
needs: build-and-inspect
21+
runs-on: ${{ matrix.os }}
22+
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
27+
os: [ubuntu-latest, windows-latest]
28+
29+
steps:
30+
- name: Download built packages
31+
uses: actions/download-artifact@v4
32+
with:
33+
name: Packages
34+
path: dist
35+
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@v7
38+
with:
39+
enable-cache: true
40+
41+
- name: Set up Python ${{ matrix.python }}
42+
run: uv python install ${{ matrix.python }}
43+
44+
- name: Install package from wheel
45+
run: uv pip install --system dist/*.whl
46+
47+
- name: Download test files
48+
uses: actions/checkout@v4
49+
with:
50+
sparse-checkout: |
51+
testing
52+
sparse-checkout-cone-mode: false
53+
54+
- name: Run tests
55+
run: uv run pytest testing --color=yes
56+
57+
publish-to-pypi:
58+
name: Publish to PyPI
59+
if: github.event_name == 'push' && github.event.action == 'published'
60+
needs: [test, build-and-inspect]
61+
runs-on: ubuntu-latest
62+
environment: pypi-upload
63+
permissions:
64+
id-token: write
65+
attestations: write
66+
67+
steps:
68+
- name: Download built packages
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: Packages
72+
path: dist
73+
74+
- name: Publish package to PyPI
75+
uses: pypa/gh-action-pypi-publish@release/v1
76+
77+
publish-to-test-pypi:
78+
name: Publish to TestPyPI
79+
if: |
80+
github.repository == 'pytest-dev/iniconfig' &&
81+
(github.event_name == 'push' && (
82+
github.ref == 'refs/heads/main' ||
83+
contains(github.ref, 'deploy')
84+
))
85+
needs: [test, build-and-inspect]
86+
runs-on: ubuntu-latest
87+
environment: test-pypi-upload
88+
permissions:
89+
id-token: write
90+
attestations: write
91+
92+
steps:
93+
- name: Download built packages
94+
uses: actions/download-artifact@v4
95+
with:
96+
name: Packages
97+
path: dist
98+
99+
- name: Publish package to TestPyPI
100+
uses: pypa/gh-action-pypi-publish@release/v1
101+
with:
102+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)