Skip to content

Build

Build #263

Workflow file for this run

name: Build
on:
push:
branches:
- '**'
workflow_dispatch:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
VCPKG_VERSION: f3c8c1cf46ff826b9062ad600a86ecf5fd574b92 #https://github.com/microsoft/vcpkg/commit/f3c8c1cf46ff826b9062ad600a86ecf5fd574b92
jobs:
Cache-Linux:
runs-on: ubuntu-latest
env:
VCPKG_DEFAULT_TRIPLET: x64-linux-release
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Intel Apt repository
timeout-minutes: 1
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
# See https://www.digitalocean.com/community/tutorials/how-to-handle-apt-key-and-add-apt-repository-deprecation-using-gpg-to-add-external-repositories-on-ubuntu-22-04
cat GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB | sudo gpg --dearmor -o /usr/share/keyrings/intel.gpg
echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/intel.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneapi.list
sudo apt update
- name: Cache Intel oneAPI
id: cache-intel
uses: actions/cache@v3
with:
path: |
/opt/intel/oneapi/setvars-vcvarsall.sh
/opt/intel/oneapi/setvars.sh
/opt/intel/oneapi/mkl
key: oneAPI-MKL-${{ runner.os }}-${{ hashFiles('GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB') }}
- name: Install Intel oneAPI
timeout-minutes: 5
if: steps.cache-intel.outputs.cache-hit != 'true'
run: sudo apt install -y intel-oneapi-common-vars intel-oneapi-mkl intel-oneapi-mkl-devel #devel needed for cmake and headers
- name: Setup vcpkg
id: setup-vcpkg
uses: friendlyanon/setup-vcpkg@v1
with:
committish: ${{ env.VCPKG_VERSION }}
cache-version: ${{github.run_number}}
cache-restore-keys: |
vcpkg-${{runner.os}}-${{github.run_number}}
vcpkg-${{runner.os}}
- name: System dependencies
run: |
sudo apt install -y clang
sudo apt install -y autoconf-archive #mpfr
sudo apt install -y libopengl-dev libglu-dev libx11-dev libxrandr-dev libxi-dev libxxf86vm-dev #freeglut
sudo apt install -y libxmu-dev libxi-dev libgl-dev #glew
sudo apt install -y libdbus-1-dev libxi-dev libxtst-dev #wxWidgets
- name: Run vcpkg
run: vcpkg/vcpkg install opengl freeglut glui glew cgal eigen3 tbb wxwidgets arpack-ng
Linux:
needs: Cache-Linux
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
compiler: [ {cpp: g++, c: gcc}, {cpp: clang++, c: clang} ]
runs-on: ${{ matrix.os }}
env:
VCPKG_DEFAULT_TRIPLET: x64-linux-release
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Intel Apt repository
timeout-minutes: 1
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
# See https://www.digitalocean.com/community/tutorials/how-to-handle-apt-key-and-add-apt-repository-deprecation-using-gpg-to-add-external-repositories-on-ubuntu-22-04
cat GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB | sudo gpg --dearmor -o /usr/share/keyrings/intel.gpg
echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/intel.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneapi.list
sudo apt update
- name: Restore cache Intel oneAPI
uses: actions/cache@v3
with:
path: |
/opt/intel/oneapi/setvars-vcvarsall.sh
/opt/intel/oneapi/setvars.sh
/opt/intel/oneapi/mkl
key: oneAPI-MKL-${{ runner.os }}-${{ hashFiles('GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB') }}
fail-on-cache-miss: true
- name: Set MKL environment variables
run: |
echo "ONEAPI_ROOT=/opt/intel/oneapi/" >> $GITHUB_ENV
echo "MKL_DIR=/opt/intel/oneapi/mkl/latest/lib/cmake/mkl" >> $GITHUB_ENV
- name: System dependencies
run: |
sudo apt install -y ninja-build
sudo apt install -y clang
sudo apt install -y autoconf-archive #mpfr
sudo apt install -y libopengl-dev libglu-dev libx11-dev libxrandr-dev libxi-dev libxxf86vm-dev #freeglut
sudo apt install -y libxmu-dev libxi-dev libgl-dev #glew
sudo apt install -y libdbus-1-dev libxi-dev libxtst-dev #wxWidgets
- name: Setup vcpkg
id: setup-vcpkg
uses: friendlyanon/setup-vcpkg@v1
with:
committish: ${{ env.VCPKG_VERSION }}
cache-version: ${{github.run_number}}
- name: Run vcpkg
run: vcpkg/vcpkg install opengl freeglut glui glew cgal eigen3 tbb wxwidgets arpack-ng
- uses: hendrikmuhs/[email protected]
with:
key: ${{ github.job }}-${{ matrix.os }}-${{ matrix.compiler.cpp }}
- name: Configure CMake
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cpp }}
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake \
-G Ninja \
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-D CMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake \
-D VCPKG_TARGET_TRIPLET=${VCPKG_DEFAULT_TRIPLET} \
-DMKL_DIR=/opt/intel/oneapi/mkl/latest/lib/cmake/mkl \
-S . \
-B build
- name: Build
run: |
cmake \
--build build \
--config ${{env.BUILD_TYPE}}
- name: Install
run: |
cmake \
--install build \
--prefix install \
--config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
ctest -C ${{env.BUILD_TYPE}}
- name: Upload installation folder
if: ${{strategy.job-index == 0}}
uses: actions/upload-artifact@v3
with:
name: Linux-install-dir
path: install
retention-days: 2
Cache-Windows:
runs-on: windows-latest
env:
INTEL_WINDOWS_MKL_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/19150/w_onemkl_p_2023.0.0.25930_offline.exe
VCPKG_DEFAULT_TRIPLET: x64-windows-release
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Restore cache for Intel oneAPI MKL
id: cache-intel
uses: actions/cache@v3
with:
path: |
C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat
C:\Program Files (x86)\Intel\oneAPI\setvars.bat
C:\Program Files (x86)\Intel\oneAPI\mkl
key: oneAPI-MKL-${{ runner.os }}-2023.0.0
# https://github.com/oneapi-src/oneapi-ci/blob/master/.github/workflows/build_all.yml
# https://oneapi-src.github.io/oneapi-ci/#intelr-oneapi-base-toolkit
# https://www.intel.com/content/www/us/en/docs/oneapi/installation-guide-windows/2023-0/install-with-command-line.html
- name: Install Intel oneAPI MKL
if: steps.cache-intel.outputs.cache-hit != 'true'
run: scripts/install_windows.bat $env:INTEL_WINDOWS_MKL_URL
- name: Setup vcpkg
id: setup-vcpkg
uses: friendlyanon/setup-vcpkg@v1
with:
committish: ${{ env.VCPKG_VERSION }}
cache-version: ${{github.run_number}}
cache-restore-keys: |
vcpkg-${{runner.os}}-${{github.run_number}}
vcpkg-${{runner.os}}
- name: Run vcpkg
run: vcpkg/vcpkg.exe install opengl freeglut glui glew cgal eigen3 tbb wxwidgets arpack-ng
Windows:
needs: Cache-Windows
strategy:
fail-fast: false
matrix:
os: [windows-2022]
compiler: [ {cpp: cl.exe, c: cl.exe}, {cpp: clang++, c: clang} ]
runs-on: ${{ matrix.os }}
env:
VCPKG_DEFAULT_TRIPLET: x64-windows-release
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install ninja
run: choco install ninja
- name: Restore cache for Intel oneAPI MKL
id: cache-intel
uses: actions/cache@v3
with:
path: |
C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat
C:\Program Files (x86)\Intel\oneAPI\setvars.bat
C:\Program Files (x86)\Intel\oneAPI\mkl
key: oneAPI-MKL-${{ runner.os }}-2023.0.0
fail-on-cache-miss: true
- name: Set MKL environment variables
run: |
echo "ONEAPI_ROOT=C:\Program Files (x86)\Intel\oneAPI" >> $env:GITHUB_ENV
echo "MKL_DIR=C:\Program Files (x86)\Intel\oneAPI\mkl\latest\lib\cmake\mkl" >> $env:GITHUB_ENV
- name: Setup vcpkg
id: setup-vcpkg
uses: friendlyanon/setup-vcpkg@v1
with:
committish: ${{ env.VCPKG_VERSION }}
cache-version: ${{github.run_number}}
- name: Run vcpkg
run: |
vcpkg/vcpkg.exe install opengl freeglut glui glew cgal eigen3 tbb wxwidgets arpack-ng
- name: Install ccache and ninja # For correct caching with ccache on Windows
shell: bash
run: |
choco install ccache
- uses: hendrikmuhs/[email protected]
with:
key: ${{ github.job }}-${{ matrix.os }}-${{ matrix.compiler.cpp }}
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake.exe `
-G Ninja `
-D CMAKE_C_COMPILER:FILEPATH=${{ matrix.compiler.c }} `
-D CMAKE_CXX_COMPILER:FILEPATH=${{ matrix.compiler.cpp }} `
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} `
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="vcpkg/scripts/buildsystems/vcpkg.cmake" `
-D VCPKG_TARGET_TRIPLET=${{env.VCPKG_DEFAULT_TRIPLET}} `
-S . `
-B build
- name: Build VegaFEM
run: |
cmake.exe `
--build build `
--config ${{env.BUILD_TYPE}}
- name: Install
run: |
cmake `
--install build `
--prefix install `
--config ${{env.BUILD_TYPE}}
- name: Upload install folder
if: ${{strategy.job-index == 0}}
uses: actions/upload-artifact@v3
with:
name: Windows-install-dir
path: install
retention-days: 2