Skip to content

Commit

Permalink
Added initial Dockerfile for build environment
Browse files Browse the repository at this point in the history
  • Loading branch information
bkryza committed Nov 1, 2024
1 parent daf1b3b commit eef325c
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 38 deletions.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,12 @@ venv:

.PHONY: cmake-format
cmake-format:
cmake-format -i CMakeLists.txt src/CMakeLists.txt tests/CMakeLists.txt
cmake-format -i CMakeLists.txt src/CMakeLists.txt tests/CMakeLists.txt

.PHONY: docker/%
docker/%:
docker build -f docker/Dockerfile.$* -t bkryza/clang-uml-builder:$* docker

.PHONY: docker_test_diagrams
in_docker/%:
docker run -v /var/cache/ccache:/var/cache/ccache -v ${PWD}:${PWD} -w ${PWD} -u 1000:1000 -i bkryza/clang-uml-builder:ubuntu-2404 make CC=/usr/bin/clang-18 CXX=/usr/bin/clang++-18 LLVM_VERSION=18 NUMPROC=8 ENABLE_CXX_MODULES_TEST_CASES=ON ENABLE_OBJECTIVE_C_TEST_CASES=ON CMAKE_GENERATOR=Ninja ENABLE_CUDA_TEST_CASES=ON $*
45 changes: 45 additions & 0 deletions docker/Dockerfile.ubuntu-2404
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM ubuntu:24.04
LABEL org.opencontainers.image.authors="[email protected]"

ENV DEBIAN_FRONTEND noninteractive

RUN apt update && \
apt -y install wget software-properties-common git make grcov ninja-build pkg-config gcc g++ ccache cmake libyaml-cpp-dev llvm-18 clang-18 libclang-18-dev libclang-cpp18-dev clang-tools-18 clang-format-18 lcov zlib1g-dev libunwind-dev libdw-dev gnustep-back-common libgnustep-base-dev gnustep-make

RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb && \
dpkg -i cuda-keyring_1.1-1_all.deb && \
apt-get update && \
apt-get -y install cuda-toolkit

RUN apt -y install plantuml

RUN apt -y install g++

RUN git clone https://github.com/gnustep/libobjc2 && \
cd libobjc2 && \
CC=/usr/bin/clang-18 CXX=/usr/bin/clang++-18 cmake -B_build -S. && \
cd _build && \
make -j12 && \
make install && \
cd ../.. && \
rm -rf libobjc2

RUN apt -y install nvidia-cuda-toolkit

RUN apt -y install nodejs npm && \
npm install -g @mermaid-js/[email protected]

RUN wget https://github.com/plantuml/plantuml/releases/download/v1.2024.7/plantuml.jar -O /usr/share/plantuml/plantuml.jar

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

ADD puppeteer-config.json /etc/puppeteer-config.json

# Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer.
RUN apt-get update && apt-get install gnupg wget -y && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
apt-get update && \
apt-get install google-chrome-stable -y --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
6 changes: 6 additions & 0 deletions docker/puppeteer-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"executablePath": "/usr/bin/google-chrome",
"args": [
"--no-sandbox"
]
}
48 changes: 12 additions & 36 deletions tests/test_progress_indicator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,17 @@ TEST_CASE("Test progress indicator")

REQUIRE_EQ(output_lines[0], "");
#ifdef _MSC_VER
REQUIRE(contains(output_lines[1],
"One [>----------------------------------] "
"[00:00s] 0/100"s));
REQUIRE(contains(output_lines[1], "[00:00s] 0/100"s));

REQUIRE(contains(output_lines[2],
"One [>----------------------------------] "
"[00m:00s] 1/100"s));
REQUIRE(contains(output_lines[2], "[00m:00s] 1/100"s));

REQUIRE(contains(output_lines[3],
"One [===================================] "
"[00m:00s] 100/100 OK"s));
REQUIRE(contains(output_lines[3], "[00m:00s] 100/100 OK"s));
#else
REQUIRE_EQ(output_lines[1],
"One [█----------------------------------] "
"[00:00s] 0/100");
REQUIRE(contains(output_lines[1], "[00:00s] 0/100"));

REQUIRE_EQ(output_lines[2],
"One [█----------------------------------] "
"[00m:00s] 1/100");
REQUIRE(contains(output_lines[2], "[00m:00s] 1/100"));

REQUIRE_EQ(output_lines[3],
"One [███████████████████████████████████] "
"[00m:00s] 100/100 ✔");
REQUIRE(contains(output_lines[3], "[00m:00s] 100/100 ✔"));
#endif
}

Expand Down Expand Up @@ -107,28 +95,16 @@ TEST_CASE("Test progress indicator fail")
REQUIRE_EQ(output_lines[0], "");

#ifdef _MSC_VER
REQUIRE(contains(output_lines[1],
"One [>----------------------------------] "
"[00:00s] 0/100"s));
REQUIRE(contains(output_lines[1], "[00:00s] 0/100"s));

REQUIRE(contains(output_lines[2],
"One [>----------------------------------] "
"[00m:00s] 1/100"s));
REQUIRE(contains(output_lines[2], "[00m:00s] 1/100"s));

REQUIRE(contains(output_lines[3],
"One [>----------------------------------] "
"[00m:00s] 1/100 FAILED"s));
REQUIRE(contains(output_lines[3], "[00m:00s] 1/100 FAILED"s));
#else
REQUIRE_EQ(output_lines[1],
"One [█----------------------------------] "
"[00:00s] 0/100");
REQUIRE(contains(output_lines[1], "[00:00s] 0/100"));

REQUIRE_EQ(output_lines[2],
"One [█----------------------------------] "
"[00m:00s] 1/100");
REQUIRE(contains(output_lines[2], "[00m:00s] 1/100"));

REQUIRE_EQ(output_lines[3],
"One [█----------------------------------] "
"[00m:00s] 1/100 ✗");
REQUIRE(contains(output_lines[3], "[00m:00s] 1/100 ✗"));
#endif
}
2 changes: 1 addition & 1 deletion util/generate_mermaid.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def generate_mermaid_diagram(f):
target = Path(f).parent.absolute()
target = target.joinpath('mermaid')
target = target.joinpath(f_svg)
subprocess.check_call(['mmdc', '-i', f, '-o', target])
subprocess.check_call(['mmdc', '-p', 'docker/puppeteer-config.json', '-i', f, '-o', target])
except subprocess.CalledProcessError:
print(f'ERROR: Generating Mermaid diagram from {f} failed')
return False
Expand Down

0 comments on commit eef325c

Please sign in to comment.