Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Windows CI and build script #127

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 152 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ env:
HSDS_PASSWORD: test
HSDS_PATH: /home/test_user1/
HDF5_API_TEST_PATH_PREFIX: /home/test_user1/
HSDS_ENDPOINT: http+unix://%2Ftmp%2Fhs%2Fsn_1.sock
HDF5_VOL_CONNECTOR: REST
ROOT_DIR: ${{github.workspace}}/hsdsdata
ROOT_DIR: ${{github.workspace}}/hsds/data
BUCKET_NAME: hsdstest

jobs:
Expand All @@ -34,7 +33,8 @@ jobs:
os: [ubuntu-latest]
python-version: ["3.10"]
hdf5-branch: ["hdf5_1_14", "develop"]

env:
HSDS_ENDPOINT: http+unix://%2Ftmp%2Fhs%2Fsn_1.sock
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -126,21 +126,17 @@ jobs:
pip install requests==2.31.0

- name: Start HSDS
if: ${{ matrix.endpoint != 'http://127.0.0.1:5101'}}
run: |
cd ${{github.workspace}}/hsds
mkdir ${{github.workspace}}/hsdsdata &&
mkdir ${{github.workspace}}/hsdsdata/hsdstest &&
cp admin/config/groups.default admin/config/groups.txt &&
cp admin/config/passwd.default admin/config/passwd.txt &&
cp admin/config/groups.default admin/config/groups.txt &&
cp admin/config/passwd.default admin/config/passwd.txt
ROOT_DIR=${{github.workspace}}/hsdadata ./runall.sh --no-docker 1 &
./runall.sh --no-docker 1 &
sleep 10
working-directory: ${{github.workspace}}/hsds

- name: Test HSDS
if: ${{matrix.endpoint != 'http://127.0.0.1:5101'}}

- name: Test HSDS + Setup Folders
run: |
python tests/integ/setup_test.py
working-directory: ${{github.workspace}}/hsds
Expand All @@ -157,7 +153,8 @@ jobs:
os: [ubuntu-latest]
python-version: ["3.10"]
hdf5-branch: ["hdf5_1_14", "develop"]

env:
HSDS_ENDPOINT: http+unix://%2Ftmp%2Fhs%2Fsn_1.sock
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -186,7 +183,7 @@ jobs:
-DBUILD_SHARED_LIBS=ON -DHDF5_ENABLE_SZIP_SUPPORT=OFF \
-DHDF5_TEST_API=ON \
-DHDF5_ENABLE_Z_LIB_SUPPORT=OFF \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DHDF5_ENABLE_THREADSAFE=OFF \
-DCMAKE_BUILD_TYPE=Release -DHDF5_ENABLE_THREADSAFE=OFF \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/hdf5install \
..
make
Expand All @@ -199,7 +196,7 @@ jobs:
mkdir ./build
cd ./build
CFLAGS="-D_POSIX_C_SOURCE=200809L" cmake -G "Unix Makefiles" -DHDF5_ROOT=${{github.workspace}}/hdf5install \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/vol-rest/install \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/vol-rest/install -DCMAKE_BUILD_TYPE=Release \
..
shell: bash
working-directory: ${{github.workspace}}/vol-rest
Expand Down Expand Up @@ -252,21 +249,15 @@ jobs:
pip install requests==2.31.0

- name: Start HSDS
if: ${{ matrix.endpoint != 'http://127.0.0.1:5101'}}
run: |
cd ${{github.workspace}}/hsds
mkdir ${{github.workspace}}/hsdsdata &&
mkdir ${{github.workspace}}/hsdsdata/hsdstest &&
cp admin/config/groups.default admin/config/groups.txt &&
cp admin/config/passwd.default admin/config/passwd.txt &&
cp admin/config/groups.default admin/config/groups.txt &&
cp admin/config/groups.default admin/config/groups.txt
cp admin/config/passwd.default admin/config/passwd.txt
ROOT_DIR=${{github.workspace}}/hsdadata ./runall.sh --no-docker 1 &
./runall.sh --no-docker 1 &
sleep 10
working-directory: ${{github.workspace}}/hsds

- name: Test HSDS
if: ${{matrix.endpoint != 'http://127.0.0.1:5101'}}
run: |
python tests/integ/setup_test.py
working-directory: ${{github.workspace}}/hsds
Expand All @@ -286,3 +277,143 @@ jobs:
# run: |
# valgrind --leak-check=full -s ctest -R "vol-rest" -VV
# working-directory: ${{github.workspace}}/hdf5/build/

build_and_test_windows:
strategy:
fail-fast: false
matrix:
os: [windows-latest]
python-version: ["3.10"]
hdf5-branch: ["hdf5_1_14", "develop"]
env:
HSDS_ENDPOINT: http://127.0.0.1:5101
runs-on: ${{matrix.os}}
steps:
- name: Get HDF5
uses: actions/checkout@v4
with:
repository: HDFGroup/hdf5
ref: ${{matrix.hdf5-branch}}
path: ${{github.workspace}}/hdf5

- name: Get REST VOL
uses: actions/checkout@v3
with:
path: ${{github.workspace}}/vol-rest

- name: Get HSDS
uses: actions/checkout@v3
with:
repository: HDFGroup/hsds
path: ${{github.workspace}}/hsds

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install HSDS dependencies
working-directory: ${{github.workspace}}/hsds
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Install HSDS package
working-directory: ${{github.workspace}}/hsds
shell: bash
run: |
pip install -e .

- name: Start HSDS
shell: bash
working-directory: ${{github.workspace}}/hsds
run: |
cp admin/config/groups.default admin/config/groups.txt
cp admin/config/passwd.default admin/config/passwd.txt
hsds --root_dir data --host localhost --port 5101 --password_file admin/config/passwd.txt --logfile hs.log --loglevel DEBUG --config_dir=admin/config --count=4 &
sleep 10

- name: Test HSDS + Setup Folders
run: |
python tests/integ/setup_test.py
working-directory: ${{github.workspace}}/hsds

- name: Get curl from source
uses: actions/checkout@v4
with:
repository: curl/curl
path: ${{github.workspace}}/curl

- name: Install curl
working-directory: ${{github.workspace}}/curl
run: |
mkdir build
mkdir install
cd build
cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/curl/install `
-DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_LIBS=ON `
-DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS="/DCURL_STATICLIB" `
-DCURL_STATIC_CRT=ON -DBUILD_STATIC_CURL=ON ..
cmake --build . --config Release
cmake --install . --config Release

- name: Get yajl from source
uses: actions/checkout@v4
with:
repository: lloyd/yajl
path: ${{github.workspace}}/yajl

- name: Install yajl
working-directory: ${{github.workspace}}/yajl
run: |
mkdir build
mkdir install
cd build
cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/yajl/install `
-DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release
cmake --install . --config Release

- name: CMake Configure + Build HDF5
run: |
mkdir build
cd build
cmake `
-DHDF5_BUILD_HL_LIB=ON `
-DBUILD_SHARED_LIBS=ON -DHDF5_ENABLE_SZIP_SUPPORT=OFF `
-DHDF5_TEST_API=ON `
-DHDF5_ENABLE_Z_LIB_SUPPORT=OFF `
-DCMAKE_BUILD_TYPE=Release -DHDF5_ENABLE_THREADSAFE=OFF `
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/hdf5install `
..
cmake --build . -j --config Release
cmake --install . --config Release
working-directory: ${{github.workspace}}/hdf5

- name: CMake Configure + Build REST VOL
working-directory: ${{github.workspace}}/vol-rest
run: |
mkdir build
cd build
cmake -DHDF5_ROOT=${{github.workspace}}/hdf5install `
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/vol-rest/install `
-DCURL_ROOT=${{github.workspace}}/curl/install/ -DCMAKE_C_FLAGS="/DCURL_STATICLIB" `
-DCURL_USE_STATIC_LIBS=ON `
-DYAJL_ROOT=${{github.workspace}}/yajl/install/ `
-DBUILD_STATIC_LIBS=OFF -DBUILD_SHARED_LIBS=ON `
-DCMAKE_BUILD_TYPE=Release ..
cmake --build . -j --config Release
cmake --install . --config Release

- name: Test REST VOL
working-directory: ${{github.workspace}}\vol-rest\build
env:
HDF5_PLUGIN_PATH: ${{github.workspace}}\vol-rest\install\bin
# Manually append lib to PATH here, since env can change between steps on the runner
run: |
$env:PATH="$env:PATH;${{github.workspace}}\vol-rest\install\bin;${{github.workspace}}\hdf5install\bin;${{github.workspace}}\yajl\install\lib"
ctest . -C Release -VV --output-on-failure


2 changes: 2 additions & 0 deletions CMake/FindYAJL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ if (YAJL_FOUND)
endif ()
set_target_properties(yajl-shared PROPERTIES
IMPORTED_LOCATION "${YAJL_SHARED_LIBRARY}"
IMPORTED_IMPLIB "${YAJL_SHARED_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${YAJL_INCLUDE_DIR}"
)
set_target_properties(yajl-static PROPERTIES
IMPORTED_LOCATION "${YAJL_STATIC_LIBRARY}"
IMPORTED_IMPLIB "${YAJL_STATIC_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${YAJL_INCLUDE_DIR}"
)

Expand Down
20 changes: 9 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# CMake Build Script for the HDF5 REST VOL connector #
#----------------------------------------------------#

cmake_minimum_required (VERSION 3.10)
cmake_minimum_required (VERSION 3.12)
project (HDF5_VOL_REST C)

# Setup CMake policies.
Expand All @@ -14,7 +14,6 @@ foreach (policy
endif ()
endforeach ()


#-----------------------------------------------------------------------------
# Instructions for use : Normal Build
#
Expand Down Expand Up @@ -87,7 +86,6 @@ set (HDF5_VOL_REST_LIBSH_TARGET "${HDF5_VOL_REST_LIB_CORENAME}-shared")
set (HDF5_VOL_REST_TEST_LIB_TARGET "${HDF5_VOL_REST_TEST_LIB_CORENAME}-static")
set (HDF5_VOL_REST_TEST_LIBSH_TARGET "${HDF5_VOL_REST_TEST_LIB_CORENAME}-shared")


#-----------------------------------------------------------------------------
# Define some CMake variables for use later in the project
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -118,12 +116,16 @@ if (HDF5_ENABLE_THREADSAFE AND NOT Threads_FOUND)
find_package(Threads)
endif ()

find_package (CURL 7.61 REQUIRED)
set (CURL_TARGET_LIBTYPE shared)

set(CURL_NO_CURL_CMAKE ON)
find_package (CURL 7.61 MODULE REQUIRED)

if (CURL_FOUND)
include_directories(${CURL_INCLUDE_DIRS})
set (LINK_LIBS ${LINK_LIBS} CURL::libcurl)
else ()
message (FATAL_ERROR "cURL not found; please check CURL_INCLUDE_DIR")
message (FATAL_ERROR "cURL not found; please check CURL_ROOT")
endif ()

# Include custom module for finding YAJL
Expand Down Expand Up @@ -283,11 +285,7 @@ endmacro (HDF5_VOL_REST_SET_LIB_OPTIONS)

#-------------------------------------------------------------------------------
macro (RV_TARGET_C_PROPERTIES wintarget libtype addcompileflags addlinkflags)
if (MSVC)
TARGET_MSVC_PROPERTIES (${wintarget} ${libtype} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}")
else ()
set_target_properties (${wintarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}")
endif ()
set_target_properties (${wintarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}")
endmacro ()

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -345,7 +343,7 @@ set (EXTERNAL_LIBRARYDLL_LIST "")
#-----------------------------------------------------------------------------
# Run all the CMake configuration tests for our build environment
#-----------------------------------------------------------------------------
#include (${HDF5_VOL_REST_RESOURCES_DIR}/ConfigureChecks.cmake)
include (${HDF5_VOL_REST_RESOURCES_DIR}/ConfigureChecks.cmake)

set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)

Expand Down
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ and can directly be obtained from:

`git clone https://github.com/HDFGroup/vol-rest`

For building with the 1.12 or later version of the HDF5 library, use the hdf5_1_12_update branch of this repository.

A source distribution of the HDF5 library has been included in the REST VOL connector
source in the `/src/hdf5` directory.

Expand Down Expand Up @@ -141,9 +139,6 @@ The following configuration options are available to all of the build scripts:
mostly useful in helping to diagnose any possible memory leaks or other
memory errors within the connector.

-g Enables symbolic debugging of the REST VOL code. (Only available for
`build_vol_autotools.sh`)

-P DIR Specifies where the REST VOL connector should be installed. The default
installation prefix is `rest_vol_build` inside the REST VOL connector source
root directory.
Expand All @@ -158,7 +153,15 @@ The following configuration options are available to all of the build scripts:
-Y DIR Specifies the top-level directory where YAJL is installed. Used if YAJL is
not installed to a system path or used to override

Additionally, the CMake build scripts have the following configuration options:
The following configuration options are specific to `build_vol_autotools.sh`:

-g Enables symbolic debugging of the REST VOL code.

The following configuration options are specific to the CMake build scripts:

-u Specifies that a static cURL library should be used as a dependency.

-t Specifies that a static YAJL library should be used as a dependency.

-B DIR Specifies the directory that CMake should use as the build tree location.
The default build tree location is `rest_vol_cmake_build_files` inside the
Expand Down Expand Up @@ -291,7 +294,8 @@ components mentioned previously cannot be found within the system path.
* `HDF5_VOL_REST_ENABLE_MEM_TRACKING` - Enables/Disables memory tracking within the REST VOL connector. This option is mostly useful in helping to diagnose any possible memory leaks or other memory errors within the connector. The default value is `OFF`.
* `HDF5_VOL_REST_THREAD_SAFE` - Enables/Disables linking to HDF5 statically compiled with thread safe option. The default value is `OFF`.
* `YAJL_USE_STATIC_LIBRARIES` - Indicate if the static YAJL libraries should be used for linking. The default value is `OFF`.

* `CURL_USE_STATIC_LIBRARIES` - Indicate if the static CURL libraries should be used for linking. The default value is `OFF`.

Note, when setting BUILD_SHARED_LIBS=ON and YAJL_USE_STATIC_LIBRARIES=ON, the static YAJL libraries have be build with the position independent code (PIC) option enabled. In the static YAJL build,
this PIC option has been turned off by default.

Expand All @@ -301,7 +305,7 @@ It is also possible to build the REST VOL as part of the build process for the H

### II.B.v. Build Results

If the build is successful, the following files will be written into the installation directory:
If the build is successful, the following files will be written into the installation directory on a Linux or OSX machine:

```
bin/
Expand All @@ -327,6 +331,8 @@ share/
hdf5_vol_rest-targets-<build mode>.cmake
```

On a Windows system, the installation directory will have a few differences. If shared libraries are built, the resulting `hdf5_vol_rest.dll` will be found in the `bin` directory. If tests are enabled, `test_rest_vol(-shared).exe` will also be in the `bin` directory. If static libraries are built, `lib` will contain `libhdf5_vol_rest.lib`.

If the REST VOL connector was built using one of the included build scripts, all of the usual files
from an HDF5 source build should appear in the respective `bin`, `include`, `lib` and `share`
directories in the install directory. Notable among these is `bin/h5cc`, a special-purpose compiler wrapper script that streamlines the process of building HDF5 applications.
Expand Down
Loading
Loading