# vim: set ts=4 sw=4 expandtab:
image: ubuntu

before_script:
    - DEBIAN_FRONTEND=noninteractive apt-get update --yes
    - DEBIAN_FRONTEND=noninteractive apt-get install --yes build-essential git cmake python3 python3-dev qtbase5-dev libqwt-qt5-dev sqlite3 sqlite3-tools lcov

stages:
    - build
    - test
    - coverage

build:
    stage: build
    script:
        - cmake --preset ci-coverage
        - cmake --build build/coverage -j$(nproc)
    after_script:
        - find . -name "*.o" -type f -delete
        - find . -name "*.a" -type f -delete
    artifacts:
        paths:
            - build/coverage
        expire_in: 1 hour

test:
    stage: test
    needs:
        - build
    script:
        - cd build/coverage
        - ctest --output-on-failure -j$(nproc)
    artifacts:
        paths:
            - build/coverage
        expire_in: 1 hour
coverage:
    stage: coverage
    needs:
        - test
    script:
        - cmake --build build/coverage --target coverage
    artifacts:
        paths:
            - build/coverage/coverage_html
        expire_in: 1 hour
