Sébastien Blin | 55be5da | 2024-02-12 11:29:54 -0500 | [diff] [blame] | 1 | FROM ubuntu:22.04 AS build |
Adrien Béraud | 57ea614 | 2023-06-02 08:37:07 -0400 | [diff] [blame] | 2 | |
Sébastien Blin | 55be5da | 2024-02-12 11:29:54 -0500 | [diff] [blame] | 3 | RUN apt-get update && apt-get install -y \ |
| 4 | dialog apt-utils \ |
| 5 | && apt-get clean \ |
| 6 | && echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections |
Adrien Béraud | 57ea614 | 2023-06-02 08:37:07 -0400 | [diff] [blame] | 7 | |
Sébastien Blin | 55be5da | 2024-02-12 11:29:54 -0500 | [diff] [blame] | 8 | RUN apt-get update && apt-get install -y \ |
| 9 | build-essential pkg-config cmake git wget \ |
| 10 | libtool autotools-dev autoconf \ |
| 11 | cython3 python3-dev python3-setuptools python3-build python3-virtualenv \ |
| 12 | libncurses5-dev libreadline-dev nettle-dev libcppunit-dev \ |
| 13 | libgnutls28-dev libuv1-dev libjsoncpp-dev libargon2-dev libunistring-dev \ |
Amna | c9da2d7 | 2024-07-02 11:14:19 -0400 | [diff] [blame] | 14 | libssl-dev libfmt-dev libasio-dev libmsgpack-dev libyaml-cpp-dev \ |
Sébastien Blin | 55be5da | 2024-02-12 11:29:54 -0500 | [diff] [blame] | 15 | && apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/* |
Adrien Béraud | 57ea614 | 2023-06-02 08:37:07 -0400 | [diff] [blame] | 16 | |
| 17 | COPY . dhtnet |
| 18 | |
Sébastien Blin | 55be5da | 2024-02-12 11:29:54 -0500 | [diff] [blame] | 19 | WORKDIR dhtnet |
Adrien Béraud | 57ea614 | 2023-06-02 08:37:07 -0400 | [diff] [blame] | 20 | |
Sébastien Blin | 55be5da | 2024-02-12 11:29:54 -0500 | [diff] [blame] | 21 | RUN git submodule update --init --recursive |
| 22 | |
| 23 | RUN mkdir build_dev && cd build_dev \ |
| 24 | && cmake .. -DBUILD_DEPENDENCIES=On -DCMAKE_INSTALL_PREFIX=/usr \ |
| 25 | && make -j && make install |
| 26 | |
| 27 | FROM build AS test |
| 28 | |
| 29 | RUN apt-get update && apt-get install gcovr lcov -y |
| 30 | |
| 31 | RUN cd build_dev \ |
| 32 | && cmake -DBUILD_TESTING=On -DCODE_COVERAGE=On .. \ |
| 33 | && make -j \ |
| 34 | && ctest -T Test -T Coverage \ |
| 35 | && ctest -T coverage > /result.summary |
| 36 | |
| 37 | # Generate HTML report |
| 38 | RUN cd build_dev/CMakeFiles/dhtnet.dir \ |
Sébastien Blin | e853f50 | 2024-02-12 15:56:39 -0500 | [diff] [blame] | 39 | && lcov --capture --no-external --directory /dhtnet --output-file coverage.info \ |
| 40 | && mkdir /coverage \ |
| 41 | && genhtml coverage.info --output-directory /coverage |