Allow to install the library as a CMake project #401
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: github-actions | |
on: [push, pull_request] | |
jobs: | |
windows-2019-dynamicLink: | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: HDF5 install | |
run: | | |
Invoke-WebRequest https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.0/bin/hdf5-1.12.0-Std-win10_64-vs16.zip -OutFile ${{ runner.temp }}\hdf5-1.12.0-Std-win10_64-vs16.zip | |
Expand-Archive ${{ runner.temp }}\hdf5-1.12.0-Std-win10_64-vs16.zip -DestinationPath ${{ runner.temp }} | |
msiexec.exe /i "${{ runner.temp }}\hdf\HDF5-1.12.0-win64.msi" /qn INSTALL_ROOT=${{ runner.temp }}\hdf5-1.12.0-Std-win10_64-vs16 | |
- name: Minizip DLL install | |
run: | | |
git clone https://github.com/F2I-Consulting/Minizip.git ${{ runner.temp }}/Minizip | |
cd ${{ runner.temp }} | |
mkdir minizip-build | |
cd minizip-build | |
cmake -G"Visual Studio 16 2019" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DZLIB_ROOT=${{ runner.temp }}/hdf5-1.12.0-Std-win10_64-vs16 -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/minizip-install ${{ runner.temp }}/Minizip | |
cmake --build . --config Release -j2 | |
cmake --build . --config Release --target INSTALL | |
- name: Boost install | |
run: | | |
(New-Object System.Net.WebClient).DownloadFile("https://sourceforge.net/projects/boost/files/boost-binaries/1.78.0//boost_1_78_0-msvc-14.2-64.exe", "${{ runner.temp }}\boost.exe") | |
Start-Process -Wait -FilePath "${{ runner.temp }}\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=${{ runner.temp }}\boost-install" | |
- name: CMake build and install | |
run: | | |
cd ${{ github.workspace }}/.. | |
mkdir build | |
cd build | |
cmake -G"Visual Studio 16 2019" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DHDF5_ROOT=${{ runner.temp }}\hdf5-1.12.0-Std-win10_64-vs16 -DMINIZIP_ROOT=${{ runner.temp }}/minizip-install -DZLIB_ROOT=${{ runner.temp }}\hdf5-1.12.0-Std-win10_64-vs16 -DSZIP_LIBRARY_RELEASE=${{ runner.temp }}\hdf5-1.12.0-Std-win10_64-vs16/lib/szip.lib -DBoost_INCLUDE_DIR=${{ runner.temp }}\boost-install -DWITH_EXAMPLE=TRUE -DWITH_RESQML2_2=TRUE -DWITH_TEST=TRUE ${{ github.workspace }} | |
cmake --build . --config Release -j2 | |
cmake --build . --config Release --target INSTALL | |
- name: Copy hdf5 dll | |
run: | | |
Copy-Item ${{ runner.temp }}\hdf5-1.12.0-Std-win10_64-vs16\bin\hdf5.dll -Destination ${{ github.workspace }}\..\build\Release | |
Copy-Item ${{ runner.temp }}\hdf5-1.12.0-Std-win10_64-vs16\bin\zlib.dll -Destination ${{ github.workspace }}\..\build\Release | |
- name: Run Unit tests | |
run: | | |
${{ github.workspace }}\..\build\Release\unitTest | |
- name: Run Cpp example | |
run: | | |
${{ github.workspace }}\..\build\Release\example.exe | |
windows-2019-staticLink-cs: | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: zlib install | |
run: | | |
Invoke-WebRequest https://zlib.net/current/zlib.tar.gz -OutFile ${{ runner.temp }}\zlib.tar.gz | |
cd ${{ runner.temp }} | |
tar -xzf ${{ runner.temp }}\zlib.tar.gz | |
mkdir zlib-build | |
cd zlib-build | |
cmake -G"Visual Studio 16 2019" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/zlib-install ${{ runner.temp }}/zlib-1.3 | |
cmake --build . --config Release -j2 | |
cmake --build . --config Release --target INSTALL | |
- name: Minizip static lib install | |
run: | | |
git clone https://github.com/F2I-Consulting/Minizip.git ${{ runner.temp }}/Minizip | |
cd ${{ runner.temp }} | |
mkdir minizip-build | |
cd minizip-build | |
cmake -G"Visual Studio 16 2019" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DBUILD_SHARED_LIBS=FALSE -DZLIB_ROOT=${{ runner.temp }}/zlib-install -DZLIB_USE_STATIC_LIBS=TRUE -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/minizip-install ${{ runner.temp }}/Minizip | |
cmake --build . --config Release -j2 | |
cmake --build . --config Release --target INSTALL | |
- name: HDF5 install | |
run: | | |
Invoke-WebRequest https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/hdf5-1.14.3/src/hdf5-1.14.3.zip -OutFile ${{ runner.temp }}\hdf5-1.14.3.zip | |
cd ${{ runner.temp }} | |
Expand-Archive ${{ runner.temp }}\hdf5-1.14.3.zip -DestinationPath ${{ runner.temp }} | |
mkdir hdf5-build | |
cd hdf5-build | |
cmake -G"Visual Studio 16 2019" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DZLIB_INCLUDE_DIR:PATH=${{ runner.temp }}/zlib-install/include -DZLIB_LIBRARY:PATH=${{ runner.temp }}/zlib-install/lib/zlibstatic.lib -DHDF5_BUILD_FORTRAN:BOOL=OFF -DHDF5_BUILD_JAVA:BOOL=OFF -DHDF5_ENABLE_PARALLEL:BOOL=OFF -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_BUILD_HL_LIB:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_BUILD_GENERATORS:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF -DHDF5_BUILD_UTILS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/hdf5-install ${{ runner.temp }}/hdf5-1.14.3 | |
cmake --build . --config Release -j2 | |
cmake --build . --config Release --target INSTALL | |
- name: Boost install | |
run: | | |
(New-Object System.Net.WebClient).DownloadFile("https://sourceforge.net/projects/boost/files/boost-binaries/1.84.0//boost_1_84_0-msvc-14.2-64.exe", "${{ runner.temp }}\boost.exe") | |
Start-Process -Wait -FilePath "${{ runner.temp }}\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=${{ runner.temp }}\boost-install" | |
- name: Swig install | |
run: | | |
(New-Object System.Net.WebClient).DownloadFile("http://prdownloads.sourceforge.net/swig/swigwin-4.2.0.zip", "${{ runner.temp }}\swigwin-4.2.0.zip") | |
7z x ${{ runner.temp }}\swigwin-4.2.0.zip -o${{ runner.temp }} | |
- name: CMake build and install | |
run: | | |
cd ${{ github.workspace }}/.. | |
mkdir build | |
cd build | |
cmake -G"Visual Studio 16 2019" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DHDF5_ROOT=${{ runner.temp }}/hdf5-install -DHDF5_USE_STATIC_LIBRARIES=TRUE -DMINIZIP_ROOT=${{ runner.temp }}/minizip-install -DZLIB_ROOT=${{ runner.temp }}\hdf5-1.12.0-Std-win10_64-vs16\include -DZLIB_USE_STATIC_LIBS=TRUE -DBoost_INCLUDE_DIR=${{ runner.temp }}\boost-install -DWITH_EXAMPLE=TRUE -DWITH_RESQML2_2=TRUE -DWITH_DOTNET_WRAPPING=TRUE -DSWIG_EXECUTABLE=${{ runner.temp }}/swigwin-4.2.0/swig.exe ${{ github.workspace }} | |
cmake --build . --config Release -j2 | |
cmake --build . --config Release --target INSTALL | |
- name: Add msbuild to PATH | |
uses: microsoft/[email protected] | |
with: | |
msbuild-architecture: x64 | |
- name: Build the C# example | |
run: msbuild ${{ github.workspace }}/cs/example/example.sln -t:rebuild /p:Configuration=Release /p:Platform="x64" | |
- name: Run Cpp example | |
run: | | |
${{ github.workspace }}\..\build\Release\example.exe | |
- name: Copy all dlls for C# | |
run: | | |
Copy-Item ${{ github.workspace }}\..\build\Release\*.dll -Destination ${{ github.workspace }}\cs\example\bin\x64\Release | |
- name: Run C# example | |
run: | | |
${{ github.workspace }}\cs\example\bin\x64\Release\example.exe | |
ubuntu-20-java8: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix failed. | |
matrix: | |
include: [ | |
{ xcc_name: 'gcc 9', xcc_pkg: gcc-9, cc: gcc-9, cxx: g++-9 }, | |
{ xcc_name: 'gcc 10', xcc_pkg: gcc-10, cc: gcc-10, cxx: g++-10 }, | |
{ xcc_name: 'clang 9', xcc_pkg: clang-9, cc: clang-9, cxx: clang++-9 }, | |
{ xcc_name: 'clang 10', xcc_pkg: clang-10, cc: clang-10, cxx: clang++-10 }, | |
{ xcc_name: 'clang 11', xcc_pkg: clang-11, cc: clang-11, cxx: clang++-11 }, | |
# { xcc_name: 'clang 12', xcc_pkg: clang-12, cc: clang, cxx: clang++ }, | |
] | |
env: | |
XCC: $${{ matrix.xcc_name }} # Set environment variables | |
CC: ${{ matrix.cc }} | |
CXX: ${{ matrix.cxx }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' # See 'Supported distributions' for available options | |
java-version: '8' | |
- name: APT install | |
run: | | |
sudo apt update | |
sudo apt install -y ${{ matrix.xcc_pkg }} libminizip-dev libboost-all-dev | |
# Build HDF5 instead of downloading the package because the package is not built with -fPIC causing relocation issue. | |
- name: HDF5 build and install | |
run: | | |
cd ${{ runner.temp }} | |
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.2/src/hdf5-1.12.2.tar.gz | |
tar -xzf hdf5-1.12.2.tar.gz | |
cd hdf5-1.12.2 | |
mkdir build | |
cd build | |
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_BUILD_HL_LIB:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DCMAKE_INSTALL_PREFIX:STRING=${{ runner.temp }}/install-hdf5-1.12.2 .. | |
cmake --build . --config Release | |
make -j4 | |
make install | |
- name: CMake build and install | |
run: | | |
cd .. | |
mkdir build | |
cd build | |
cmake -DHDF5_ROOT=${{ runner.temp }}/install-hdf5-1.12.2 -DHDF5_USE_STATIC_LIBRARIES=TRUE -DCMAKE_BUILD_TYPE=Release -DWITH_JAVA_WRAPPING=TRUE ${{ github.workspace }} -D CMAKE_C_COMPILER=${{ matrix.cc }} -D CMAKE_CXX_COMPILER=${{ matrix.cxx }} | |
cmake --build . -j2 | |
cmake --install . | |
- name: Run java example | |
run: | | |
cd ${{ github.workspace }}/java/src | |
javac -cp `find ${{ github.workspace }}/../build/install -name fesapiJava*.jar` com/f2i_consulting/example/FesapiJavaExample.java | |
java -Djava.library.path=${{ github.workspace }}/../build/install/lib -cp `find ${{ github.workspace }}/../build/install -name fesapiJava*.jar`:. com.f2i_consulting.example.FesapiJavaExample | |
ubuntu-20-python3: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: APT install | |
run: | | |
sudo apt update | |
sudo apt install -y libminizip-dev libboost-all-dev | |
# Build HDF5 instead of downloading the package because the package is not built with -fPIC causing relocation issue. | |
- name: HDF5 build and install | |
run: | | |
cd ${{ runner.temp }} | |
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/hdf5-1.14.0/src/hdf5-1.14.0.tar.gz | |
tar -xzf hdf5-1.14.0.tar.gz | |
cd hdf5-1.14.0 | |
mkdir build | |
cd build | |
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_BUILD_HL_LIB:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DCMAKE_INSTALL_PREFIX:STRING=${{ runner.temp }}/install-hdf5-1.14.0 .. | |
cmake --build . --config Release | |
make -j4 | |
make install | |
- name: CMake build and install | |
run: | | |
cd .. | |
mkdir build | |
cd build | |
cmake -DHDF5_ROOT=${{ runner.temp }}/install-hdf5-1.14.0 -DHDF5_USE_STATIC_LIBRARIES=TRUE -DCMAKE_BUILD_TYPE=Release -DWITH_PYTHON_WRAPPING=TRUE ${{ github.workspace }} | |
cmake --build . -j2 | |
cmake --install . | |
- name: Run Python example | |
run: | | |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ github.workspace }}/../build/install/lib | |
pip3 install ${{ github.workspace }}/python/dist/*.whl | |
python3 ${{ github.workspace }}/python/example/example.py | |
ubuntu-20-mpi: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: APT install | |
run: | | |
sudo apt update | |
sudo apt install -y libhdf5-mpi-dev libminizip-dev libboost-all-dev | |
- name: Setup MPI | |
uses: mpi4py/setup-mpi@v1 | |
- name: CMake build and install | |
run: | | |
cd ${{ runner.temp }} | |
mkdir build | |
cd build | |
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=mpic++ -DCMAKE_C_COMPILER=mpicc -DHDF5_PREFER_PARALLEL:BOOL=TRUE -DWITH_EXAMPLE:BOOL=TRUE ${{ github.workspace }} | |
cmake --build . -j2 | |
cmake --install . | |
- name: Run example | |
run: mpiexec -n 2 ${{ runner.temp }}/build/install/example | |
ubuntu-20-valgrind-unitTest: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: APT install | |
run: | | |
sudo apt update | |
sudo apt install -y libhdf5-dev libminizip-dev libboost-all-dev valgrind | |
- name: CMake build and install | |
run: | | |
cd .. | |
mkdir build | |
cd build | |
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_EXAMPLE=TRUE -DWITH_RESQML2_2=TRUE -DWITH_TEST=TRUE ${{ github.workspace }} | |
cmake --build . -j2 | |
cmake --install . | |
- name: Run Valgrind on example | |
run: | | |
valgrind --leak-check=full --track-origins=yes --show-leak-kinds=all ${{ github.workspace }}/../build/example/exampled | |
- name: Run Unit tests | |
run: | | |
${{ github.workspace }}/../build/test/unitTest | |
webassembly: | |
if: false | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: mymindstorm/setup-emsdk@v11 | |
- uses: actions/checkout@v4 | |
- name: Verify | |
run: emcc -v | |
- name: "Set environmental variables" | |
run: | | |
echo "WASM_INSTALL_DIR=${{ github.workspace }}/install" >> $GITHUB_ENV | |
echo "WASM_LIB_DIR=${{ github.workspace }}/install/lib" >> $GITHUB_ENV | |
echo "WASM_INCLUDE_DIR=${{ github.workspace }}/install/include" >> $GITHUB_ENV | |
- name: HDF5 install | |
env: | |
HDF5_DOWNLOAD_URL: https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_12_1.tar.gz | |
run: | | |
wget ${{ env.HDF5_DOWNLOAD_URL }} -O hdf5_src.tgz | |
tar -xvzf hdf5_src.tgz | |
mkdir -p hdf5_build | |
cd hdf5_build | |
LDFLAGS="-s NODERAWFS=1 -s USE_ZLIB=1" emcmake cmake ../hdf5-hdf5-1_12_1 \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=${{ env.WASM_INSTALL_DIR }} \ | |
-DH5_HAVE_GETPWUID=0 \ | |
-DH5_HAVE_SIGNAL=0 \ | |
-DBUILD_SHARED_LIBS=0 \ | |
-DBUILD_STATIC_LIBS=1 \ | |
-DBUILD_TESTING=0 \ | |
-DHDF5_BUILD_EXAMPLES=0 \ | |
-DHDF5_BUILD_TOOLS=0 \ | |
-DHDF5_ENABLE_Z_LIB_SUPPORT=1 | |
emmake make -j8 install | |
- name: Minizip install | |
run: | | |
git clone https://github.com/F2I-Consulting/Minizip.git | |
mkdir -p minizip_build | |
cd minizip_build | |
LDFLAGS="-s USE_ZLIB=1" emcmake cmake ../Minizip \ | |
-DCMAKE_INSTALL_PREFIX=${{ env.WASM_INSTALL_DIR }} | |
emmake make -j8 install | |
- name: CMake build | |
env: | |
FESAPI_BUILD_DIR: fesapi_build | |
run: | | |
cd ${{ github.workspace }} | |
# see https://sourceforge.net/p/gsoap2/bugs/1301/ | |
#wget https://gist.github.com/untereiner/3af2e52fbd135235457d2a707d5480d4/raw/7f7e0706b3421593c4c617b9703e5a90e30bfa51/gsoap_wasm.patch | |
#git apply gsoap_wasm.patch | |
mkdir -p fesapi_build | |
cd fesapi_build | |
LDFLAGS="-s USE_ZLIB=1 -s USE_BOOST_HEADERS=1" emcmake cmake ../ \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=${{ env.WASM_INSTALL_DIR }} \ | |
-DWITH_LOCAL_HDF5=ON \ | |
-DHDF5_INCLUDE_DIRS=${{ env.WASM_INCLUDE_DIR }} \ | |
-DHDF5_LIBRARIES=${{ env.WASM_LIB_DIR }}/libhdf5.a \ | |
-DMINIZIP_INCLUDE_DIR=${{ env.WASM_INCLUDE_DIR }} \ | |
-DMINIZIP_LIBRARY_RELEASE=${{ env.WASM_LIB_DIR }}/libminizip.a \ | |
-DWITH_EXAMPLE=0 \ | |
-DWITH_RESQML2_2=1 \ | |
-DWITH_TEST=0 \ | |
-DWITH_WASM_WRAPPING=1 | |
emmake make -j8 fesapi-wasm | |
emmake make -j8 fesapi-wasm-node | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: fesapi-mjs | |
path: | | |
${{ github.workspace }}/webassembly/dist/esm/fesapi.mjs | |
${{ github.workspace }}/webassembly/dist/esm/fesapi.wasm | |
# Setup .npmrc file to publish to npm | |
#- name: 'Setup node' | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: '16.x' | |
# registry-url: 'https://registry.npmjs.org' | |
# cache-dependency-path: ${{ github.workspace }}/webassembly/package-lock.json | |
#- name: Configure NPM | |
# working-directory: ${{ github.workspace }}/webassembly/ | |
# run: | | |
# echo "//npm.pkg.github.com/:_authToken=\${NODE_AUTH_TOKEN}" >> .npmrc | |
# echo "always-auth: true" >> .npmrc | |
# env: | |
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
#- run: npm ci | |
# working-directory: ${{ github.workspace }}/webassembly/ | |
#- run: npm publish --access public | |
# working-directory: ${{ github.workspace }}/webassembly/ | |
# env: | |
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |