File tree Expand file tree Collapse file tree 5 files changed +60
-40
lines changed Expand file tree Collapse file tree 5 files changed +60
-40
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,10 @@ compiler: gcc
4
4
5
5
script :
6
6
- docker-compose build $TEST_ENV
7
- - docker run --rm -ti scala-native-bindgen:$TEST_ENV /usr/include/ctype.h -name ctype --
8
- - docker-compose run --rm sbt-test
7
+ - docker-compose run $TEST_ENV
9
8
10
9
matrix :
11
10
include :
12
- - env : TEST_ENV=ubuntu-16 .04-llvm-dev
13
- - env : TEST_ENV=ubuntu-16 .04-llvm-6.0
14
- - env : TEST_ENV=ubuntu-16 .04-llvm-5.0
11
+ - env : TEST_ENV=ubuntu-18 .04-llvm-dev
12
+ - env : TEST_ENV=ubuntu-18 .04-llvm-6.0
13
+ - env : TEST_ENV=ubuntu-18 .04-llvm-5.0
Original file line number Diff line number Diff line change 1
- ARG UBUNTU_VERSION=16 .04
1
+ ARG UBUNTU_VERSION=18 .04
2
2
FROM ubuntu:$UBUNTU_VERSION
3
3
4
4
RUN set -x \
5
5
&& apt update \
6
- && apt install -y apt-transport-https \
6
+ && apt install -y apt-transport-https gnupg2 ca-certificates \
7
7
&& echo "deb https://dl.bintray.com/sbt/debian /" > /etc/apt/sources.list.d/sbt.list \
8
8
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 \
9
9
&& apt update \
10
- && apt install -y curl build-essential openjdk-8-jdk-headless sbt \
10
+ && apt install -y curl build-essential openjdk-8-jdk-headless sbt cmake make \
11
11
&& rm -rf /var/lib/apt/lists/*
12
12
13
- WORKDIR /cmake
14
- ARG CMAKE_ARCHIVE=cmake-3.11.2-Linux-x86_64
15
- RUN curl https://cmake.org/files/v3.11/$CMAKE_ARCHIVE.tar.gz | tar zxf - \
16
- && for i in bin share; do \
17
- cp -r /cmake/$CMAKE_ARCHIVE/$i/* /usr/$i/; \
18
- done \
19
- && rm -rf /cmake
20
-
21
13
ARG LLVM_VERSION=6.0
14
+ ENV LLVM_VERSION=$LLVM_VERSION
22
15
# LLVM dev versions do not have a "-x.y" version suffix.
23
16
ARG LLVM_DEB_COMPONENT=-$LLVM_VERSION
24
17
RUN set -x \
25
18
&& curl https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
26
19
&& . /etc/lsb-release \
27
20
&& echo "deb https://apt.llvm.org/$DISTRIB_CODENAME/ llvm-toolchain-$DISTRIB_CODENAME$LLVM_DEB_COMPONENT main" > /etc/apt/sources.list.d/llvm.list \
28
21
&& apt update \
29
- && apt install -y clang-$LLVM_VERSION libclang-$LLVM_VERSION-dev make \
22
+ && apt install -y clang-$LLVM_VERSION libclang-$LLVM_VERSION-dev \
30
23
&& rm -rf /var/lib/apt/lists/*
31
24
32
- WORKDIR /src/target
33
- COPY . /src
34
- RUN cmake .. && make VERBOSE=1
35
-
36
- ENTRYPOINT ["/src/target/scalaBindgen" ]
25
+ WORKDIR /src
Original file line number Diff line number Diff line change @@ -25,12 +25,24 @@ cd target
25
25
cmake ..
26
26
make
27
27
./scalaBindgen /usr/include/ctype.h -name ctype --
28
+ ```
29
+
30
+ Alternatively, you can use [ docker-compose] to build and test the program:
31
+
32
+ ``` sh
33
+ # Build the docker image with LLVM version 6.0.
34
+ docker-compose build ubuntu-18.04-llvm-6.0
35
+ # Build the bindgen tool and run the tests.
36
+ docker-compose run --rm ubuntu-18.04-llvm-6.0
37
+ # Run the bindgen tool inside the container.
38
+ docker-compose run --rm ubuntu-18.04-llvm-6.0 target/scalaBindgen -name union tests/samples/Union.h --
28
39
```
29
40
30
41
[ CMake ] : https://cmake.org/
31
42
[ LLVM ] : https://llvm.org/
32
43
[ Clang ] : https://clang.llvm.org/
33
44
[ Scala Native setup guide ] : http://www.scala-native.org/en/latest/user/setup.html
45
+ [ docker-compose ] : https://docs.docker.com/compose/
34
46
35
47
## Testing
36
48
Original file line number Diff line number Diff line change 1
1
version : ' 3'
2
2
3
3
services :
4
- ubuntu-16 .04-llvm-dev :
5
- image : scala-native-bindgen:ubuntu-16 .04-llvm-dev
4
+ ubuntu-18 .04-llvm-dev :
5
+ image : scalabindgen/ scala-native-bindgen:ubuntu-18 .04-llvm-dev
6
6
build :
7
7
context : .
8
8
args :
9
- - UBUNTU_VERSION=16 .04
9
+ - UBUNTU_VERSION=18 .04
10
10
- LLVM_VERSION=7
11
11
- LLVM_DEB_COMPONENT=
12
+ command : scripts/test.sh
13
+ volumes :
14
+ - .:/src
15
+ - ${HOME}/.ivy2:/root/.ivy2
16
+ - ${HOME}/.sbt:/root/.sbt
12
17
13
- ubuntu-16 .04-llvm-6.0 :
14
- image : scala-native-bindgen:ubuntu-16 .04-llvm-6.0
18
+ ubuntu-18 .04-llvm-6.0 :
19
+ image : scalabindgen/ scala-native-bindgen:ubuntu-18 .04-llvm-6.0
15
20
build :
16
21
context : .
17
22
args :
18
- - UBUNTU_VERSION=16 .04
23
+ - UBUNTU_VERSION=18 .04
19
24
- LLVM_VERSION=6.0
25
+ command : scripts/test.sh
26
+ volumes :
27
+ - .:/src
28
+ - ${HOME}/.ivy2:/root/.ivy2
29
+ - ${HOME}/.sbt:/root/.sbt
20
30
21
- ubuntu-16 .04-llvm-5.0 :
22
- image : scala-native-bindgen:ubuntu-16 .04-llvm-5.0
31
+ ubuntu-18 .04-llvm-5.0 :
32
+ image : scalabindgen/ scala-native-bindgen:ubuntu-18 .04-llvm-5.0
23
33
build :
24
34
context : .
25
35
args :
26
- - UBUNTU_VERSION=16 .04
36
+ - UBUNTU_VERSION=18 .04
27
37
- LLVM_VERSION=5.0
28
-
29
- sbt-test :
30
- image : scala-native-bindgen:${TEST_ENV}
31
- entrypoint :
32
- - sh
33
- - -c
34
- - |
35
- cd /src/tests
36
- sbt compile test
38
+ command : scripts/test.sh
37
39
volumes :
40
+ - .:/src
38
41
- ${HOME}/.ivy2:/root/.ivy2
39
42
- ${HOME}/.sbt:/root/.sbt
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # Bash strict mode
4
+ # http://redsymbol.net/articles/unofficial-bash-strict-mode/
5
+ set -euo pipefail
6
+ IFS=$' \n\t '
7
+
8
+ if [[ ! -e target/.llvm-version ]] || [[ " $( < target/.llvm-version) " != " ${LLVM_VERSION:- } " ]]; then
9
+ rm -rf target
10
+ mkdir -p target
11
+ echo " ${LLVM_VERSION:- } " > target/.llvm-version
12
+ (cd target && cmake ..)
13
+ make -C target
14
+ fi
15
+
16
+ cd tests
17
+ sbt " ${@:- test} "
You can’t perform that action at this time.
0 commit comments