Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit c7104e3

Browse files
refine packaging ci
1 parent 0b34cbe commit c7104e3

File tree

1 file changed

+86
-30
lines changed

1 file changed

+86
-30
lines changed

.github/workflows/package.yml

Lines changed: 86 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,20 @@ on:
77
branches: [main]
88
release:
99
types: [published]
10-
workflow_dispatch: {}
10+
workflow_dispatch:
11+
inputs:
12+
publish:
13+
description: 'Publish to PyPI'
14+
required: false
15+
default: 'false'
16+
type: choice
17+
options:
18+
- 'true'
19+
- 'false'
1120

1221
jobs:
13-
# TODO: add testing functionality on Intel runner, by Intel team
14-
# test:
15-
# runs-on: ubuntu-latest
16-
# strategy:
17-
# matrix:
18-
# python-version: ["3.8", "3.9", "3.10", "3.11"]
19-
# steps:
20-
# - uses: actions/checkout@v4
21-
# - name: Set up Python ${{ matrix.python-version }}
22-
# uses: actions/setup-python@v5
23-
# with:
24-
# python-version: ${{ matrix.python-version }}
25-
# cache: pip
26-
# - name: Install dependencies
27-
# run: |
28-
# python -m pip install --upgrade pip
29-
# pip install pytest
30-
# pip install -e .
31-
# - name: Test with pytest
32-
# run: pytest
33-
34-
build-and-publish:
35-
# needs: test
22+
build:
3623
runs-on: ubuntu-latest
37-
if: github.event_name == 'release' && github.event.action == 'published'
38-
environment:
39-
name: release
40-
url: https://pypi.org/p/bitsandbytes-intel
41-
permissions:
42-
id-token: write
4324
steps:
4425
- uses: actions/checkout@v4
4526
- name: Set up Python
@@ -52,5 +33,80 @@ jobs:
5233
pip install build wheel
5334
- name: Build package
5435
run: python -m build
36+
- name: Upload build artifact
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: dist
40+
path: dist/
41+
retention-days: 7
42+
43+
test:
44+
needs: build
45+
runs-on: ubuntu-latest
46+
strategy:
47+
matrix:
48+
python-version:
49+
- "3.9"
50+
# - "3.10"
51+
# - "3.11"
52+
# - "3.12"
53+
# - "3.13"
54+
steps:
55+
- uses: actions/checkout@v4
56+
57+
- name: Checkout bitsandbytes
58+
uses: actions/checkout@v4
59+
with:
60+
repository: bitsandbytes-foundation/bitsandbytes
61+
path: bitsandbytes
62+
63+
- name: Set up Python ${{ matrix.python-version }}
64+
uses: actions/setup-python@v5
65+
with:
66+
python-version: ${{ matrix.python-version }}
67+
cache: pip
68+
69+
- name: Download build artifacts
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: dist
73+
path: dist/
74+
75+
- name: Install dependencies and built package
76+
run: |
77+
python -m pip install --upgrade pip
78+
pip install ./bitsandbytes
79+
pip install dist/*.whl
80+
81+
- name: Test import works
82+
run: |
83+
python -c "
84+
import bitsandbytes
85+
print('✅ bitsandbytes import successful')
86+
import bnb_intel
87+
print('✅ bnb_intel import successful')
88+
print('✅ All imports successful')
89+
"
90+
91+
# - name: Test with pytest
92+
# run: pytest
93+
94+
publish:
95+
needs: [build, test]
96+
runs-on: ubuntu-latest
97+
if: github.event_name == 'release' && github.event.action == 'published' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true')
98+
environment:
99+
name: release
100+
url: https://pypi.org/p/bitsandbytes-intel
101+
permissions:
102+
id-token: write
103+
steps:
104+
- name: Download build artifacts
105+
uses: actions/download-artifact@v4
106+
with:
107+
name: dist
108+
path: dist/
55109
- name: Publish to PyPI
56110
uses: pypa/gh-action-pypi-publish@release/v1
111+
with:
112+
packages-dir: dist/

0 commit comments

Comments
 (0)