steps:
  - bash: |
      source ${CONDA}/etc/profile.d/conda.sh
      sudo chown -R ${USER} ${CONDA}
      conda config --set always_yes yes --set changeps1 no
      conda update -q conda
      conda info -a
      conda create --name coordgen_build $(compiler) cmake \
          boost-cpp=$(boost_version) boost=$(boost_version) \
          libboost=$(boost_version)
    displayName: Setup build environment
  - bash: |
      source ${CONDA}/etc/profile.d/conda.sh
      conda activate coordgen_build
      export BASE_PATH=$(pwd)
      mkdir build && cd build && \
      cmake .. \
      -DCMAKE_BUILD_TYPE=Release \
      -DCOORDGEN_RIGOROUS_BUILD=ON \
      -DBoost_NO_SYSTEM_PATHS=ON \
      -DCMAKE_INCLUDE_PATH="${CONDA_PREFIX}/include" \
      -DCMAKE_LIBRARY_PATH="${CONDA_PREFIX}/lib" \
      -DCMAKE_INSTALL_PREFIX="${BASE_PATH}/install" \
      -DCOORDGEN_BUILD_SHARED_LIBS=$(shared_lib)
    displayName: Configure build (Run CMake)
  - bash: |
      source ${CONDA}/etc/profile.d/conda.sh
      conda activate coordgen_build
      cd build
      make -j $( $(number_of_cores) ) install
    displayName: Build
  - bash: |
      source ${CONDA}/etc/profile.d/conda.sh
      conda activate coordgen_build
      cd build
      ctest -j $( $(number_of_cores) ) --output-on-failure -T Test
    displayName: Run tests
  - task: PublishTestResults@2
    inputs:
      testResultsFormat: "CTest"
      testResultsFiles: "build/Testing/*/Test.xml"
      testRunTitle: $(system.phasedisplayname) CTest Test Run
