Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.88 KiB
stages:
  - build

mac:
  tags:
  - MacOS
  stage: build
  script:
    - mkdir build
    - cd build
    - export QTDIR=/usr/local/opt/qt5
    - cmake .. -D CMAKE_PREFIX_PATH=$QTDIR -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -DBORNAGAIN_APPLE_BUNDLE=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
    - make -j2
    - ctest --output-on-failure
    - cpack . -V
  artifacts:
    paths:
    - build/*dmg
    expire_in: 10 days


# To test the GitLab process _locally_ on MS-Windows with powershell (pwsh),
# go to the root Git directory, and run:
# C:\GitLab-Runner\gitlab-runner.exe exec shell --shell pwsh --builds-dir <gitlab build-dir> <job-name>

windows:
  tags:
    - Windows
  stage: build
  cache:
    key: build-cache
    paths:
      - build/
  script:
    - $OPT_DIR = "C:/opt/x64"
    - $BOOST_DIR = "$OPT_DIR/boost_current"
    - $BOOST_INCLUDE_DIR = "$BOOST_DIR/include"
    - $BOOST_LIB_DIR = "$BOOST_DIR/lib"
    - $QT_MSVC_DIR = "C:/Qt/msvc"
    - $QTCMake_DIR = "$QT_MSVC_DIR/lib/cmake"
    - $BUILD_DIR = "build"
    - echo "#--- DIAGNOSTICS ---"
    # list powershell properties
    - echo "# Path <$Env:Path>"
    - echo "# Powershell <$PSHOME>`n  PS Profile <$PROFILE>`n  PS Command-Path <$PSCOMMANDPATH>"
    # list all environmental variables
    - echo "----------------------------------------"
    - 'dir Env:'
    # make the CMake build directory
    - echo "----------------------------------------"
    - if($CI_PIPELINE_SOURCE -eq "schedule") { mkdir -Force $BUILD_DIR; echo "scheduled build" }
    - if(!(Test-Path -path $BUILD_DIR)) { mkdir -Force $BUILD_DIR; echo "build from scratch" }
    - cd $BUILD_DIR
    - Remove-Item CM* -Recurse
    - pwd
    - echo "#--- CONFIGURE ---"
    - cmake --version
    - cmake -G "Visual Studio 16 2019" -A x64 -T host=x64 -DLIB_MAN=OFF -DQTDIR="$QT_MSVC_DIR" -DQt5_DIR="$QTCMake_DIR/Qt5" -DQt5Test_DIR="$QTCMake_DIR/Qt5Test" -DCMAKE_INCLUDE_PATH="$OPT_DIR/include;$BOOST_INCLUDE_DIR" -DCMAKE_LIBRARY_PATH="$OPT_DIR/lib;$BOOST_LIB_DIR" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -B. ..
    - echo "#--- BUILD ---"
    - pwd
    - if($CI_PIPELINE_SOURCE -eq "schedule") { cmake --build . --target clean }
    - cmake --build . --config Release
    - echo "#--- TEST ---"
    - ctest -C Release --parallel 8 --output-on-failure
    - echo "#--- PACKAGING ---"
    # build package via NSIS
    - cpack -C Release --verbose -B ./winpackage
  artifacts:
    paths:
    - build/winpackage/BornAgain*.exe
    expire_in: 1 week

native_Debian_clang:
  tags: &native
  - Debian
  before_script: &debian_clang
    - export CC=clang; export CXX=clang++
    - cmake --version
    - clang --version
  stage: build
  script: &native_scr
    - pwd
    - mkdir build
    - cd build
    - cmake .. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache #-DWERROR=ON
    - make -j6
    - xvfb-run -a ctest -j6 --output-on-failure
    - make package_source
  artifacts:
    paths:
    - build/*gz
    expire_in: 10 days