From 03581fe6efca796096961cf7208500cb9b649933 Mon Sep 17 00:00:00 2001 From: Yim Lee Date: Thu, 4 Feb 2021 13:45:56 -0800 Subject: [PATCH] Setup docker for cmake build (#70) * Setup docker for cmake build Motivation: Be able to run cmake build in CI Modifications: - Add "cmake" service to `docker-compose.yaml` - Update `Dockerfile` to install `cmake` and `ninja`. Remove unneeded dependencies. - Add `docker-compose.2004.53.yaml`. `cmake` on previous Ubuntu versions are too old and it would be a pain to upgrade, so using Ubuntu 20.04 to simplify things. - Add back modulemap to ensure cmake build is successful Result: Can run cmake in CI --- .../CCryptoBoringSSL/include/module.modulemap | 4 ++++ docker/Dockerfile | 5 ++++- docker/docker-compose.2004.53.yaml | 21 +++++++++++++++++++ docker/docker-compose.yaml | 4 ++++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 Sources/CCryptoBoringSSL/include/module.modulemap create mode 100644 docker/docker-compose.2004.53.yaml diff --git a/Sources/CCryptoBoringSSL/include/module.modulemap b/Sources/CCryptoBoringSSL/include/module.modulemap new file mode 100644 index 00000000..6c5352d5 --- /dev/null +++ b/Sources/CCryptoBoringSSL/include/module.modulemap @@ -0,0 +1,4 @@ +module CCryptoBoringSSL { + header "CCryptoBoringSSL.h" + export * +} diff --git a/docker/Dockerfile b/docker/Dockerfile index bae8f3ec..65d46aeb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -21,7 +21,10 @@ RUN apt-get update && apt-get install -y lsof dnsutils netcat-openbsd net-tools # ruby and jazzy for docs generation RUN apt-get update && apt-get install -y ruby ruby-dev libsqlite3-dev -RUN gem install jazzy --no-ri --no-rdoc +RUN if [ "${ubuntu_version}" != "focal" ] ; then gem install jazzy --no-document ; fi + +# cmake build +RUN apt-get update && apt-get install -y cmake ninja-build # tools RUN mkdir -p $HOME/.tools diff --git a/docker/docker-compose.2004.53.yaml b/docker/docker-compose.2004.53.yaml new file mode 100644 index 00000000..c660c7d6 --- /dev/null +++ b/docker/docker-compose.2004.53.yaml @@ -0,0 +1,21 @@ +version: "3" + +services: + + runtime-setup: + image: swift-crypto:20.04-5.3 + build: + args: + ubuntu_version: "focal" + swift_version: "5.3" + + test: + image: swift-crypto:20.04-5.3 + environment: [] + #- SANITIZER_ARG=--sanitize=thread + + cmake: + image: swift-crypto:20.04-5.3 + + shell: + image: swift-crypto:20.04-5.3 diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 710a4951..b5d4d456 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -31,6 +31,10 @@ services: # FIXME: get rid of existing warnings #command: /bin/bash -xcl "swift test --enable-test-discovery -Xswiftc -warnings-as-errors $${SANITIZER_ARG-}" command: /bin/bash -xcl "swift test --enable-test-discovery" + + cmake: + <<: *common + command: /bin/bash -xcl "cmake -G Ninja -D CMAKE_BUILD_TYPE=Release -B out -S . && ninja -C out" # util