Skip to content

checking github actions (again) #6

checking github actions (again)

checking github actions (again) #6

name: Deploying to pypi (linux/macOS/windows)
on:
push:
tags:
- '*' # TODO: set filter here if multiple tags are required
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
TESTBLACKLIST: "(testLinearStructure|testIntegerConverter|testArithmeticalDSSComputerOnSurfels)"
# No options, setup.py already has it all !
CONFIG_GLOBAL:
CONFIG_LINUX:
CONFIG_MAC:
CONFIG_WINDOWS:
jobs:
build:
if: startsWith(github.ref, 'refs/tags/') # Only if tagged
runs-on: ${{ matrix.os }}
environment: deploy
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11"]
BUILD_TYPE: [Release]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Installing dependancies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install zsh libqglviewer-dev-qt5 libboost-dev libcgal-dev ninja-build libhdf5-serial-dev libboost-dev libcairo2-dev libgmp-dev libfftw3-dev libinsighttoolkit4-dev xorg-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev
- name: Installing dependancies (macOS)
if: matrix.os == 'macOS-latest'
run: brew install boost ninja gmp libomp ccache cgal
- name: Install dependancies (conan - Windows 1/2)
if: matrix.os == 'windows-latest'
id: conan
uses: turtlebrowser/get-conan@main
with:
version: 2.4.0
- name: Install dependancies (conan - Windows 2/2)
if: matrix.os == 'windows-latest'
run: |
conan profile detect --force
- uses: actions/cache@v3
if: matrix.os == 'windows-latest'
with:
path: ~/.conan
key: ${{ runner.os }}-conan2-${{ matrix.BUILD_TYPE }}
- name: Install python dependencies
shell: bash
run: |
python -m pip install cmake
python -m pip install delocate
python -m pip install scikit-build
- name: Setting build informations (Linux)
if: matrix.os == 'ubuntu-latest'
shell: bash
working-directory: wrap/deploy
run: |
sed -i "1s/.*/VERSION = '${{ github.ref_name }}'/" dgtalVersion.py
cat dgtalVersion.py
- name: Setting build informations (Mac os)
if: matrix.os == 'macOS-latest'
shell: bash
working-directory: wrap/deploy
run: |
# Note the emtpy strings required on macos !
sed -i '' "1s/.*/VERSION = '${{ github.ref_name }}'/" dgtalVersion.py
cat dgtalVersion.py
- name: Setting build informations (Windows)
if: matrix.os == 'windows-latest'
shell: bash
working-directory: wrap/deploy
run: |
sed -i "1s/.*/VERSION = '${{ github.ref_name }}'/" dgtalVersion.py
cat dgtalVersion.py
- name: Building whl
shell: bash
working-directory: wrap/deploy
run: |
python setup.py bdist_wheel --build-type ${{ matrix.BUILD_TYPE }}
- name: Verifying wheel (Install - 1/2)
shell: bash
working-directory: wrap/deploy
run: |
python -m pip install dist/* # Naming would be complicated...
- name: Verifying wheel (Install - 2/2)
shell: bash
working-directory: wrap/tests
run: |
python -m pip install pytest
pytest .
- name: Repairing Linux Wheel (autitwheel - linux -> manylinux)
if: matrix.os == 'ubuntu-latest'
shell: bash
working-directory: wrap/deploy
run: |
python -m pip install auditwheel
sudo apt-get install patchelf
auditwheel repair -w dist/ --plat manylinux_2_35_x86_64 dist/* # Add shared libraries to .whl
rm dist/*-linux_$(uname -p).whl # Removes shared lib before upload
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: wrap/deploy/dist/
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
runs-on: ubuntu-latest
environment:
name: deploy-pypi
url: https://pypi.org/p/dgtal
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1