|
7 | 7 | branches: [main] |
8 | 8 | release: |
9 | 9 | 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' |
11 | 20 |
|
12 | 21 | 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: |
36 | 23 | 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 |
43 | 24 | steps: |
44 | 25 | - uses: actions/checkout@v4 |
45 | 26 | - name: Set up Python |
|
52 | 33 | pip install build wheel |
53 | 34 | - name: Build package |
54 | 35 | 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/ |
55 | 120 | - name: Publish to PyPI |
56 | 121 | uses: pypa/gh-action-pypi-publish@release/v1 |
| 122 | + with: |
| 123 | + packages-dir: dist/ |
0 commit comments