image: jmchr/opengl-test-env:latest

# Define the stages of your pipeline
stages:
  - build
  - test

variables:
  VCPKG_ROOT: "/vcpkg"

build:
  stage: build
  script:
    # Set the VCPKG_TOOLCHAIN environment variable
    - export VCPKG_TOOLCHAIN=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake
    - mkdir -p build
    - cmake -B build -S . -G Ninja --preset release
    - cmake --build build
  artifacts:
    paths:
      - build/
    expire_in: 1 hour

run_tests:
  stage: test
  dependencies:
    - build
  script:
    - apt-get update && apt-get install -y xvfb
    - Xvfb :99 -screen 0 1024x768x24 &
    - sleep 5
    - export DISPLAY=:99
    - export TEST_MODE=1
    - cd build
    - ./TerraVisor
