diff options
author | iphydf <iphydf@users.noreply.github.com> | 2020-05-03 15:36:57 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2020-05-03 16:59:26 +0100 |
commit | 4efe541814ec2ddd073428d6928497b50c48397a (patch) | |
tree | b2d3c877317da1d129900b88097d05ffa879281f /other/docker/Dockerfile.ci | |
parent | 88b90c82259f86470cf6eba8684e8d9b4cd61bc3 (diff) |
Add a script to run Travis CI locally.
This isn't quite Travis, but close enough for local testing.
Diffstat (limited to 'other/docker/Dockerfile.ci')
-rw-r--r-- | other/docker/Dockerfile.ci | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/other/docker/Dockerfile.ci b/other/docker/Dockerfile.ci new file mode 100644 index 00000000..db7e5e2c --- /dev/null +++ b/other/docker/Dockerfile.ci | |||
@@ -0,0 +1,75 @@ | |||
1 | # This Docker build emulates roughly what Travis CI is doing. It is not exactly | ||
2 | # the same (different tool versions) and success in this image may not | ||
3 | # necessarily mean success on Travis. This image is also not automatically | ||
4 | # tested, so it may get out of date. Send PRs if you use it and it's broken. | ||
5 | # | ||
6 | # For one, we use bionic, not xenial, because xenial's clang is way too old. | ||
7 | FROM ubuntu:16.04 | ||
8 | |||
9 | # Travis environment. | ||
10 | RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
11 | apt-transport-https \ | ||
12 | build-essential \ | ||
13 | ca-certificates \ | ||
14 | curl \ | ||
15 | git \ | ||
16 | pkg-config \ | ||
17 | python-pip \ | ||
18 | python-setuptools \ | ||
19 | python3 \ | ||
20 | software-properties-common \ | ||
21 | wget \ | ||
22 | && apt-get clean \ | ||
23 | && rm -rf /var/lib/apt/lists/* | ||
24 | |||
25 | RUN curl https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \ | ||
26 | && apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main" \ | ||
27 | && apt-get update && apt-get install --no-install-recommends -y \ | ||
28 | clang-6.0 \ | ||
29 | clang-format-6.0 \ | ||
30 | llvm-6.0 \ | ||
31 | && apt-get clean \ | ||
32 | && rm -rf /var/lib/apt/lists/* | ||
33 | |||
34 | RUN ls /usr/bin/clang-6.0 && ln -s /usr/bin/clang-6.0 /usr/bin/clang \ | ||
35 | && ls /usr/bin/clang++-6.0 && ln -s /usr/bin/clang++-6.0 /usr/bin/clang++ \ | ||
36 | && ls /usr/bin/clang-format-6.0 && ln -s /usr/bin/clang-format-6.0 /usr/bin/clang-format \ | ||
37 | && ls /usr/bin/opt-6.0 && ln -s /usr/bin/opt-6.0 /usr/bin/opt | ||
38 | |||
39 | # Bionic's cmake is too old. | ||
40 | RUN pip install --upgrade pip cmake | ||
41 | |||
42 | # .travis.yml | ||
43 | RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
44 | libconfig-dev \ | ||
45 | libgtest-dev \ | ||
46 | libopus-dev \ | ||
47 | libsodium-dev \ | ||
48 | libvpx-dev \ | ||
49 | ninja-build \ | ||
50 | pylint3 \ | ||
51 | && apt-get clean \ | ||
52 | && rm -rf /var/lib/apt/lists/* | ||
53 | |||
54 | # Set up travis user. | ||
55 | RUN groupadd -r -g 1000 travis \ | ||
56 | && useradd --no-log-init -r -g travis -u 1000 travis \ | ||
57 | && mkdir -p /src/workspace /home/travis \ | ||
58 | && chown travis:travis /home/travis | ||
59 | USER travis | ||
60 | |||
61 | # Set up environment. | ||
62 | ENV CC=gcc CXX=g++ \ | ||
63 | PATH=/home/travis/.local/bin:$PATH \ | ||
64 | TRAVIS_REPO_SLUG=TokTok/c-toxcore | ||
65 | |||
66 | # Copy minimal files to run "cmake-linux install", so we can avoid rebuilding | ||
67 | # astyle and other things when only source files change. | ||
68 | RUN mkdir -p /home/travis/build/c-toxcore /home/travis/cache | ||
69 | WORKDIR /home/travis/build/c-toxcore | ||
70 | COPY --chown=travis:travis c-toxcore/.travis/ /home/travis/build/c-toxcore/.travis/ | ||
71 | RUN .travis/cmake-linux install | ||
72 | |||
73 | # Now copy the rest of the sources and run the build. | ||
74 | COPY --chown=travis:travis . /home/travis/build/ | ||
75 | RUN .travis/cmake-linux script | ||