From df18efcb48bbc2b775c0d2ebb9a07c6409b9ce82 Mon Sep 17 00:00:00 2001 From: Kevin O'Brien Date: Thu, 21 May 2020 10:41:00 -0400 Subject: [PATCH] Fix travis build (#142) * mount clone in container Mount the clone that travis created inside the docker container so we get the correct set of commits for this build * Update Dockerfile * start with docker file * change docker run to exec used wrong docker command in a bunch of places * fix docker commands * Update compile-onnx-mlir.sh * Update .travis.yml * save build result * commit the built container * copy clone rather than mount Copy the files that travis cloned since using -v $(pwd):/onnx-mlir to mount them as a volume doesn't persist when we push the image to docker hub. * move 'cd docker' later * fix location for Dockerfile * Update .travis.yml * Update compile-onnx-mlir.sh * fix mount directory * conditional push of build * remove old docker push forgot to do this previously Co-authored-by: Gheorghe-Teodor Bercea --- .travis.yml | 18 +++++++++++++++--- docker/Dockerfile | 6 ------ docker/compile-onnx-mlir.sh | 15 ++++++++------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index fff1313..afd69f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,20 @@ services: - docker language: cpp dist: bionic -script: +script: + - docker build --tag onnx-mlir-build:initial ./docker + - docker run -itd --name build onnx-mlir-build:initial + - docker cp $(pwd) build:/build/onnx-mlir - cd docker - chmod a+x compile-onnx-mlir.sh - - docker build --tag onnx-mlir-build:initial . - + - docker cp compile-onnx-mlir.sh build:/usr/bin/compile-onnx-mlir.sh + - docker exec -it build compile-onnx-mlir.sh + - docker commit build onnxmlirczar/onnx-mlir-build:latest +after_success: + - if [ $TRAVIS_PULL_REQUEST == false ] && [ $TRAVIS_BRANCH == "master" ]; then + echo "Pushing new build to docker hub"; + docker login -u onnxmlirczar -p 143f1da2-332f-45a1-8587-d6cb07c13230; + docker push onnxmlirczar/onnx-mlir-build:latest; + else + echo "Skip pushing build"; + fi diff --git a/docker/Dockerfile b/docker/Dockerfile index 6768776..bf85f22 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -10,9 +10,3 @@ RUN pyenv global 3.7.0 RUN pyenv rehash ENV PATH=$PATH:/build/bin -RUN git clone --recursive https://github.com/onnx/onnx-mlir.git -COPY compile-onnx-mlir.sh bin/compile-onnx-mlir.sh -RUN compile-onnx-mlir.sh -WORKDIR /build/onnx-mlir/build -ENV LIT_OPT=v -RUN cmake --build . --target check-onnx-lit diff --git a/docker/compile-onnx-mlir.sh b/docker/compile-onnx-mlir.sh index c847e09..18868d2 100644 --- a/docker/compile-onnx-mlir.sh +++ b/docker/compile-onnx-mlir.sh @@ -1,13 +1,14 @@ #!/bin/bash -# Export environment variables pointing to LLVM-Projects +# Export environment variables pointing to LLVM-Projects. export LLVM_PROJ_SRC=$(pwd)/llvm-project/ export LLVM_PROJ_BUILD=$(pwd)/llvm-project/build -HOME=/ -PYENV_ROOT=$HOME/.pyenv -PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH -eval "$(pyenv init -)" -# use python 3 -pyenv shell 3.7.0 + +pwd +ls -al mkdir onnx-mlir/build && cd onnx-mlir/build cmake .. cmake --build . --target onnx-mlir + +# Run FileCheck tests: +export LIT_OPTS=-v +cmake --build . --target check-onnx-lit