Skip to content

Commit

Permalink
Update gh actions (#18)
Browse files Browse the repository at this point in the history
* draft new setup

* fix++

* fix++

* fix++

---------

Co-authored-by: tnagler <thomas.nagler@tum.de>
  • Loading branch information
tnagler and tnagler authored Mar 23, 2024
1 parent 2aa8921 commit 5c20b43
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 62 deletions.
92 changes: 92 additions & 0 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: 'Install Dependencies'
description: 'Install Eigen, Boost, and other dependencies required by kde1d'
inputs:
os:
description: 'The operating system to install dependencies for'
required: false
default: 'ubuntu-latest'
platform:
description: 'The platform to install dependencies for'
required: false
default: 'x64'
boost:
description: 'Whether to install Boost'
required: false
default: true
boost_install_dir:
description: 'The directory to install Boost to'
required: false
default: '/home/runner/work'
boost_version:
description: 'The version of Boost to install'
required: false
default: '1.84.0'
eigen:
description: 'Whether to install Eigen'
required: false
default: true
eigen_install_dir:
description: 'The directory to install Eigen to'
required: false
default: '/home/runner/work'
eigen_version:
description: 'The version of Eigen to install'
required: false
default: '3.4.0'
lcov:
description: 'Whether to install lcov'
required: false
default: true
update_compilers_ubuntu:
description: 'Whether to update the compilers on Ubuntu'
required: false
default: true
outputs:
BOOST_ROOT:
description: 'The path to the boost installation, e.g. to be used in CMake'
value: ${{ steps.boost.outputs.BOOST_ROOT }}
EIGEN3_ROOT:
description: 'The path to the eigen installation, e.g. to be used in CMake'
value: ${{ inputs.eigen_install_dir }}/eigen
runs:
using: 'composite'
steps:

- name: Update compilers on ubuntu
if: ${{ inputs.update_compilers_ubuntu }}
run: |
if [ "${{ inputs.os }}" == "ubuntu-latest" ]; then
sudo apt-get update
sudo apt-get install --no-install-recommends -y g++ clang
sudo apt-get autoremove
fi
shell: bash

- name: Install boost ${{inputs.boost_version}}
if: ${{ inputs.boost }}
id: boost
uses: MarkusJx/install-boost@v2.3.1
with:
boost_version: ${{inputs.boost_version}}
boost_install_dir: ${{ inputs.boost_install_dir }}

- name: Install Eigen ${{inputs.eigen_version}}
if: ${{ inputs.eigen }}
run: |
if [ "${{ inputs.os }}" != "windows-latest" ]; then
git clone --depth 1 --branch ${{inputs.eigen_version}} https://gitlab.com/libeigen/eigen.git/ ${{runner.temp}}/eigen
cmake ${{runner.temp}}/eigen -B ${{runner.temp}}/eigen/build -DCMAKE_INSTALL_PREFIX=${{ inputs.eigen_install_dir }}
make install -C ${{runner.temp}}/eigen/build
else
cmd "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ inputs.platform }}
choco install eigen --version="${{inputs.eigen_version}}"
fi
shell: bash

- name: Install lcov
if: ${{ inputs.lcov }}
run: |
if [ "${{ inputs.os }}" == "ubuntu-latest" ]; then
sudo apt-get install --no-install-recommends -y lcov
fi
shell: bash
90 changes: 28 additions & 62 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,65 +9,44 @@ jobs:
max-parallel: 6
matrix:
cfg:
- { os: ubuntu-latest, name: GNU, cc: gcc, cxx: g++, platform: x64}
- { os: ubuntu-latest, name: Clang, cc: clang, cxx: clang++, platform: x64}
# - { os: macos-latest, name: GNU, cc: gcc, cxx: g++, platform: x64}
- { os: macos-latest, name: Clang, cc: clang, cxx: clang++, platform: x64}
- { os: windows-latest, name: VS2019, cc: cl, cxx: cl, platform: x32}
- { os: windows-latest, name: VS2019, cc: cl, cxx: cl, platform: x64}
- { os: ubuntu-latest, name: GNU, cc: gcc, cxx: g++, platform: x64, root_install_dir: '/home/runner/work'}
- { os: ubuntu-latest, name: Clang, cc: clang, cxx: clang++, platform: x64, root_install_dir: '/home/runner/work'}
- { os: macos-13, name: Clang, cc: clang, cxx: clang++, platform: x64, root_install_dir: '/Users/runner/work'} # intel runner
- { os: macos-14, name: Clang, cc: clang, cxx: clang++, platform: x64, root_install_dir: '/Users/runner/work'} # apple silicon runner
- { os: windows-latest, name: x32, cc: cl, cxx: cl, platform: x32, root_install_dir: 'D:\'}
- { os: windows-latest, name: x64, cc: cl, cxx: cl, platform: x64, root_install_dir: 'D:\'}
env:
BOOST_VERSION: 1.84.0
EIGEN_VERSION: 3.4.0

runs-on: ${{ matrix.cfg.os }}
name: ${{ matrix.cfg.os }} (${{ matrix.cfg.name }}, ${{ matrix.cfg.platform }})
name: ${{ matrix.cfg.os }} (${{ matrix.cfg.name }}, ${{ matrix.cfg.platform }})
steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
id: install-dependencies
uses: ./.github/actions/install-dependencies
with:
os: ${{ matrix.cfg.os }}
platform: ${{ matrix.cfg.platform }}
boost_install_dir: ${{ matrix.cfg.root_install_dir }}
eigen_install_dir: ${{ matrix.cfg.root_install_dir }}
boost_version: ${{ env.BOOST_VERSION }}
eigen_version: ${{ env.EIGEN_VERSION }}
- name: Set environment variables and path
run: |
echo "CC=${{ matrix.cfg.cc }}" >> $GITHUB_ENV
echo "CCX=${{ matrix.cfg.ccx }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.cfg.cxx }}" >> $GITHUB_ENV
echo "BOOST_ROOT=${{ steps.install-dependencies.outputs.BOOST_ROOT }}" >> $GITHUB_ENV
echo "Boost_INCLUDE_DIR =${{ steps.install-dependencies.outputs.BOOST_ROOT }}/ include" >> $GITHUB_ENV
echo "EIGEN3_INCLUDE_DIR=${{ steps.install-dependencies.outputs.EIGEN3_ROOT }}/ include/eigen3" >> $GITHUB_ENV
if [ "${{ matrix.cfg.os }}" == "windows-latest" ]; then
echo "CMAKE_GEN_PLAT=x64" >> $GITHUB_ENV
echo "EIGEN3_INCLUDE_DIR=C:\projects\eigen-3.3.7" >> $GITHUB_ENV
echo "Boost_INCLUDE_DIR=D:\a\kde1d-cpp\kde1d-cpp" >> $GITHUB_ENV
echo "D:\a\kde1d-cpp\kde1d-cpp\release" >> $GITHUB_PATH
echo "D:\a\kde1d-cpp\kde1d-cpp\release" >> $GITHUB_PATH
echo "D:\a\kde1d-cpp\kde1d-cpp\release\Release" >> $GITHUB_PATH
if [ "${{ matrix.cfg.platform }}" == "x64" ]; then
echo "CMAKE_GEN_PLAT=x64" >> $GITHUB_PATH
else
echo "CMAKE_GEN_PLAT=Win32" >> $GITHUB_PATH
fi
fi
shell: bash
- name: Install other dependencies
run: |
if [ "${{ matrix.cfg.os }}" == "ubuntu-latest" ]; then
sudo apt-get update
sudo apt-get install --no-install-recommends -y lcov libgsl0-dev libeigen3-dev libboost-all-dev
sudo apt-get install --no-install-recommends -y --allow-unauthenticated g++ clang
sudo apt-get autoremove
elif [ "${{ matrix.cfg.os }}" == "macos-latest" ]; then
# rm '/usr/local/bin/gfortran'
# rm '/usr/local/bin/2to3'
# rm '/usr/local/bin/2to3-3.11'
# rm '/usr/local/bin/idle3'
# rm '/usr/local/bin/R'
# brew update
brew install lcov eigen gsl doxygen graphviz boost
elif [ "${{ matrix.cfg.os }}" == "windows-latest" ]; then
cmd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.cfg.platform }}
# choco upgrade cmake
choco install wget
wget https://github.com/vinecopulib/pyvinecopulib/raw/main/lib/boost_1_71_0.tar.gz
set current_dir=%CD%
echo %current_dir%
pwd
echo "${Boost_INCLUDE_DIR}"
tar xzvf boost_1_71_0.tar.gz
# choco install boost-msvc-14.3
choco install eigen
cmd "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.cfg. platform }}
echo "D:\a\vinecopulib\vinecopulib\release" >> $GITHUB_PATH
echo "D:\a\vinecopulib\vinecopulib\release\Release" >> $GITHUB_PATH
fi
shell: bash
- name: Compile the debug version
Expand Down Expand Up @@ -105,16 +84,3 @@ jobs:
cmake --build . --config Release --target install
fi
shell: bash
# - name: Install the release version and test the install
# run: |
# cd examples/TODO
# mkdir build && cd build
# if [ "${{ matrix.cfg.os }}" != "windows-latest" ]; then
# cmake .. && make
# ../bin/main
# else
# cmake .. -DCMAKE_GENERATOR_PLATFORM="${CMAKE_GEN_PLAT}" -DEIGEN3_INCLUDE_DIR="${EIGEN3_INCLUDE_DIR}" -DBoost_INCLUDE_DIR="${Boost_INCLUDE_DIR}" -DCMAKE_PREFIX_PATH="C:\\projects\\kde1d-cpp-release;${WDM_CMAKE_DIR}"
# cmake --build . --config Release
# "../bin/Release/main.exe"
# fi
# shell: bash

0 comments on commit 5c20b43

Please sign in to comment.