netgen/.gitlab-ci.yml

154 lines
3.8 KiB
YAML
Raw Normal View History

stages:
- build
- test
- deploy
- cleanup
############################################
# System templates
############################################
# Windows
.template_windows_64: &win64
tags:
- windows
- x64
before_script:
- "echo off"
- 'call "%VS140COMNTOOLS%\..\..\VC\bin\amd64\vcvars64.bat"'
- set CMAKE_GENERATOR=Visual Studio 14 2015 Win64
- set CI_DIR=C:\ci\%CI_BUILD_REF%_64
- 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
# Linux
.template_ubuntu: &ubuntu
tags:
- linux
before_script:
- pwd
- ls
- docker info
variables:
UBUNTU_VERSION: "18.04"
############################################
# Build stage
############################################
# Windows
build_netgen_win64:
<<: *win64
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
cache:
key: "netgen_win64_${CI_BUILD_REF_NAME}"
paths:
- build/
- src/
# Linux
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 stage
############################################
# Windows
test_win64:
<<: *win64
stage: test
script:
- cd %NETGEN_BUILD_DIR%/netgen
- ctest -C Release -V
- cd ..
# Linux
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
############################################
# 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
############################################
# Cleanup stage
############################################
linux_cleanup:
stage: cleanup
tags:
- linux
script:
# remove intermediate and old docker images and containers
- docker rm -f `docker ps --no-trunc -aq`
- docker images --no-trunc -aqf "dangling=true" | xargs docker rmi -f
when: always
allow_failure: true
win64_cleanup:
<<: *win64
stage: cleanup
tags:
- windows
- x64
script:
- cd %CI_PROJECT_DIR%
- rd /s /q %CI_DIR%
when: always
allow_failure: true