Skip to content

Commit 9ba39c9

Browse files
authored
Update PyPI workflows (#335)
* Separate workflows * Change wf name * Prova update version
1 parent 7c28ba2 commit 9ba39c9

File tree

3 files changed

+238
-181
lines changed

3 files changed

+238
-181
lines changed

.github/workflows/binding.yml

Lines changed: 2 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
name: "CI: Test Python Bindings Installation and Publish"
1+
name: "CI: Test Python Bindings Installation"
22

33
on:
44
push:
55
branches: [ "main" ]
6-
tags:
7-
- 'v*.*.*'
86
pull_request:
97
branches: [ "main" ]
108

@@ -231,180 +229,4 @@ jobs:
231229
# List available attributes
232230
attrs = [attr for attr in dir(dsf) if not attr.startswith('_')]
233231
print(f'Available DSF attributes ({len(attrs)}): {attrs}')
234-
"
235-
236-
build-wheels-linux:
237-
name: Build wheels on Linux (Python ${{ matrix.python-version }})
238-
needs: [test-binding-installation, test-binding-development]
239-
runs-on: ubuntu-latest
240-
if: github.event_name == 'pull_request' || (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
241-
strategy:
242-
matrix:
243-
python-version: ['3.10', '3.12']
244-
245-
steps:
246-
- name: Checkout repository
247-
uses: actions/checkout@v4
248-
249-
- name: Set up Python ${{ matrix.python-version }}
250-
uses: actions/setup-python@v4
251-
with:
252-
python-version: ${{ matrix.python-version }}
253-
254-
- name: Install system dependencies
255-
run: |
256-
sudo apt update
257-
sudo apt install -y cmake build-essential doxygen libtbb-dev libfmt-dev libspdlog-dev libsimdjson-dev
258-
259-
- name: Install build dependencies
260-
run: |
261-
python -m pip install --upgrade pip
262-
python -m pip install build wheel setuptools pybind11-stubgen auditwheel
263-
264-
- name: Build wheel
265-
run: |
266-
rm -rf dist wheelhouse
267-
python -m build --wheel
268-
269-
- name: Repair wheel (auditwheel)
270-
run: |
271-
mkdir -p wheelhouse
272-
auditwheel repair dist/*.whl -w wheelhouse
273-
274-
- name: Test wheel installation
275-
run: |
276-
python -m pip install wheelhouse/*.whl
277-
python -c "import dsf; print('DSF wheel installation successful')"
278-
279-
- name: Upload wheels as artifacts
280-
uses: actions/upload-artifact@v4
281-
with:
282-
name: wheel-linux-${{ matrix.python-version }}
283-
path: wheelhouse/*.whl
284-
285-
build-wheels-macos:
286-
name: Build wheels on macOS (Python ${{ matrix.python-version }})
287-
needs: [test-binding-installation, test-binding-development]
288-
runs-on: macos-latest
289-
if: github.event_name == 'pull_request' || (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
290-
strategy:
291-
matrix:
292-
python-version: ['3.10', '3.12']
293-
294-
steps:
295-
- name: Checkout repository
296-
uses: actions/checkout@v4
297-
298-
- name: Set up Python ${{ matrix.python-version }}
299-
uses: actions/setup-python@v4
300-
with:
301-
python-version: ${{ matrix.python-version }}
302-
303-
- name: Install system dependencies
304-
run: |
305-
brew install cmake tbb spdlog simdjson doxygen
306-
307-
- name: Install build dependencies
308-
run: |
309-
python -m pip install --upgrade pip
310-
python -m pip install build wheel setuptools pybind11-stubgen delocate
311-
312-
- name: Set macOS environment variables
313-
run: |
314-
echo "CPLUS_INCLUDE_PATH=$(brew --prefix tbb)/include:$(brew --prefix fmt)/include:$(brew --prefix spdlog)/include:$(brew --prefix simdjson)/include" >> $GITHUB_ENV
315-
echo "LIBRARY_PATH=$(brew --prefix tbb)/lib:$(brew --prefix fmt)/lib:$(brew --prefix spdlog)/lib:$(brew --prefix simdjson)/lib" >> $GITHUB_ENV
316-
echo "CMAKE_PREFIX_PATH=$(brew --prefix tbb);$(brew --prefix fmt);$(brew --prefix spdlog);$(brew --prefix simdjson)" >> $GITHUB_ENV
317-
echo "ARCHFLAGS=-arch $(uname -m)" >> $GITHUB_ENV
318-
echo "_PYTHON_HOST_PLATFORM=macosx-$(sw_vers -productVersion | cut -d. -f1)-$(uname -m)" >> $GITHUB_ENV
319-
320-
- name: Build wheel
321-
run: python -m build --wheel
322-
323-
- name: Repair wheel (bundle libraries)
324-
run: |
325-
mkdir -p wheelhouse
326-
delocate-wheel -w wheelhouse -v --require-archs $(uname -m) dist/*.whl
327-
328-
- name: Upload wheels as artifacts
329-
uses: actions/upload-artifact@v4
330-
with:
331-
name: wheel-macos-${{ matrix.python-version }}
332-
path: wheelhouse/*.whl
333-
334-
build-sdist:
335-
name: Build source distribution
336-
needs: [test-binding-installation, test-binding-development]
337-
runs-on: ubuntu-latest
338-
if: github.event_name == 'pull_request' || (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
339-
340-
steps:
341-
- name: Checkout repository
342-
uses: actions/checkout@v4
343-
344-
- name: Set up Python
345-
uses: actions/setup-python@v4
346-
with:
347-
python-version: "3.12"
348-
349-
- name: Install system dependencies
350-
run: |
351-
sudo apt update
352-
sudo apt install -y cmake build-essential libtbb-dev libspdlog-dev libsimdjson-dev doxygen
353-
354-
- name: Install build dependencies
355-
run: |
356-
python -m pip install --upgrade pip
357-
python -m pip install build
358-
359-
- name: Build source distribution
360-
run: python -m build --sdist
361-
362-
- name: Upload sdist as artifact
363-
uses: actions/upload-artifact@v4
364-
with:
365-
name: sdist
366-
path: dist/*.tar.gz
367-
368-
publish:
369-
name: Publish to PyPI
370-
needs: [build-wheels-linux, build-wheels-macos, build-sdist]
371-
runs-on: ubuntu-latest
372-
if: github.event_name == 'pull_request' || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
373-
374-
steps:
375-
- name: Download all artifacts
376-
uses: actions/download-artifact@v4
377-
with:
378-
path: dist-artifacts
379-
380-
- name: Collect all distributions
381-
run: |
382-
mkdir -p dist
383-
find dist-artifacts -name '*.whl' -exec cp {} dist/ \;
384-
find dist-artifacts -name '*.tar.gz' -exec cp {} dist/ \;
385-
echo "Contents of dist/:"
386-
ls -la dist/
387-
388-
- name: Set up Python
389-
uses: actions/setup-python@v4
390-
with:
391-
python-version: "3.12"
392-
393-
- name: Install twine
394-
run: python -m pip install twine
395-
396-
- name: Publish to TestPyPI (on PR)
397-
if: github.event_name == 'pull_request'
398-
env:
399-
TWINE_USERNAME: __token__
400-
TWINE_PASSWORD: ${{ secrets.TEST_PYPI }}
401-
run: |
402-
python -m twine upload --repository testpypi dist/* --verbose
403-
404-
- name: Publish to PyPI (on tag)
405-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
406-
env:
407-
TWINE_USERNAME: __token__
408-
TWINE_PASSWORD: ${{ secrets.PYPI }}
409-
run: |
410-
python -m twine upload dist/* --verbose
232+
"

0 commit comments

Comments
 (0)