steps:
- bash: |
    sudo apt-get install g++ wget make libgl1-mesa-dev mesa-common-dev
    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 rdkit_build -c conda-forge --override-channels  cmake \
        libboost=$(boost_version) \
        libboost-devel=$(boost_version) \
        swig=4.2
  displayName: Setup build environment
- bash: |
    source ${CONDA}/etc/profile.d/conda.sh
    conda activate rdkit_build
    conda config --env --add channels conda-forge
    conda config --env --set channel_priority strict
    mkdir build && cd build && \
    cmake .. \
    -DSWIG_EXECUTABLE=${CONDA_PREFIX}/bin/swig \
    -DCMAKE_BUILD_TYPE=Release \
    -DRDK_INSTALL_INTREE=ON \
    -DRDK_INSTALL_STATIC_LIBS=ON \
    -DRDK_BUILD_CPP_TESTS=OFF \
    -DRDK_BUILD_PYTHON_WRAPPERS=OFF \
    -DRDK_BUILD_COORDGEN_SUPPORT=ON \
    -DRDK_BUILD_MAEPARSER_SUPPORT=ON \
    -DRDK_OPTIMIZE_POPCNT=ON \
    -DRDK_BUILD_TEST_GZIP=OFF \
    -DRDK_BUILD_FREESASA_SUPPORT=ON \
    -DRDK_BUILD_AVALON_SUPPORT=ON \
    -DRDK_BUILD_INCHI_SUPPORT=ON \
    -DRDK_BUILD_YAEHMOP_SUPPORT=ON \
    -DRDK_BUILD_XYZ2MOL_SUPPORT=ON \
    -DRDK_BUILD_SWIG_WRAPPERS=ON \
    -DRDK_SWIG_STATIC=ON \
    -DRDK_BUILD_THREADSAFE_SSS=ON \
    -DRDK_TEST_MULTITHREADED=ON
  displayName: Configure build (Run CMake)
- bash: |
    source ${CONDA}/etc/profile.d/conda.sh
    conda activate rdkit_build
    cd build
    make -j $( $(number_of_cores) ) install
  displayName: Build
- bash: |
    source ${CONDA}/etc/profile.d/conda.sh
    conda activate rdkit_build
    export RDBASE=`pwd`
    export PYTHONPATH=${RDBASE}:${PYTHONPATH}
    export LD_LIBRARY_PATH=${RDBASE}/lib:${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}
    echo "LD_LIBRARY_PATH: " $LD_LIBRARY_PATH
    export QT_QPA_PLATFORM='offscreen'
    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