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

Commit 3308459

Browse files
Merge remote-tracking branch 'refs/remotes/origin/main'
2 parents 4b06538 + aeace86 commit 3308459

File tree

1 file changed

+97
-30
lines changed

1 file changed

+97
-30
lines changed

.github/workflows/package.yml

Lines changed: 97 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,91 @@ 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: Install build tools
70+
run: |
71+
sudo apt-get update
72+
sudo apt-get install -y build-essential cmake
73+
74+
- name: Compile bitsandbytes with CPU backend
75+
run: |
76+
cd bitsandbytes
77+
cmake -DCOMPUTE_BACKEND=cpu -S . && make
78+
cd ..
79+
80+
- name: Download build artifacts
81+
uses: actions/download-artifact@v4
82+
with:
83+
name: dist
84+
path: dist/
85+
86+
- name: Install dependencies and built package
87+
run: |
88+
python -m pip install --upgrade pip
89+
pip install ./bitsandbytes
90+
pip install dist/*.whl
91+
92+
- name: Test import works
93+
run: |
94+
python -c "
95+
import bitsandbytes
96+
print('✅ bitsandbytes import successful')
97+
import bnb_intel
98+
print('✅ bnb_intel import successful')
99+
print('✅ All imports successful')
100+
"
101+
102+
# - name: Test with pytest
103+
# run: pytest
104+
105+
publish:
106+
needs: [build, test]
107+
runs-on: ubuntu-latest
108+
if: github.event_name == 'release' && github.event.action == 'published' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true')
109+
environment:
110+
name: release
111+
url: https://pypi.org/p/bitsandbytes-intel
112+
permissions:
113+
id-token: write
114+
steps:
115+
- name: Download build artifacts
116+
uses: actions/download-artifact@v4
117+
with:
118+
name: dist
119+
path: dist/
55120
- name: Publish to PyPI
56121
uses: pypa/gh-action-pypi-publish@release/v1
122+
with:
123+
packages-dir: dist/

0 commit comments

Comments
 (0)