Unverified Commit d6507429 authored by Wittenburg, William's avatar Wittenburg, William Committed by GitHub
Browse files

Merge pull request #3960 from ornladios/add-pip-packaging

Add pip packaging
parents d192f276 39ff134c
Loading
Loading
Loading
Loading
+100 −0
Original line number Diff line number Diff line
name: Python Packaging

on:
  workflow_dispatch:
    inputs:
      overrideVersion:
        description: Manually force a version
  pull_request:
  push:
    branches:
      - master
      - release_[0-9]+
    tags:
      - v[0-9]+.[0-9]+.[0-9]+*
  release:
    types:
      - published

env:
  ADIOS2_CUSTOM_VERSION_OVERRIDE: ${{ github.event.inputs.overrideVersion }}

jobs:
  make_sdist:
    name: Make SDist
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Generate common version file
        run: cmake -P scripts/ci/gh-actions/config/adios-version.cmake && echo VERSION.TXT

      - name: Build SDist
        run: pipx run build --sdist

      - uses: actions/upload-artifact@v3
        with:
          path: dist/*.tar.gz

  build_wheels:
    name: Wheel on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        # os: [ubuntu-latest, windows-latest, macos-latest]
        os: [ubuntu-latest]

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Generate common version file
        run: cmake -P scripts/ci/gh-actions/config/adios-version.cmake && echo VERSION.TXT

      - uses: pypa/cibuildwheel@v2.16
        env:
          CIBW_BUILD: cp*-manylinux_x86_64

      - name: Upload wheels
        uses: actions/upload-artifact@v3
        with:
          path: wheelhouse/*.whl

  upload_pypi:
    needs: [build_wheels, make_sdist]
    environment: pypi
    permissions:
      id-token: write
    runs-on: ubuntu-latest
    if: github.event_name == 'release' && github.event.action == 'published'
    steps:
      - uses: actions/download-artifact@v3
        with:
          name: artifact
          path: dist

      - name: Publish package distributions to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1

  upload_test_pypi:
    needs: [build_wheels, make_sdist]
    environment: testpypi
    permissions:
      id-token: write
    runs-on: ubuntu-latest
    # Upload to Test PyPI for every commit on main branch
    if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
    steps:
      - uses: actions/download-artifact@v3
        with:
          name: artifact
          path: dist

      - name: Publish package distributions to TestPyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          repository-url: https://test.pypi.org/legacy/
+20 −5
Original line number Diff line number Diff line
@@ -22,6 +22,19 @@ project(ADIOS2 VERSION ${ADIOS2_VERSION})
# Some boilerplate to setup nice output directories
#------------------------------------------------------------------------------#
include(GNUInstallDirs)

if (ADIOS2_USE_PIP)
  # Only UNIX is supported currently
  if (UNIX)
    # Linux bundles what libraries we have when they're put beside the modules.
    set(CMAKE_INSTALL_LIBDIR "adios2")
    set(CMAKE_INSTALL_INCLUDEDIR "adios2/include")
    # ELF loader settings.
    set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
    list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN")
  endif ()
endif ()

set(CMAKE_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/adios2
  CACHE STRING "Installation CMake subdirectory")
mark_as_advanced(CMAKE_INSTALL_CMAKEDIR)
@@ -172,6 +185,8 @@ adios_option(Sodium "Enable support for Sodium for encryption" AUTO)
adios_option(Catalyst   "Enable support for in situ visualization plugin using ParaView Catalyst" AUTO)
adios_option(AWSSDK     "Enable support for S3 compatible storage using AWS SDK's S3 module" OFF)
adios_option(Derived_Variable    "Enable support for derived variables" OFF)
adios_option(PIP        "Enable support for pip packaging" OFF)
mark_as_advanced(ADIOS2_USE_PIP)
include(${PROJECT_SOURCE_DIR}/cmake/DetectOptions.cmake)

if(ADIOS2_HAVE_CUDA OR ADIOS2_HAVE_Kokkos_CUDA)
@@ -242,7 +257,7 @@ endif()


set(ADIOS2_CONFIG_OPTS
    DataMan DataSpaces HDF5 HDF5_VOL MHS SST Fortran MPI Python Blosc2 BZip2
    DataMan DataSpaces HDF5 HDF5_VOL MHS SST Fortran MPI Python PIP Blosc2 BZip2
    LIBPRESSIO MGARD MGARD_MDR PNG SZ ZFP DAOS IME O_DIRECT Sodium Catalyst SysVShMem UCX
    ZeroMQ Profiling Endian_Reverse Derived_Variable AWSSDK GPU_Support CUDA Kokkos
    Kokkos_CUDA Kokkos_HIP Kokkos_SYCL
@@ -283,12 +298,12 @@ if(BUILD_SHARED_LIBS AND ADIOS2_RUN_INSTALL_TEST)
        set(ADIOS2_RUN_INSTALL_TEST FALSE)
      endif()
    else()
      set(CMAKE_INSTALL_RPATH "@loader_path/${relative_base}/${CMAKE_INSTALL_LIBDIR}")
      list(APPEND CMAKE_INSTALL_RPATH "@loader_path/${relative_base}/${CMAKE_INSTALL_LIBDIR}")
    endif()

  elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
    # Linux needs some specialized RPATH handling
    set(CMAKE_INSTALL_RPATH "$ORIGIN/${relative_base}/${CMAKE_INSTALL_LIBDIR}")
    list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN/${relative_base}/${CMAKE_INSTALL_LIBDIR}")
  endif()
endif()

+5 −4
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
[![GitHub (pre-)release](https://img.shields.io/github/release/ornladios/adios2/all.svg)]()
[![Spack Version](https://img.shields.io/spack/v/adios2.svg)](https://spack.readthedocs.io/en/latest/package_list.html#adios2)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/adios2)](https://anaconda.org/conda-forge/adios2)
[![PyPI version](https://badge.fury.io/py/adios2.svg)](https://badge.fury.io/py/adios2)

[![Circle CI](https://circleci.com/gh/ornladios/ADIOS2.svg?style=shield)](https://circleci.com/gh/ornladios/ADIOS2)

+16 −5
Original line number Diff line number Diff line
@@ -49,16 +49,27 @@ set_target_properties(adios2_py PROPERTIES

string(REGEX REPLACE "[^/]+" ".." relative_base "${CMAKE_INSTALL_PYTHONDIR}/adios2")
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
  if (NOT ADIOS2_USE_PIP)
    set_target_properties(adios2_py PROPERTIES
      INSTALL_RPATH "$ORIGIN/${relative_base}/${CMAKE_INSTALL_LIBDIR}"
    )
  endif()
endif()

set(install_location ${CMAKE_INSTALL_PYTHONDIR})
if (ADIOS2_USE_PIP)
  set(install_location ${CMAKE_INSTALL_LIBDIR})
endif()

install(TARGETS adios2_py
  DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/adios2
  DESTINATION ${install_location}
  COMPONENT adios2_python-python
)
install(FILES ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/adios2/__init__.py
  DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/adios2
  DESTINATION ${install_location}
  COMPONENT adios2_python-python
)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test
  DESTINATION ${install_location}
  COMPONENT adios2_python-python
)
+0 −0

Empty file added.

Loading