Skip to content

Add windows build to CI #36

Add windows build to CI

Add windows build to CI #36

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
jobs:
Win64:
runs-on: windows-latest
strategy:
fail-fast: true
env:
BASE_DIR: ${{ github.workspace }}
SRC_DIR: ${{ github.workspace }}/src
BUILD_DIR: ${{ github.workspace }}/build
INSTALL_PREFIX: ${{ github.workspace }}/cadet
steps:
- uses: actions/checkout@v4
with:
submodules: true
path: src
ref: ${{ github.event.inputs.ref || github.ref }}
- uses: ilammy/msvc-dev-cmd@v1
- name: Get MSVC version
id: get-msvc
run: |
$MSVC_VERSION = cl 2>&1 | Select-String -Pattern 'Version (\d\d\.\d\d)' | % { $_.matches.groups[1].Value }
echo "version=$MSVC_VERSION" >> $Env:GITHUB_OUTPUT
- uses: actions/cache@v4
id: cache
with:
path: |
${{ github.workspace }}/hdf5
${{ github.workspace }}/eigen/install
key: ${{ runner.os }}-deps-${{ steps.get-msvc.outputs.version }}-1
- name: Build HDF5 and Eigen3
if: steps.cache.outputs.cache-hit != 'true'
run: |
$base_dir = $($env:BASE_DIR.Replace('\', '/'))
Invoke-WebRequest -Uri "https://www.hdfgroup.org/package/cmake-hdf5-1-14-0-zip/?wpdmdl=17553" -OutFile hdf5.zip
7z x hdf5.zip
cd CMake-hdf5-1.14.0
cmake -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=ON -DHDF5_BUILD_FORTRAN:BOOL=OFF -DHDF5_ENABLE_F2003:BOOL=OFF -DHDF5_BUILD_JAVA:BOOL=OFF -DCMAKE_INSTALL_PREFIX:PATH="${base_dir}/hdf5" -DCTEST_CONFIGURATION_TYPE:STRING=Release -DBUILD_TESTING=ON -DHDF5_BUILD_TOOLS=OFF -DHDF5_BUILD_EXAMPLES=OFF -DHDF5_BUILD_HL_LIB=OFF -DHDF5_BUILD_CPP_LIB=OFF -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH="${base_dir}/CMake-hdf5-1.14.0" -DHDF5_PACKAGE_EXTLIBS:BOOL=ON -DSITE:STRING=WIN10VS202264.XXXX -DBUILDNAME:STRING=Windows-WIN10-vs2022-STATIC -G "Ninja" hdf5-1.14.0
ninja install
cd "${env:BASE_DIR}"
Invoke-WebRequest -Uri "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip" -OutFile eigen.zip
7z x eigen.zip -oeigen\code -y
cd eigen
mkdir build
cd build
cmake ../code/eigen-3.4.0 -DCMAKE_INSTALL_PREFIX="../install"
cmake --build . --target install
Ubuntu-latest:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
libhdf5-dev \
libgmp-dev \
libmpfr-dev \
libmpc-dev \
libeigen3-dev;
- name: Download CADET-semi-analytic dependencies
run: |
# Download and build the required libraries if needed
# Note: Add commands here if any libraries need to be downloaded and built
- name: Create build directory
run: mkdir build && cd build
- name: Run CMake
working-directory: build
run: |
# Set environment variables for CMake to locate libraries
export GMP_ROOT=/usr/include
export MPFR_ROOT=/usr/include
export MPC_ROOT=/usr/include
export HDF5_ROOT=/usr/include
cmake -DCMAKE_INSTALL_PREFIX=install/ \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER=gcc \
-DUSE_FADBAD=ON \
-DENABLE_TESTS=OFF \
..
- name: Build
working-directory: build
run: make -j$(nproc)
- name: Install
working-directory: build
run: make install
- name: Verify installation
run: |
./build/install/bin/chromatogram --version