Skip to content

Commit

Permalink
Merge pull request #205 from vincentcasseau/main
Browse files Browse the repository at this point in the history
PyPI: compiling Cassiopee in a manylinux2014 Docker image
  • Loading branch information
benoit128 authored Oct 17, 2024
2 parents 7fae71b + 292346c commit e422d98
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 81 deletions.
126 changes: 69 additions & 57 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
# strategy:
# matrix:
# python-version: ["3.8", "3.12"]
runs-on: ubuntu-latest

steps:
- name: Checkout repository
Expand All @@ -22,42 +19,77 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.8"
# python-version: ${{ matrix.python-version }}

- name: Install system dependencies
run: |
sudo apt-get update && sudo apt-get install -y \
gcc \
g++ \
gfortran \
libopenmpi-dev \
libhdf5-openmpi-dev \
python3-tk \
mesa-common-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libosmesa6-dev \
xorg-dev
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install wheel twine auditwheel setuptools scons numpy mpi4py
pip install twine
- name: Verify Python and Installed Packages
run: |
python --version
python -m pip list
- name: Build Cassiopee package
- name: Pull manylinux2014 image
run: docker pull quay.io/pypa/manylinux2014_x86_64

- name: Build Cassiopee in a Docker container
run: |
export CASSIOPEE=$GITHUB_WORKSPACE
export MACHINE=azure
. $CASSIOPEE/Cassiopee/Envs/sh_Cassiopee_r8
cd $CASSIOPEE/Cassiopee
echo -e "FREEMODULES='KCore XCore Converter Geom Transform Generator Post Initiator Connector Distributor2 Dist2Walls RigidMotion Compressor Modeler Intersector Apps CPlot'\nexport FREEMODULES\nFULLMODULES='KCore XCore Converter Geom Transform Generator Post Initiator Connector Distributor2 Dist2Walls RigidMotion Compressor Modeler Intersector Apps CPlot'\nexport FULLMODULES\nOTHERS=''" > $CASSIOPEE/Cassiopee/MODULES
./install
docker run --rm -v $GITHUB_WORKSPACE:/io quay.io/pypa/manylinux2014_x86_64:latest /bin/bash -c "
export PATH=/opt/python/cp312-cp312/bin:\$PATH &&
yum update && yum install -y \
gcc \
gcc-c++ \
gcc-gfortran \
openmpi \
openmpi-devel \
hdf5 \
hdf5-devel \
tk \
mesa-libGL \
mesa-libGL-devel \
mesa-libGLU \
mesa-libGLU-devel \
mesa-libOSMesa \
mesa-libOSMesa-devel \
libX11-devel \
libXext-devel \
libXmu-devel \
libXi-devel \
libXrender-devel \
libpng-devel \
zlib-devel \
xorg-x11-server-devel \
OCE-devel \
OCE-draw \
OCE-foundation \
OCE-modeling \
OCE-ocaf \
OCE-visualization &&
export CPATH=/usr/include/oce:\$CPATH &&
export PATH=/usr/lib64/oce-0.17/bin:\$PATH &&
export LD_LIBRARY_PATH=/usr/lib64/oce-0.17:\$LD_LIBRARY_PATH &&
export OCCT_ROOT=/usr/include/oce &&
export OCCT_INCLUDE_DIR=/usr/include/oce &&
export OCCT_LIBRARY_DIR=/usr/lib64/oce-0.17 &&
pip3 install \
wheel \
auditwheel \
setuptools \
scons \
numpy &&
export PATH=/usr/lib64/openmpi/bin:\$PATH &&
export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:\$LD_LIBRARY_PATH &&
export CFLAGS="-std=c99" &&
pip3 install mpi4py &&
export CFLAGS="-std=c11" &&
python --version && python -m pip list &&
export CASSIOPEE=/io &&
export MACHINE=azure &&
cd \$CASSIOPEE/Cassiopee &&
. \$CASSIOPEE/Cassiopee/Envs/sh_Cassiopee_r8 &&
sed -i "s/OCC//g" MODULES &&
./install &&
cd \$CASSIOPEE/Dist/bin/\$ELSAPROD &&
find . -type f -name '*-4.0-cp312-cp312-linux_x86_64.whl' -exec mv {} . \;
for wheel in \$(find . -maxdepth 1 -name '*.whl'); do auditwheel repair \$wheel; done
"
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
Expand All @@ -66,26 +98,6 @@ jobs:
export CASSIOPEE=$GITHUB_WORKSPACE
export MACHINE=azure
. $CASSIOPEE/Cassiopee/Envs/sh_Cassiopee_r8
for wheel in $(find $CASSIOPEE/Dist/bin/$ELSAPROD/pip-ephem-wheel-cache-* -type f -name "*.whl"); do
echo "$wheel"
auditwheel -v repair "$wheel"
done
find $CASSIOPEE/Dist/bin/$ELSAPROD/pip-ephem-wheel-cache-* -type f -name "*manylinux*.whl" -exec twine upload {} +
# publish:
# runs-on: ubuntu-latest
# needs: build
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
#
# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: "3.12"
#
# - name: Publish to PyPI
# env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
# run: find -name "*.whl" -exec twine upload {} +
ls $CASSIOPEE/Dist/bin/$ELSAPROD/wheelhouse/
cd $CASSIOPEE/Dist/bin/$ELSAPROD/
twine upload --verbose wheelhouse/*.whl
13 changes: 6 additions & 7 deletions Cassiopee/Post/Post/Stream2/unstructured_data_view_p.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,27 @@ namespace K_POST
hexaedre ,
number_of_element_types
};

static constexpr const std::array<unsigned char,number_of_element_types> number_of_vertices_per_element = {
4, 5, 6, 8
{4, 5, 6, 8}
};

static constexpr const std::array<unsigned char,number_of_element_types> number_of_vertices_for_polyhedron = {
4, 6, 9, 14
{4, 6, 9, 14}
};

static constexpr const std::array<unsigned char,number_of_element_types> number_of_faces_per_element = {
4, 5, 5, 6
{4, 5, 5, 6}
};

static constexpr const std::array<unsigned char,number_of_element_types> total_nb_of_vertices_for_faces_per_element = {
12, 16, 18, 24
{12, 16, 18, 24}
};

static constexpr const std::array<unsigned char,number_of_element_types> number_of_triangles_per_element = {
4, 8, 14, 24
{4, 8, 14, 24}
};


static const std::array<std::vector<unsigned char>,number_of_element_types> number_of_vertices_per_face_per_element;

static const std::array<std::vector<std::vector<unsigned char>>,number_of_element_types> vertices_per_face_per_element;
Expand Down
35 changes: 18 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,26 @@ classifiers = [
numpy = ">=1.23.3"
mpi4py = ">=3.1.3"
scons = ">=4.4.0"
KCore = ">=4.0"
XCore = ">=4.0"
Converter = ">=4.0"
Geom = ">=4.0"
Transform = ">=4.0"
Generator = ">=4.0"
Post = ">=4.0"
Initiator = ">=4.0"
Connector = ">=4.0"
Distributor2 = ">=4.0"
Dist2Walls = ">=4.0"
RigidMotion = ">=4.0"
Compressor = ">=4.0"
Modeler = ">=4.0"
Intersector = ">=4.0"
Apps = ">=4.0"
CPlot = ">=4.0"
KCore = {path = "Cassiopee/KCore"}
XCore = {path = "Cassiopee/XCore"}
Converter = {path = "Cassiopee/Converter"}
Geom = {path = "Cassiopee/Geom"}
Transform = {path = "Cassiopee/Transform"}
Generator = {path = "Cassiopee/Generator"}
Post = {path = "Cassiopee/Post"}
Initiator = {path = "Cassiopee/Initiator"}
Connector = {path = "Cassiopee/Connector"}
Distributor2 = {path = "Cassiopee/Distributor2"}
Dist2Walls = {path = "Cassiopee/Dist2Walls"}
RigidMotion = {path = "Cassiopee/RigidMotion"}
Compressor = {path = "Cassiopee/Compressor"}
Modeler = {path = "Cassiopee/Modeler"}
Intersector = {path = "Cassiopee/Intersector"}
Apps = {path = "Cassiopee/Apps"}

[project.optional-dependencies]
CPlot = {path = "Cassiopee/CPlot"}
OCC = {path = "Cassiopee/OCC"}

[project.urls]
Homepage = "https://github.com/onera/Cassiopee"
Expand Down

0 comments on commit e422d98

Please sign in to comment.