Przeglądaj źródła

Merge pull request #117 from vmarkovtsev/master

Docker
Vadim Markovtsev 6 lat temu
rodzic
commit
6b5a36d842
3 zmienionych plików z 15 dodań i 8 usunięć
  1. 7 4
      .travis.yml
  2. 5 4
      Dockerfile
  3. 3 0
      labours.py

+ 7 - 4
.travis.yml

@@ -15,10 +15,8 @@ addons:
 
 go_import_path: gopkg.in/src-d/hercules.v5
 go:
-  - 1.9.x
   - 1.10.x
   - 1.11.x
-  - tip
 cache:
   directories:
     - $HOME/.cache/pip
@@ -31,7 +29,6 @@ matrix:
   fast_finish: true
   allow_failures:
     - go: tip
-    - go: 1.11.x
 
 stages:
   - test
@@ -75,12 +72,18 @@ script:
   - (cd contrib/_plugin_example && make)
   - $GOPATH/bin/hercules --burndown --burndown-files --burndown-people --couples --quiet https://github.com/src-d/hercules | python3 labours.py -m all -o out --backend Agg --disable-projector
   - $GOPATH/bin/hercules --burndown --burndown-files --burndown-people --couples --quiet --pb https://github.com/src-d/hercules | python3 labours.py -f pb -m all -o out --backend Agg --disable-projector
-  - $GOPATH/bin/hercules --sentiment --quiet --languages Python https://github.com/src-d/hercules > /dev/null
+  - # $GOPATH/bin/hercules --sentiment --quiet --languages Python https://github.com/src-d/hercules > /dev/null
   - set +e
   - if [[ $TRAVIS_GO_VERSION = 1.10.* ]]; then bash <(curl -s https://codecov.io/bash); fi
 
 jobs:
   include:
+    - stage: test
+      language: generic
+      env: DOCKER_BUILD=1
+      before_install: skip
+      install: skip
+      script: docker build -t srcd/hercules .
     - stage: deploy
       os: osx
       osx_image: xcode9.3

+ 5 - 4
Dockerfile

@@ -12,14 +12,15 @@ RUN apt-get update && \
     unzip -d /usr/local protoc.zip && rm protoc.zip && \
     locale-gen en_US.UTF-8 && \
     export PATH=/usr/lib/go-1.10/bin:$PATH && \
-    go get -v -d gopkg.in/src-d/hercules.v4/... && \
-    cd /root/src/gopkg.in/src-d/hercules.v4 && \
+    git clone --single-branch --branch v4.7.0 --depth 1 https://github.com/src-d/go-git /root/src/gopkg.in/src-d/go-git.v4 && \
+    go get -v -d gopkg.in/src-d/hercules.v5/... && \
+    cd /root/src/gopkg.in/src-d/hercules.v5 && \
     export CGO_CXXFLAGS=-std=c++14 && \
     curl -L "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-$(go env GOOS)-x86_64-1.7.0.tar.gz" | tar -C /usr/local -xz && \
     make && \
     rm /usr/local/bin/protoc && rm /usr/local/readme.txt && rm -rf /usr/local/include/google && \
     cp /root/bin/hercules /usr/local/bin && \
-    cp -r /root/src/gopkg.in/src-d/hercules.v4/*.py /root/src/gopkg.in/src-d/hercules.v4/internal /usr/local/bin && \
+    cp -r /root/src/gopkg.in/src-d/hercules.v5/*.py /root/src/gopkg.in/src-d/hercules.v5/internal /usr/local/bin && \
     sed -i 's/parser.add_argument("--backend",/parser.add_argument("--backend", default="Agg",/' /usr/local/bin/labours.py && \
     echo '#!/bin/bash\n\
 \n\
@@ -28,7 +29,7 @@ echo "	$@"\n\
 echo\n\' > /browser && \
     chmod +x /browser && \
     curl https://bootstrap.pypa.io/get-pip.py | python3 && \
-    pip3 install --no-cache-dir --no-build-isolation -r /root/src/gopkg.in/src-d/hercules.v4/requirements.txt https://github.com/mind/wheels/releases/download/tf1.7-cpu/tensorflow-1.7.0-cp36-cp36m-linux_x86_64.whl && \
+    pip3 install --no-cache-dir --no-build-isolation -r /root/src/gopkg.in/src-d/hercules.v5/requirements.txt https://github.com/mind/wheels/releases/download/tf1.7-cpu/tensorflow-1.7.0-cp36-cp36m-linux_x86_64.whl && \
     rm -rf /root/* && \
     apt-get remove -y software-properties-common golang-1.10-go python3-dev libyaml-dev libxml2-dev curl git make unzip g++ && \
     apt-get remove -y *-doc *-man && \

+ 3 - 0
labours.py

@@ -942,6 +942,9 @@ def train_embeddings(index, matrix, tmpdir, shard_size=IDEAL_SHARD_SIZE):
         else:
             embedding_size = 300
             num_epochs = 300
+        if os.getenv("CI"):
+            # Travis, AppVeyor etc. during the integration tests
+            num_epochs /= 10
         swivel.FLAGS.embedding_size = embedding_size
         swivel.FLAGS.input_base_path = tmproot
         swivel.FLAGS.output_base_path = tmproot