From 9c103dfa1c112076e66a6b9144d685822d48e943 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Mon, 30 Mar 2020 15:08:17 -0700 Subject: [PATCH] Add docker CI --- .travis.yml | 16 +++++++++++++++- ci/cgroups/Dockerfile | 9 +++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 ci/cgroups/Dockerfile diff --git a/.travis.yml b/.travis.yml index 4953546..cec6ddb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,9 @@ language: rust rust: stable -dist: trusty +dist: xenial sudo: false +notifications: + email: disabled cache: cargo @@ -65,3 +67,15 @@ matrix: - env: TARGET=x86_64-unknown-netbsd # Emscripten - env: TARGET=asmjs-unknown-emscripten + + # CGroups in Docker + - name: Docker CGroups + install: + script: + - docker build -f ci/cgroups/Dockerfile -t num-cpus-cgroups . + # Test without cgroups + - docker run -it -e NUM_CPUS_TEST_GET=2 num-cpus-cgroups + # Only 1 CPU + - docker run -it --cpus="1" -e NUM_CPUS_TEST_GET=1 num-cpus-cgroups + # 1.5 CPUs + - docker run -it --cpus="1.5" -e NUM_CPUS_TEST_GET=2 num-cpus-cgroups diff --git a/ci/cgroups/Dockerfile b/ci/cgroups/Dockerfile new file mode 100644 index 0000000..d5f288a --- /dev/null +++ b/ci/cgroups/Dockerfile @@ -0,0 +1,9 @@ +FROM rust:1.40 + +WORKDIR /usr/num_cpus + +COPY . . + +RUN cargo build + +CMD [ "cargo", "test", "--lib" ]