<commit_before>## Copyright 2009-2020 Intel Corporation
## SPDX-License-Identifier: Apache-2.0

stages:
  - build
  - docu
  - test
  - benchmark
  - scan1
  - scan2
  - release
  - scan3
  - mirror

variables:
  GIT_DEPTH: "15"
  KW_PROJECT_NAME: ospray
  ErrorActionPreference: STOP

.job_template: &build_job_docker
  stage: build
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:arch  # default image
  script:
    - scripts/build_gitlab/linux.sh

.job_template: &build_job_docker_modules
  stage: build
  tags:
    - docker
    - modules
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7-mod
  script:
    - scripts/build_gitlab/linux.sh

.job_template: &build_artifacts
  artifacts:
    paths:
      - build/install/ospray
      - build/CMakeCache.txt
      - build/ospray/build/CMakeCache.txt
    expire_in: 3 day

.job_template: &release_job
  stage: release
  needs: [pdf]
  only:
    - devel
    - master
    - /release/

.job_template: &test_job
  stage: test
  tags: [docker]
  artifacts:
    paths:
      - build_regression_tests/tests.xml
      - build_regression_tests/failed
    expire_in: 1 week
    when: always

.job_template: &test_job_unix
  <<: *test_job
  script:
    - LD_LIBRARY_PATH="$CI_PROJECT_DIR/build/install/ospray/lib:$LD_LIBRARY_PATH" PATH="$CI_PROJECT_DIR/build/install/ospray/bin:$PATH" scripts/tests/run_tests.sh "$CI_PROJECT_DIR"

.job_template: &test_job_windows
  <<: *test_job
  script:
    - $env:Path += ";$CI_PROJECT_DIR\build\install\ospray\bin"
    - scripts\tests\run_tests.ps1 "$CI_PROJECT_DIR"

.job_template: &benchmark_job
  stage: benchmark
  when: manual
  script:
    - scripts/tests/run-benchmarks.sh

### BUILD JOBS ###

build-arch-gcc:
  <<: *build_job_docker
  script:
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF

build-arch-clang:
  <<: *build_job_docker
  script:
    - export CC=clang
    - export CXX=clang++
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF

build-arch-gcc-extras:
  <<: *build_job_docker
  script:
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF -DBUILD_OSPRAY_CI_EXTRAS=ON -DBUILD_OIDN=ON

build-arch-clang-extras:
  <<: *build_job_docker
  script:
    - export CC=clang
    - export CXX=clang++
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF -DBUILD_OSPRAY_CI_EXTRAS=ON -DBUILD_OIDN=ON

build-arch-clang-devel:
  <<: *build_job_docker
  script:
    - export CC=clang
    - export CXX=clang++
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF -DBUILD_OSPRAY_CI_EXTRAS=ON -DBUILD_EMBREE_FROM_SOURCE=ON -DBUILD_EMBREE_VERSION=devel -DBUILD_OIDN=ON -DBUILD_OIDN_FROM_SOURCE=ON -DBUILD_OIDN_VERSION=devel -DBUILD_OPENVKL_VERSION=devel -DBUILD_RKCOMMON_VERSION=devel 
  only: [schedules]

build-linux-debug-all:
  <<: *build_job_docker
  script:
    - export CC=clang
    - export CXX=clang++
    - scripts/build_gitlab/linux.sh -G Ninja -DCMAKE_BUILD_TYPE=Debug -DDEPENDENCIES_BUILD_TYPE=Debug -DBUILD_GLFW=OFF -DBUILD_OSPRAY_CI_EXTRAS=ON -DBUILD_EMBREE_FROM_SOURCE=ON -DBUILD_OIDN=ON -DBUILD_OIDN_FROM_SOURCE=ON
  <<: *build_artifacts
  only: [schedules]

build-ubuntu1604-gcc:
  <<: *build_job_docker
  image: $DOCKER_REGISTRY/ospray/docker-images:ubuntu16.04
  script:
    - scripts/build_gitlab/linux.sh -G Ninja
  <<: *build_artifacts

build-ubuntu1804-gcc:
  <<: *build_job_docker
  image: $DOCKER_REGISTRY/ospray/docker-images:ubuntu18.04
  script:
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF
  <<: *build_artifacts

build-ubuntu2004-gcc:
  <<: *build_job_docker
  image: $DOCKER_REGISTRY/ospray/docker-images:ubuntu20.04
  script:
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF
  <<: *build_artifacts

build-centos8:
  <<: *build_job_docker
  image: $DOCKER_REGISTRY/ospray/docker-images:centos8
  script:
    - scripts/build_gitlab/linux.sh -G Ninja
  <<: *build_artifacts

build-centos7-icc:
  <<: *build_job_docker_modules
  script:
    - module load cmake
    - module load intel
    - export CC=icc
    - export CXX=icpc
    - scripts/build_gitlab/linux.sh

build-centos7-icc15:
  <<: *build_job_docker_modules
  script:
    - module load cmake
    - module load intel/2015
    - export CC=icc
    - export CXX=icpc
    - scripts/build_gitlab/linux.sh

build-centos7-gcc:
  <<: *build_job_docker
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7
  <<: *build_artifacts

build-centos7-mpi:
  <<: *build_job_docker_modules
  script:
    - module load cmake
    - module load intel
    - scripts/build_gitlab/linux.sh -DBUILD_OSPRAY_MODULE_MPI=ON
  allow_failure: true

build-centos7-mpi-devel:
  <<: *build_job_docker_modules
  script:
    - module load cmake
    - module load intel
    - scripts/build_gitlab/linux.sh -DBUILD_OSPRAY_MODULE_MPI=ON -DBUILD_OSPRAY_MODULE_MPI_VERSION=devel
  allow_failure: true

build-linux-debug:
  <<: *build_job_docker
  script:
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF -DCMAKE_BUILD_TYPE=Debug
  <<: *build_artifacts

build-osx-clang:
  stage: build
  tags:
    - osx
    - clang
  script:
    - scripts/build_gitlab/macosx.sh
  <<: *build_artifacts

build-windows-msvc14:
  stage: build
  tags:
    - msvc14
    - win
  script:
    - scripts\build_gitlab\win.ps1 "Visual Studio 14 2015 Win64" "v140" "Release"
  <<: *build_artifacts

build-windows-msvc15:
  stage: build
  tags:
    - msvc15
    - win
  script:
    - scripts\build_gitlab\win.ps1 "Visual Studio 15 2017 Win64" "v141" "Release"
  <<: *build_artifacts

build-windows-debug-all:
  stage: build
  tags:
    - msvc15
    - win
  script:
    - scripts\build_gitlab\win.ps1 "Visual Studio 15 2017 Win64" "v141" "Debug"
  <<: *build_artifacts
  only: [schedules]

#build-windows-icc:
#  stage: build
#  script:
#    - scripts\build_gitlab\win.ps1 "Visual Studio 14 2015 Win64" "Intel C++ Compiler 17.0"
#  tags:
#    - icc17
#    - win
#  <<: *build_artifacts


### TEST JOBS ###

test-centos7-gcc:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7
  needs: [build-centos7-gcc]

test-centos8:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:centos8
  needs: [build-centos8]

test-ubuntu1604-gcc:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:ubuntu16.04
  needs: [build-ubuntu1604-gcc]

test-ubuntu1804-gcc:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:ubuntu18.04
  needs: [build-ubuntu1804-gcc]

test-ubuntu2004-gcc:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:ubuntu20.04
  needs: [build-ubuntu2004-gcc]

test-linux-debug:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:arch
  needs: [build-linux-debug]

test-linux-debug-all:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:arch
  needs: [build-linux-debug-all]
  only: [schedules]

test-osx-clang:
  <<: *test_job
  tags: [osx]
  needs: [build-osx-clang]
  script:
    - DYLD_FALLBACK_LIBRARY_PATH="$CI_PROJECT_DIR/build/install/ospray/lib:$DYLD_FALLBACK_LIBRARY_PATH" PATH="$CI_PROJECT_DIR/build/install/ospray/bin:$PATH" scripts/tests/run_tests.sh "$CI_PROJECT_DIR"

test-tutorials:
  stage: test
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7
  needs: [build-centos7-gcc]
  script:
    - scripts/tests/run_tutorials.sh

test-find-ospray:
  stage: test
  tags:
    - docker
    - modules
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7-mod
  needs: [build-centos7-gcc]
  script:
    - module load cmake
    - mkdir buildtut
    - cd buildtut
    - cmake -D ospray_DIR=`echo $CI_PROJECT_DIR/build/install/ospray/lib/cmake/ospray-*` ../apps/ospTutorial/ospTutorialFindospray 
    - cmake --build .

test-windows-msvc14:
  <<: *test_job_windows
  tags:
    - win
    - msvc14
  needs: [build-windows-msvc14]

test-windows-msvc15:
  <<: *test_job_windows
  tags:
    - win
    - msvc15
  needs: [build-windows-msvc15]

test-windows-debug-all:
  <<: *test_job_windows
  tags:
    - win
    - msvc15
  needs: [build-windows-debug-all]
  only: [schedules]

generate-ci-baseline:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:ubuntu18.04
  needs: [build-ubuntu1804-gcc]
  script:
    - LD_LIBRARY_PATH="$CI_PROJECT_DIR/build/install/ospray/lib:$LD_LIBRARY_PATH" PATH="$CI_PROJECT_DIR/build/install/ospray/bin:$PATH" scripts/tests/generate_baseline.sh
  artifacts:
    paths:
      - generated_test_images
    expire_in: 3 day
  when: manual

### Benchmarks ###

benchmark-x8280-1:
  <<: *benchmark_job
  tags: [vis-perf-x8280-1]
  needs: [build-centos8]

### Documentation ###

.job_template: &doc-defaults
  stage: docu
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:docu
  needs: []
  variables:
    GIT_SUBMODULE_STRATEGY: normal

pdf:
  <<: *doc-defaults
  script:
    - cd doc
    - make pdf
    - make checklinks
  artifacts:
    paths:
      - readme.pdf
    expire_in: 1 week

web:
  <<: *doc-defaults
  script:
    - cd doc
    - make www
  artifacts:
    paths:
      - doc/www/*
    expire_in: 1 week


### RELEASE JOBS ###

release-linux:
  <<: *release_job
  tags: [modules]
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7-mod
  script:
    - module load cmake
    - scripts/release/linux.sh
  artifacts:
    paths:
      - build_release/*.gz
    expire_in: 3 day

release-osx-clang:
  <<: *release_job
  tags:
    - clang
    - osx
  script:
    - export CC=clang
    - export CXX=clang++
    - scripts/release/macosx.sh
    - $SIGN_FILE_MAC -o runtime -e scripts/release/ospray.entitlements build_release/ospray-*pkg
    - scripts/release/macosx_notarization.sh build_release/ospray-*.pkg
  artifacts:
    paths:
      - build_release/*.zip
      - build_release/*.pkg
    expire_in: 3 day

release-windows:
  <<: *release_job
  tags:
    - msvc14
    - win
  script:
    - scripts\release\win.ps1 "Visual Studio 15 2017 Win64"
    - ;& $env:SIGN_FILE_WINDOWS ospray*.msi
  artifacts:
    paths:
      - build_release\ospray*.zip
      - build_release\ospray*.msi
    expire_in: 3 day


### SCAN JOBS ###

build-kw:
  stage: scan1
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7
  needs: []
  script:
    - scripts/build_gitlab/kw.sh
    - test -s $CI_PROJECT_DIR/kw_build_number
  artifacts:
    paths:
        - $CI_PROJECT_DIR/kw_build_number
    expire_in: 3 day

protex:
  stage: scan1
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7
  needs: []
  script:
    - scripts/scan/protex.sh

kw-critical:
  stage: scan2
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7
  needs: [build-kw]
  script:
    - scripts/scan/kw.sh

bdba:
  <<: *release_job
  stage: scan3
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7 
  needs:
    - release-linux
    - release-osx-clang
    - release-windows
  script:
    - scripts/scan/bdba.sh "build_release/ospray*"
  artifacts:
    paths:
      - build_release/ospray-*

av:
  <<: *release_job
  stage: scan3
  tags: [docker]
  image: $DOCKER_REGISTRY/clamav:ubuntu20.04
  needs:
    - release-linux
    - release-osx-clang
    - release-windows
  script:
    - freshclam
    - clamscan -va --max-filesize=256M --max-scansize=1024M --alert-broken --alert-exceeds-max build_release/ospray-*
  artifacts:
    paths:
      - build_release/ospray-*


### Mirror ###

mirror:
  stage: mirror
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7-mod
  only: [devel]
  dependencies: []
  script:
    - git remote add github https://${GITHUB_TOKEN}github.com/ospray/OSPRay.git
    - git push github HEAD:devel
<commit_msg>added memory sanitizer to linux debug build<commit_after>## Copyright 2009-2020 Intel Corporation
## SPDX-License-Identifier: Apache-2.0

stages:
  - build
  - docu
  - test
  - benchmark
  - scan1
  - scan2
  - release
  - scan3
  - mirror

variables:
  GIT_DEPTH: "15"
  KW_PROJECT_NAME: ospray
  ErrorActionPreference: STOP

.job_template: &build_job_docker
  stage: build
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:arch  # default image
  script:
    - scripts/build_gitlab/linux.sh

.job_template: &build_job_docker_modules
  stage: build
  tags:
    - docker
    - modules
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7-mod
  script:
    - scripts/build_gitlab/linux.sh

.job_template: &build_artifacts
  artifacts:
    paths:
      - build/install/ospray
      - build/CMakeCache.txt
      - build/ospray/build/CMakeCache.txt
    expire_in: 3 day

.job_template: &release_job
  stage: release
  needs: [pdf]
  only:
    - devel
    - master
    - /release/

.job_template: &test_job
  stage: test
  tags: [docker]
  artifacts:
    paths:
      - build_regression_tests/tests.xml
      - build_regression_tests/failed
    expire_in: 1 week
    when: always

.job_template: &test_job_unix
  <<: *test_job
  script:
    - LD_LIBRARY_PATH="$CI_PROJECT_DIR/build/install/ospray/lib:$LD_LIBRARY_PATH" PATH="$CI_PROJECT_DIR/build/install/ospray/bin:$PATH" scripts/tests/run_tests.sh "$CI_PROJECT_DIR"

.job_template: &test_job_windows
  <<: *test_job
  script:
    - $env:Path += ";$CI_PROJECT_DIR\build\install\ospray\bin"
    - scripts\tests\run_tests.ps1 "$CI_PROJECT_DIR"

.job_template: &benchmark_job
  stage: benchmark
  when: manual
  script:
    - scripts/tests/run-benchmarks.sh

### BUILD JOBS ###

build-arch-gcc:
  <<: *build_job_docker
  script:
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF

build-arch-clang:
  <<: *build_job_docker
  script:
    - export CC=clang
    - export CXX=clang++
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF

build-arch-gcc-extras:
  <<: *build_job_docker
  script:
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF -DBUILD_OSPRAY_CI_EXTRAS=ON -DBUILD_OIDN=ON

build-arch-clang-extras:
  <<: *build_job_docker
  script:
    - export CC=clang
    - export CXX=clang++
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF -DBUILD_OSPRAY_CI_EXTRAS=ON -DBUILD_OIDN=ON

build-arch-clang-devel:
  <<: *build_job_docker
  script:
    - export CC=clang
    - export CXX=clang++
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF -DBUILD_OSPRAY_CI_EXTRAS=ON -DBUILD_EMBREE_FROM_SOURCE=ON -DBUILD_EMBREE_VERSION=devel -DBUILD_OIDN=ON -DBUILD_OIDN_FROM_SOURCE=ON -DBUILD_OIDN_VERSION=devel -DBUILD_OPENVKL_VERSION=devel -DBUILD_RKCOMMON_VERSION=devel 
  only: [schedules]

build-linux-debug-all:
  <<: *build_job_docker
  script:
    - export CC=clang
    - export CXX=clang++
    - scripts/build_gitlab/linux.sh -G Ninja -DCMAKE_BUILD_TYPE=Debug -DDEPENDENCIES_BUILD_TYPE=Debug -DBUILD_GLFW=OFF -DBUILD_OSPRAY_CI_EXTRAS=ON -DBUILD_EMBREE_FROM_SOURCE=ON -DBUILD_OIDN=ON -DBUILD_OIDN_FROM_SOURCE=ON
  <<: *build_artifacts
  only: [schedules]

build-ubuntu1604-gcc:
  <<: *build_job_docker
  image: $DOCKER_REGISTRY/ospray/docker-images:ubuntu16.04
  script:
    - scripts/build_gitlab/linux.sh -G Ninja
  <<: *build_artifacts

build-ubuntu1804-gcc:
  <<: *build_job_docker
  image: $DOCKER_REGISTRY/ospray/docker-images:ubuntu18.04
  script:
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF
  <<: *build_artifacts

build-ubuntu2004-gcc:
  <<: *build_job_docker
  image: $DOCKER_REGISTRY/ospray/docker-images:ubuntu20.04
  script:
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF
  <<: *build_artifacts

build-centos8:
  <<: *build_job_docker
  image: $DOCKER_REGISTRY/ospray/docker-images:centos8
  script:
    - scripts/build_gitlab/linux.sh -G Ninja
  <<: *build_artifacts

build-centos7-icc:
  <<: *build_job_docker_modules
  script:
    - module load cmake
    - module load intel
    - export CC=icc
    - export CXX=icpc
    - scripts/build_gitlab/linux.sh

build-centos7-icc15:
  <<: *build_job_docker_modules
  script:
    - module load cmake
    - module load intel/2015
    - export CC=icc
    - export CXX=icpc
    - scripts/build_gitlab/linux.sh

build-centos7-gcc:
  <<: *build_job_docker
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7
  <<: *build_artifacts

build-centos7-mpi:
  <<: *build_job_docker_modules
  script:
    - module load cmake
    - module load intel
    - scripts/build_gitlab/linux.sh -DBUILD_OSPRAY_MODULE_MPI=ON
  allow_failure: true

build-centos7-mpi-devel:
  <<: *build_job_docker_modules
  script:
    - module load cmake
    - module load intel
    - scripts/build_gitlab/linux.sh -DBUILD_OSPRAY_MODULE_MPI=ON -DBUILD_OSPRAY_MODULE_MPI_VERSION=devel
  allow_failure: true

build-linux-debug:
  <<: *build_job_docker
  script:
    - export CFLAGS=-fsanitize=address
    - export CXXFLAGS=-fsanitize=address
    - export LDFLAGS=-fsanitize=address
    - scripts/build_gitlab/linux.sh -G Ninja -DBUILD_GLFW=OFF -DCMAKE_BUILD_TYPE=Debug
  <<: *build_artifacts

build-osx-clang:
  stage: build
  tags:
    - osx
    - clang
  script:
    - scripts/build_gitlab/macosx.sh
  <<: *build_artifacts

build-windows-msvc14:
  stage: build
  tags:
    - msvc14
    - win
  script:
    - scripts\build_gitlab\win.ps1 "Visual Studio 14 2015 Win64" "v140" "Release"
  <<: *build_artifacts

build-windows-msvc15:
  stage: build
  tags:
    - msvc15
    - win
  script:
    - scripts\build_gitlab\win.ps1 "Visual Studio 15 2017 Win64" "v141" "Release"
  <<: *build_artifacts

build-windows-debug-all:
  stage: build
  tags:
    - msvc15
    - win
  script:
    - scripts\build_gitlab\win.ps1 "Visual Studio 15 2017 Win64" "v141" "Debug"
  <<: *build_artifacts
  only: [schedules]

#build-windows-icc:
#  stage: build
#  script:
#    - scripts\build_gitlab\win.ps1 "Visual Studio 14 2015 Win64" "Intel C++ Compiler 17.0"
#  tags:
#    - icc17
#    - win
#  <<: *build_artifacts


### TEST JOBS ###

test-centos7-gcc:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7
  needs: [build-centos7-gcc]

test-centos8:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:centos8
  needs: [build-centos8]

test-ubuntu1604-gcc:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:ubuntu16.04
  needs: [build-ubuntu1604-gcc]

test-ubuntu1804-gcc:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:ubuntu18.04
  needs: [build-ubuntu1804-gcc]

test-ubuntu2004-gcc:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:ubuntu20.04
  needs: [build-ubuntu2004-gcc]

test-linux-debug:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:arch
  needs: [build-linux-debug]

test-linux-debug-all:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:arch
  needs: [build-linux-debug-all]
  only: [schedules]

test-osx-clang:
  <<: *test_job
  tags: [osx]
  needs: [build-osx-clang]
  script:
    - DYLD_FALLBACK_LIBRARY_PATH="$CI_PROJECT_DIR/build/install/ospray/lib:$DYLD_FALLBACK_LIBRARY_PATH" PATH="$CI_PROJECT_DIR/build/install/ospray/bin:$PATH" scripts/tests/run_tests.sh "$CI_PROJECT_DIR"

test-tutorials:
  stage: test
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7
  needs: [build-centos7-gcc]
  script:
    - scripts/tests/run_tutorials.sh

test-find-ospray:
  stage: test
  tags:
    - docker
    - modules
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7-mod
  needs: [build-centos7-gcc]
  script:
    - module load cmake
    - mkdir buildtut
    - cd buildtut
    - cmake -D ospray_DIR=`echo $CI_PROJECT_DIR/build/install/ospray/lib/cmake/ospray-*` ../apps/ospTutorial/ospTutorialFindospray 
    - cmake --build .

test-windows-msvc14:
  <<: *test_job_windows
  tags:
    - win
    - msvc14
  needs: [build-windows-msvc14]

test-windows-msvc15:
  <<: *test_job_windows
  tags:
    - win
    - msvc15
  needs: [build-windows-msvc15]

test-windows-debug-all:
  <<: *test_job_windows
  tags:
    - win
    - msvc15
  needs: [build-windows-debug-all]
  only: [schedules]

generate-ci-baseline:
  <<: *test_job_unix
  image: $DOCKER_REGISTRY/ospray/docker-images:ubuntu18.04
  needs: [build-ubuntu1804-gcc]
  script:
    - LD_LIBRARY_PATH="$CI_PROJECT_DIR/build/install/ospray/lib:$LD_LIBRARY_PATH" PATH="$CI_PROJECT_DIR/build/install/ospray/bin:$PATH" scripts/tests/generate_baseline.sh
  artifacts:
    paths:
      - generated_test_images
    expire_in: 3 day
  when: manual

### Benchmarks ###

benchmark-x8280-1:
  <<: *benchmark_job
  tags: [vis-perf-x8280-1]
  needs: [build-centos8]

### Documentation ###

.job_template: &doc-defaults
  stage: docu
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:docu
  needs: []
  variables:
    GIT_SUBMODULE_STRATEGY: normal

pdf:
  <<: *doc-defaults
  script:
    - cd doc
    - make pdf
    - make checklinks
  artifacts:
    paths:
      - readme.pdf
    expire_in: 1 week

web:
  <<: *doc-defaults
  script:
    - cd doc
    - make www
  artifacts:
    paths:
      - doc/www/*
    expire_in: 1 week


### RELEASE JOBS ###

release-linux:
  <<: *release_job
  tags: [modules]
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7-mod
  script:
    - module load cmake
    - scripts/release/linux.sh
  artifacts:
    paths:
      - build_release/*.gz
    expire_in: 3 day

release-osx-clang:
  <<: *release_job
  tags:
    - clang
    - osx
  script:
    - export CC=clang
    - export CXX=clang++
    - scripts/release/macosx.sh
    - $SIGN_FILE_MAC -o runtime -e scripts/release/ospray.entitlements build_release/ospray-*pkg
    - scripts/release/macosx_notarization.sh build_release/ospray-*.pkg
  artifacts:
    paths:
      - build_release/*.zip
      - build_release/*.pkg
    expire_in: 3 day

release-windows:
  <<: *release_job
  tags:
    - msvc14
    - win
  script:
    - scripts\release\win.ps1 "Visual Studio 15 2017 Win64"
    - ;& $env:SIGN_FILE_WINDOWS ospray*.msi
  artifacts:
    paths:
      - build_release\ospray*.zip
      - build_release\ospray*.msi
    expire_in: 3 day


### SCAN JOBS ###

build-kw:
  stage: scan1
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7
  needs: []
  script:
    - scripts/build_gitlab/kw.sh
    - test -s $CI_PROJECT_DIR/kw_build_number
  artifacts:
    paths:
        - $CI_PROJECT_DIR/kw_build_number
    expire_in: 3 day

protex:
  stage: scan1
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7
  needs: []
  script:
    - scripts/scan/protex.sh

kw-critical:
  stage: scan2
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7
  needs: [build-kw]
  script:
    - scripts/scan/kw.sh

bdba:
  <<: *release_job
  stage: scan3
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7 
  needs:
    - release-linux
    - release-osx-clang
    - release-windows
  script:
    - scripts/scan/bdba.sh "build_release/ospray*"
  artifacts:
    paths:
      - build_release/ospray-*

av:
  <<: *release_job
  stage: scan3
  tags: [docker]
  image: $DOCKER_REGISTRY/clamav:ubuntu20.04
  needs:
    - release-linux
    - release-osx-clang
    - release-windows
  script:
    - freshclam
    - clamscan -va --max-filesize=256M --max-scansize=1024M --alert-broken --alert-exceeds-max build_release/ospray-*
  artifacts:
    paths:
      - build_release/ospray-*


### Mirror ###

mirror:
  stage: mirror
  tags: [docker]
  image: $DOCKER_REGISTRY/ospray/docker-images:centos7-mod
  only: [devel]
  dependencies: []
  script:
    - git remote add github https://${GITHUB_TOKEN}github.com/ospray/OSPRay.git
    - git push github HEAD:devel

{'fraction_non_alphanumeric': 0.12321137863079427, 'fraction_numerical': 0.02022106074886471, 'mean_word_length': 3.3068265682656826, 'pattern_counts': {'":': 0, '<': 203, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3459630', 'n_tokens_mistral': 10028, 'n_tokens_neox': 9387, 'n_words': 1464}