|
1 |
| -name: Publish |
| 1 | +name: Build Wheels & Release |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - pull_request: |
5 |
| - branches: |
6 |
| - - main |
7 |
| - push: |
8 |
| - branches: |
9 |
| - - main |
10 | 4 | workflow_dispatch:
|
11 | 5 | inputs:
|
12 | 6 | pypi:
|
|
15 | 9 | required: true
|
16 | 10 | type: string
|
17 | 11 |
|
18 |
| -jobs: |
19 |
| - build-linux: |
20 |
| - |
21 |
| - runs-on: ubuntu-20.04 |
22 |
| - strategy: |
23 |
| - matrix: |
24 |
| - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
| 12 | +permissions: |
| 13 | + contents: write |
25 | 14 |
|
| 15 | +jobs: |
| 16 | + build_sdist_and_wheel: |
| 17 | + name: Build source distribution and pure-Python wheel |
| 18 | + runs-on: ubuntu-latest |
26 | 19 | steps:
|
27 |
| - - uses: actions/checkout@v4 |
28 |
| - with: |
29 |
| - submodules: "recursive" |
30 |
| - - name: Set up Python ${{ matrix.python-version }} |
31 |
| - uses: actions/setup-python@v4 |
32 |
| - with: |
33 |
| - python-version: ${{ matrix.python-version }} |
34 |
| - - name: Install dependencies |
35 |
| - run: | |
36 |
| - python3 -m pip install --upgrade pip |
37 |
| - python3 -m pip install build |
38 |
| - python3 -m pip install .[all] -v |
39 |
| - - name: Build Wheel |
40 |
| - id: build-wheel-sdist |
41 |
| - run: | |
42 |
| - python -m build -n |
43 |
| - |
44 |
| - - uses: actions/upload-artifact@v3 |
| 20 | + - uses: actions/checkout@v2 |
| 21 | + - id: build |
| 22 | + uses: OpenAstronomy/build-python-dist@v1 |
45 | 23 | with:
|
46 |
| - name: 'wheel' |
47 |
| - path: ./dist/* # Use ./dist/*.whl to only upload the JIT compile wheel |
| 24 | + pure_python_wheel: true |
48 | 25 |
|
49 |
| - build-windows: |
50 |
| - |
51 |
| - runs-on: windows-latest |
52 |
| - strategy: |
53 |
| - matrix: |
54 |
| - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
55 |
| - |
56 |
| - steps: |
57 |
| - - uses: actions/checkout@v3 |
58 |
| - with: |
59 |
| - submodules: "recursive" |
60 |
| - - name: Set up Python ${{ matrix.python-version }} |
61 |
| - uses: actions/setup-python@v4 |
62 |
| - with: |
63 |
| - python-version: ${{ matrix.python-version }} |
64 |
| - - name: Install dependencies |
65 |
| - run: | |
66 |
| - python3 -m pip install --upgrade pip |
67 |
| - python3 -m pip install .[all] -v |
68 | 26 | - uses: actions/upload-artifact@v3
|
69 | 27 | with:
|
70 |
| - name: 'wheel' |
71 |
| - path: ./dist/* # Use ./dist/*.whl to only upload the JIT compile wheel |
72 |
| - |
73 |
| - |
74 |
| - build-macos: |
75 |
| - |
76 |
| - runs-on: macos-latest |
77 |
| - strategy: |
78 |
| - matrix: |
79 |
| - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
80 |
| - |
| 28 | + name: 'sdist' |
| 29 | + path: ./dist/* |
| 30 | + |
| 31 | + publish-sdist-to-pypi: |
| 32 | + name: Publish Python distribution to PyPI |
| 33 | + if: inputs.pypi == '1' |
| 34 | + needs: build_sdist_and_wheel |
| 35 | + runs-on: ubuntu-latest |
| 36 | + |
| 37 | + environment: |
| 38 | + name: pypi |
| 39 | + url: https://pypi.org/p/llama_cpp_conv |
| 40 | + permissions: |
| 41 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 42 | + |
81 | 43 | steps:
|
82 |
| - - uses: actions/checkout@v3 |
83 |
| - with: |
84 |
| - submodules: "recursive" |
85 |
| - - name: Set up Python ${{ matrix.python-version }} |
86 |
| - uses: actions/setup-python@v4 |
| 44 | + - name: Download the sdist |
| 45 | + uses: actions/download-artifact@v3 |
87 | 46 | with:
|
88 |
| - python-version: ${{ matrix.python-version }} |
89 |
| - - name: Install dependencies |
90 |
| - run: | |
91 |
| - python3 -m pip install --upgrade pip |
92 |
| - python3 -m pip install .[all] --verbose |
93 |
| - - uses: actions/upload-artifact@v3 |
94 |
| - with: |
95 |
| - name: 'wheel' |
96 |
| - path: ./dist/* # Use ./dist/*.whl to only upload the JIT compile wheel |
97 |
| - |
98 |
| - # build-linux-opencl: |
99 |
| - |
100 |
| - # runs-on: ubuntu-latest |
101 |
| - |
102 |
| - # steps: |
103 |
| - # - uses: actions/checkout@v3 |
104 |
| - # with: |
105 |
| - # submodules: "recursive" |
106 |
| - # - name: Set up Python 3.8 |
107 |
| - # uses: actions/setup-python@v4 |
108 |
| - # with: |
109 |
| - # python-version: "3.8" |
110 |
| - # - name: Set up OpenCL & CLBlast |
111 |
| - # run: | |
112 |
| - # wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null |
113 |
| - # echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list |
114 |
| - # sudo apt-get update |
115 |
| - # sudo apt-get install -y --no-install-recommends llvm intel-oneapi-runtime-opencl intel-oneapi-runtime-compilers libclblast-dev |
116 |
| - # - name: Install dependencies |
117 |
| - # run: | |
118 |
| - # python3 -m pip install --upgrade pip |
119 |
| - # CMAKE_ARGS="-DLLAMA_CLBLAST=on" python3 -m pip install .[all] --verbose |
120 |
| - |
121 |
| - |
122 |
| - build-macos-metal: |
123 |
| - |
124 |
| - runs-on: macos-latest |
125 |
| - |
126 |
| - steps: |
127 |
| - - uses: actions/checkout@v4 |
128 |
| - with: |
129 |
| - submodules: "recursive" |
130 |
| - - name: Set up Python |
131 |
| - uses: actions/setup-python@v5 |
132 |
| - with: |
133 |
| - python-version: "3.8" |
134 |
| - - name: Install dependencies |
135 |
| - run: | |
136 |
| - python3 -m pip install --upgrade pip build |
137 |
| - python3 -m pip install -e .[all] |
138 |
| - - name: Build source distribution |
139 |
| - run: | |
140 |
| - python3 -m build --sdist |
141 |
| - - name: Publish distribution to PyPI |
142 |
| - # TODO: move to tag based releases |
143 |
| - # if: startsWith(github.ref, 'refs/tags') |
144 |
| - uses: pypa/gh-action-pypi-publish@release/v1 |
145 |
| - with: |
146 |
| - password: ${{ secrets.PYPI_API_TOKEN }} |
| 47 | + name: sdist |
| 48 | + path: dist/ |
| 49 | + - name: Publish distribution to PyPI |
| 50 | + |
0 commit comments