netgen/.gitlab-ci.yml

193 lines
5.0 KiB
YAML
Raw Normal View History

stages:
- build
- test
- deploy
- cleanup
############################################
2018-12-14 15:24:07 +05:00
# Windows
############################################
2018-12-14 15:56:11 +05:00
.template_windows: &win
tags:
- windows
- x64
before_script:
- "echo off"
2019-01-03 19:55:17 +05:00
- 'call "%VS2017INSTALLDIR%\VC\Auxiliary\Build\vcvars64"'
- set CMAKE_GENERATOR=Visual Studio 15 2017 Win64
2018-12-14 16:13:22 +05:00
- set CI_DIR=C:\ci\%CI_PIPELINE_ID%
- set NETGEN_BUILD_DIR=%CI_DIR%\build
- set INSTALL_DIR=%CI_DIR%\install
- set NETGENDIR=%INSTALL_DIR%\bin
- set PYTHONPATH=%INSTALL_DIR%\lib\site-packages
2018-12-14 15:56:11 +05:00
build_win:
<<: *win
stage: build
script:
- git submodule update --init --recursive
- rd /s /q %NETGEN_BUILD_DIR%
- mkdir %NETGEN_BUILD_DIR%
- cd %NETGEN_BUILD_DIR%
- >-
cmake %CI_PROJECT_DIR%
-G"%CMAKE_GENERATOR%"
-DINSTALL_DIR=%INSTALL_DIR%
-DUSE_OCC=ON
-DCMAKE_BUILD_TYPE=Release
- cmake --build . --target INSTALL --config Release
2018-12-14 15:56:11 +05:00
test_win:
<<: *win
2018-12-14 15:24:07 +05:00
stage: test
script:
2018-12-14 16:13:22 +05:00
- cd %NETGEN_BUILD_DIR%\netgen
2018-12-14 15:24:07 +05:00
- ctest -C Release -V
- cd ..
2018-12-14 15:56:11 +05:00
cleanup_win:
<<: *win
2018-12-14 15:24:07 +05:00
stage: cleanup
tags:
- windows
- x64
script:
- cd %CI_PROJECT_DIR%
- rd /s /q %CI_DIR%
when: always
allow_failure: true
############################################
# Ubuntu/Linux
############################################
.template_ubuntu: &ubuntu
tags:
- linux
before_script:
- pwd
- ls
- docker info
variables:
UBUNTU_VERSION: "18.04"
build_ubuntu:
<<: *ubuntu
stage: build
script:
- docker build -t netgen_${CI_BUILD_REF_NAME}:${UBUNTU_VERSION} -f tests/dockerfile .
- rm -f netgen_${CI_BUILD_REF_NAME}_$UBUNTU_VERSION.id
- docker run --cidfile netgen_${CI_BUILD_REF_NAME}_${UBUNTU_VERSION}.id -e CCACHE_DIR=/ccache -v /mnt/ccache:/ccache netgen_${CI_BUILD_REF_NAME}:${UBUNTU_VERSION} bash /root/src/netgen/tests/build.sh
- docker commit `cat netgen_${CI_BUILD_REF_NAME}_${UBUNTU_VERSION}.id` netgen_${CI_BUILD_REF_NAME}_installed:${UBUNTU_VERSION}
- rm netgen_${CI_BUILD_REF_NAME}_${UBUNTU_VERSION}.id
test_ubuntu:
<<: *ubuntu
stage: test
script:
- >-
docker run
-e NETGENDIR=/opt/netgen/bin
-e PYTHONPATH=/opt/netgen/lib/python3/dist-packages
netgen_${CI_BUILD_REF_NAME}_installed:${UBUNTU_VERSION}
bash -c 'cd /root/build/netgen && make test_netgen ARGS="-V"'
2018-12-12 15:43:28 +05:00
# cpp guideline checks
test_guidelines:
2018-12-12 18:43:19 +05:00
<<: *ubuntu
2018-12-12 15:43:28 +05:00
stage: test
script:
2018-12-12 17:41:18 +05:00
- docker run -e CCACHE_DIR=/ccache -v /mnt/ccache:/ccache netgen_${CI_BUILD_REF_NAME}:${UBUNTU_VERSION} bash /root/src/netgen/tests/build_guidelines.sh
when: always
2018-12-28 17:43:15 +05:00
# check if it compiles without spdlog
test_noSpdlog:
<<: *ubuntu
stage: test
script:
- docker run -e CCACHE_DIR=/ccache -v /mnt/ccache:/ccache netgen_${CI_BUILD_REF_NAME}:${UBUNTU_VERSION} bash /root/src/netgen/tests/build_nospdlog.sh
2018-12-14 15:56:11 +05:00
cleanup_ubuntu:
2018-12-14 15:24:07 +05:00
stage: cleanup
tags:
- linux
script:
# remove intermediate and old docker images and containers
- docker rm -f `docker ps --no-trunc -aq`
2018-12-14 15:31:42 +05:00
- docker images --no-trunc -aqf "dangling=true" | xargs docker rmi -f || true
when: always
allow_failure: true
############################################
# MacOSX
############################################
.template_mac: &mac
tags:
- mac
before_script:
- export ROOT_DIR=/tmp/$CI_PIPELINE_ID
- export SRC_DIR=$ROOT_DIR/src
- export BUILD_DIR=$ROOT_DIR/build
- export CMAKE_INSTALL_PREFIX=/tmp/$CI_PIPELINE_ID/install/Netgen.app
- export PYTHONPATH=$CMAKE_INSTALL_PREFIX/Contents/Resources/`python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1,0,''))"`:.
- export PATH=$CMAKE_INSTALL_PREFIX/Contents/MacOS:$PATH
2018-12-14 15:56:11 +05:00
build_mac:
2018-12-14 15:31:42 +05:00
<<: *mac
stage: build
script:
- git submodule update --init --recursive
- rm -rf $BUILD_DIR
- mkdir -p $BUILD_DIR
- rm -rf $SRC_DIR
- mkdir -p $SRC_DIR
- cp -a . $SRC_DIR/
- cd $BUILD_DIR
- >-
cmake $SRC_DIR
-DCMAKE_INSTALL_PREFIX=$CMAKE_INSTALL_PREFIX
-DCMAKE_BUILD_TYPE=Release
-DUSE_NATIVE_ARCH=OFF
-DUSE_CCACHE=ON
-DENABLE_UNIT_TESTS=ON
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9
-DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
- make -j5 install
2018-12-14 15:56:11 +05:00
test_mac:
2018-12-14 15:31:42 +05:00
<<: *mac
stage: test
script:
- cd $BUILD_DIR/netgen
- ctest . --output-on-failure
2018-12-14 15:56:11 +05:00
cleanup_mac:
2018-12-14 15:31:42 +05:00
<<: *mac
stage: cleanup
script:
- rm -rf $ROOT_DIR
2018-12-14 15:24:07 +05:00
when: always
allow_failure: true
############################################
# Deploy stage
############################################
deploy_sourceforge:
stage: deploy
tags:
- linux
- docker
script:
- git remote add sourceforge ssh://mhochste@git.code.sf.net/p/netgen-mesher/git || true
2017-07-18 14:53:52 +05:00
- git remote add github git@github.com:NGSolve/netgen.git || true
- git remote update
- git checkout master
- git pull origin master
- git push sourceforge master
2017-07-18 14:53:52 +05:00
- git push github master
only:
- master