# SPDX-FileCopyrightText: 2015-2025 Alexey Rochev
#
# SPDX-License-Identifier: CC0-1.0

only_if: $CIRRUS_BRANCH == 'master' || $CIRRUS_BASE_BRANCH == 'master' || $CIRRUS_BASE_BRANCH =~ 'feature/.*'

build_freebsd_task:
  freebsd_instance:
    matrix:
    - image_family: freebsd-14-3

  packages_cache:
    folder: /var/cache/pkg

  install_dependencies_script: |
    set -e -o pipefail
    sudo pkg update -f
    sudo pkg install -y cmake ninja pkgconf libpsl libfmt qt6-base qt6-tools kf6-kwidgetsaddons kf6-kwindowsystem gettext-tools cxxopts cpp-httplib

  cmake_build_script: |
    set -e -o pipefail
    echo 'Configuring CMake'
    # Not enabling ASAN since it causes weird issues with tests that use openssl
    cmake -S . --preset base -D TREMOTESF_WITH_HTTPLIB=system -D TREMOTESF_ASAN=OFF
    echo 'Building Debug'
    cmake --build --preset base-debug -v
    echo 'Testing Debug'
    ASAN_OPTIONS=detect_leaks=0 ctest --preset base-debug
    echo 'Building Release'
    cmake --build --preset base-release -v
    echo 'Testing Release'
    ASAN_OPTIONS=detect_leaks=0 ctest --preset base-release
