Skip to content
Snippets Groups Projects
.gitlab-ci.yml 5.85 KiB
Newer Older
  • Learn to ignore specific revisions
  • Wuttke, Joachim's avatar
    Wuttke, Joachim committed
    stages:
      - build
    
    
    # global variables
    variables:
      GIT_DEPTH: "1"
    
    
    native_Debian:
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
      tags:
    
      before_script: &native_before
    
        - export CC=gcc; export CXX=g++
    
    AlQuemist's avatar
    AlQuemist committed
        # avoid using the default Debian Qt framework
    
        - QTCMAKE="/usr/local/Qt6/6.2.3/gcc_64/lib/cmake"
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
        - cmake --version
      stage: build
      script: &native_scr
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
        - mkdir build
        - cd build
    
        # NOTE: CMake's Ninja generator should not be used with CMake < 3.26 due to internal bugs.
    
        - time cmake .. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_PREFIX_PATH="$QTCMAKE" -DZERO_TOLERANCE=ON -DDEVELOPER_CHECKS=ON
    
        - time make -j16
    
        - time xvfb-run -a ctest -j16 --output-on-failure
    
        - time make package_source
    
        - time bash var/mk_wheel_multilinux.sh
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
      artifacts:
        paths:
    
        - build/py/wheel/manylinux/*.whl
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
        expire_in: 10 days
    
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
    .aux1: &compile_dependency
      - mkdir build
      - cd build
      - cmake .. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
      - make -j4
      - ctest
      - make install
    
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
    debian_oldstable_py38:
    
        - LinuxDocker
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
      image: scg-debian-oldstable:latest
    
      before_script:
    
        - pyenv global 3.8
      stage: build
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
      script: &docker_build
    
        - ORIGINAL_DIR=$(pwd)
    
        - export CC=gcc; export CXX=g++
        - export MPLBACKEND=Agg
        - ldd --version
        - cmake --version
        - eval "$(pyenv init -)"
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
        - python --version
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
        - cd /libheinz
    
        <<: *compile_dependency
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
        - cd /libcerf
    
        <<: *compile_dependency
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
        - cd /libformfactor
    
        <<: *compile_dependency
        - cd $ORIGINAL_DIR
    
        <<: *native_scr
    
      rules:
      - if: '$CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
    
      before_script: *native_before
    
      stage: build
      script:
        - hugo version
        - mkdir build
        - cd build
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
        - time cmake .. -GNinja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBA_GUI=OFF
        - time ninja -j8
        - time ninja -j8 webdoc
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
        - rm -rf ~www/ba/git-main/hugo-public
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
        - cp -r ../hugo/public ~www/ba/git-main/hugo-public
    
      - mac_x64_cloud
    
      stage: build
      before_script:
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
        - NPROC=12 # number of logical CPUs obtained from `sysctl hw.logicalcpu`
    
        - BREWDIR="/opt/homebrew-x86"
        - QTDIR="$BREWDIR/Cellar/qt/6.6.0"
        - PYPLAT="/Users/qtisas/.pyenv/versions/3.11.6/"
    
        - PATH="$BREWDIR:$PATH"
    
      script:  &mac_script
    
        - OPTDIR="/Users/Shared/Software/scg"
    
        - CCACHE="$BREWDIR/bin/ccache"
    
        - mkdir build
        - cd build
    
        - cmake .. -DCMAKE_PREFIX_PATH="$OPTDIR;$QTDIR/lib/cmake;$BREWDIR" -DCMAKE_BUILD_TYPE=Release -DPython3_ROOT_DIR="$PYPLAT" -DCMAKE_CXX_COMPILER_LAUNCHER="$CCACHE" -DBA_APPLE_BUNDLE=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=11 -DCMAKE_INSTALL_PREFIX=/tmp/ba -DZERO_TOLERANCE=ON
    
        - make -j$NPROC
        - ctest -j3 --output-on-failure
    
      artifacts: &mac_artifacts
        paths:
    
        - build/py/wheel/*.whl
    
        expire_in: 10 days
    
    
    mac_arm:
      tags:
      - mac_arm
      stage: build
      before_script:
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
        - NPROC=14 # number of logical CPUs obtained from `sysctl hw.logicalcpu`
    
        - BREWDIR="/opt/homebrew"
        - QTDIR="$BREWDIR/opt/qt"
        - PYPLAT="/Users/qtisas/.pyenv/versions/3.11.6/"
    
      script: *mac_script
      artifacts: *mac_artifacts
    
    
    # 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"
        - $QT_MSVC_DIR = "C:/Qt/6.2.4/msvc2019_64"
        - $QTCMake_DIR = "$QT_MSVC_DIR/lib/cmake"
        - $PY_PLATFORM_DIR = "C:/Users/admin/.pyenv/pyenv-win/versions/3.11.5/"
        - $BUILD_DIR = "build"
        # change the system PATH temporarily (needed for tests)
        - $env:PYTHONPATH += "$CI_PROJECT_DIR/build/lib"
        - $env:PATH = "$QT_MSVC_DIR/bin;$env:PATH"
        # list powershell properties
        - echo "# Path '<$Env:Path>'"
        - echo "# PythonPath '<$Env:PYTHONPATH>'"
        - echo "# Powershell <$PSHOME>`n  PS Profile <$PROFILE>`n  PS Command-Path <$PSCOMMANDPATH>"
    
        # Visual Studio path <https://github.com/microsoft/vswhere/wiki/Find-VC>
        - $vsPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationpath
        - echo "Microsoft Visual Studio path = '$vsPath'"
        - Import-Module (Get-ChildItem $vsPath -Recurse -File -Filter Microsoft.VisualStudio.DevShell.dll).FullName
        - Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments '-arch=x64'
        - Set-Item -Path "env:CC" -Value "cl.exe"
        - Set-Item -Path "env:CXX" -Value "cl.exe"
    
        # list all environmental variables
        - 'dir Env:'
        # make the CMake build directory
        - 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
        # configure, make, test, pack
        - cmake --version
    
        - cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$OPT_DIR;$QTCMake_DIR;$BOOST_DIR" -DPython3_ROOT_DIR="$PY_PLATFORM_DIR" -DCPACK_IFW_ROOT="C:/Qt/Tools/QtInstallerFramework/4.5" -DCMAKE_C_COMPILER_LAUNCHER="buildcache.exe" -DCMAKE_CXX_COMPILER_LAUNCHER="buildcache.exe" -B. ..
    
        - pwd
        - if($CI_PIPELINE_SOURCE -eq "schedule") { cmake --build . --target clean; echo "redundant target purge done" }
        - cmake --build . -j20 --config Release
        - ctest -C Release --parallel 20 --output-on-failure
        - cpack -C Release -B ./installer .
      artifacts:
        paths:
        - build/installer/BornAgain*.exe
        - build/py/wheel/*.whl
        expire_in: 10 days