Skip to content

Commit 6b49716

Browse files
authored
Create python-package.yml
Package python dist using the Makefile target
1 parent 04892f3 commit 6b49716

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/python-package.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Build-only workflow — runs `make dist` to create sdist & wheel, no lint/tests
2+
# Docs: https://docs.github.com/en/actions | PyPA build: https://pypi.org/project/build
3+
4+
name: Build Python Package
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
build-package:
14+
runs-on: ubuntu-latest
15+
16+
# Build the package under multiple Python versions to catch ABI issues early
17+
strategy:
18+
matrix:
19+
python-version: [ "3.10", "3.11", "3.12" ] # Extend as needed
20+
21+
steps:
22+
# 1️⃣ Check out repository so Makefile & sources are available
23+
- name: Checkout code
24+
uses: actions/checkout@v4 # Standard checkout step
25+
26+
# 2️⃣ Set up the requested Python version from the runner tool-cache
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v5 # Recommended approach for consistent PATH
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
32+
# 3️⃣ Install build front-end; Keep pip current
33+
- name: Install build tool
34+
run: |
35+
python -m pip install --upgrade pip
36+
python -m pip install build # PyPA-endorsed PEP 517 builder
37+
38+
# 4️⃣ Invoke the Makefile ‘dist’ target (creates ./dist/*.whl & *.tar.gz)
39+
- name: Build distributions
40+
run: make dist # Uses the Makefile’s `dist` rule
41+
42+
# 5️⃣ Upload built artifacts so they can be downloaded from the run page
43+
- name: Upload distributions
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: python-package-${{ matrix.python-version }}
47+
path: dist/*

0 commit comments

Comments
 (0)