Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.63 KiB
image: hello-world:latest

stages:
  - build-img
  - test

build-img:
  stage: build-img
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - mkdir -p /kaniko/.docker
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - /kaniko/executor --cache=true --context $CI_PROJECT_DIR --dockerfile ./Dockerfile --destination $CI_REGISTRY_IMAGE:latest
  tags:
    - docker

###### Test jobs #####

.test:cmake: &cmake_def
  stage: test
  image: $CI_REGISTRY_IMAGE:latest
  needs: ['build-img']
  script:
    - conan install -if build -g cmake_find_package catch2/2.13.7@
    - if [ "$ENABLE_CSG" == "ON" ]; then conan install -if build -g cmake_find_package cgal/5.2.1@; fi
    - conan install -if build -g cmake_find_package taocpp-pegtl/3.2.1@

    - cmake -S.
            -Bbuild
            -GNinja
            -DCMAKE_MODULE_PATH=$PWD/build
            -DCMAKE_BUILD_TYPE=Debug
            -DCSG_CGAL_ENABLED=${ENABLE_CSG}
    - cmake --build build --target unit_tests_csg
    - cd build
    - ctest
  tags:
    - docker

test:cgal:
  variables:
    ENABLE_CSG: "ON"
  <<: *cmake_def

test:no_cgal:
  variables:
    ENABLE_CSG: "OFF"
  <<: *cmake_def

.test:spack: &spack_def
  stage: test
  image: $CI_REGISTRY_IMAGE:latest
  needs: ['build-img']
  when: manual
  script:
    - /usr/local/spack/bin/spack repo add .spack/repo
    - /usr/local/spack/bin/spack install csg-eb ${NO_CSG}
  tags:
    - docker

spack:cgal:
  variables:
    NO_CSG: ""
  <<: *spack_def

spack:no_cgal:
  variables:
    NO_CSG: "~cgal"
  <<: *spack_def