Skip to content

Commit d7a0732

Browse files
burzruoso
authored andcommitted
Setup testing with .travis.yml (#4)
Signed-off-by: Anthony Burzillo <aburzillo@bloomberg.net>
1 parent 7f533f3 commit d7a0732

File tree

5 files changed

+80
-1
lines changed

5 files changed

+80
-1
lines changed

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.gitignore
2+
.travis.Dockerfile
3+
.travis.yml
4+
CONTRIBUTING.md
5+
DCO.md
6+
Doxyfile
7+
LICENSE
8+
README.md
9+
dox-run.sh
10+
*.swp

.travis.Dockerfile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
FROM ubuntu:18.04
2+
3+
# Install build dependencies
4+
RUN apt-get update && apt-get install -y \
5+
clang-5.0 \
6+
clang-format-5.0 \
7+
clang-tools-5.0 \
8+
clang-tidy-5.0 \
9+
cmake \
10+
libclang-5.0-dev \
11+
libfile-spec-native-perl \
12+
libgtest-dev
13+
14+
# Set up clang compilers
15+
ENV CC=/usr/lib/llvm-5.0/bin/clang \
16+
CXX=/usr/lib/llvm-5.0/bin/clang++
17+
18+
# Fix issues with gtest installation from ubuntu debian
19+
RUN cd /usr/src/gtest && \
20+
cmake . && \
21+
make && \
22+
mv libg* /usr/lib
23+
24+
# Fix issues with clang installation from ubuntu debian
25+
RUN mkdir -p /usr/lib/cmake && \
26+
ln -s /usr/share/llvm-5.0/cmake /usr/lib/cmake/clang && \
27+
for hdr in /usr/lib/llvm-5.0/include/clang/*; do \
28+
ln -s $hdr /usr/include/clang/$(basename $hdr); \
29+
done && \
30+
ln -s /usr/lib/llvm-5.0/include/clang-c /usr/include/clang-c && \
31+
ln -s /usr/lib/llvm-5.0/include/llvm /usr/include/llvm && \
32+
ln -s /usr/lib/llvm-5.0/include/llvm-c /usr/include/llvm-c && \
33+
for lib in /usr/lib/llvm-5.0/lib/*; do \
34+
ln -s $lib /usr/lib/$(basename $lib); \
35+
done && \
36+
for bin in /usr/bin/*-5.0; do \
37+
ln -s $bin /usr/bin/$(basename $bin | rev | cut -d '-' -f2- | rev); \
38+
done
39+
40+
COPY . clangmetatool/
41+
WORKDIR clangmetatool
42+
43+
# Build tool, run tests, and do a test install
44+
RUN mkdir build && cd build && \
45+
cmake -DClang_DIR=/usr/share/llvm-5.0/cmake .. && \
46+
make all test && \
47+
make install && \
48+
cd .. && rm -rf build
49+
50+
# Fix includes for clangmetatool (due to ubuntu debian's clang)
51+
RUN ln -s /usr/lib/llvm-5.0/include/clangmetatool /usr/include/clangmetatool
52+
53+
# Build skeleton
54+
RUN mkdir skeleton/build && cd skeleton/build && \
55+
cmake -DClang_DIR=/usr/share/llvm-5.0/cmake \
56+
-Dclangmetatool_DIR=/usr/share/llvm-5.0/cmake .. && \
57+
make all && \
58+
make install && \
59+
cd - && rm -rf skeleton/build
60+
61+
# Run the tool on itself
62+
RUN yourtoolname $(find src skeleton -name '*.cpp') -- -std=gnu++14

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sudo: required
2+
services:
3+
- docker
4+
5+
script:
6+
- sudo docker build -f .travis.Dockerfile .

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Source control at [https://github.com/bloomberg/clangmetatool/](https://github.c
1010
````bash
1111
mkdir build
1212
cd build
13-
cmake -DClang_DIR=/path/to/clang/cmake
13+
cmake -DClang_DIR=/path/to/clang/cmake ..
1414
make
1515
make install
1616
````

t/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ foreach(
3333
clangmetatool
3434
clangTooling
3535
${GTEST_BOTH_LIBRARIES}
36+
${CMAKE_THREAD_LIBS_INIT}
3637
)
3738

3839
add_test(

0 commit comments

Comments
 (0)