add Github workflow to build the prereq Docker image for TravisCI build (#137)

* Create build-docker-prereq.ym

* Rename build-docker-prereq.ym to build-docker-prereq.yml

* Create prereq.Dockerfile

* Update build-docker-prereq.yml

* Update clone-mlir.sh

* Update build-docker-prereq.yml

* Update clone-mlir.sh

* Update build-docker-prereq.yml

* Update clone-mlir.sh

* Update prereq.Dockerfile

* Update clone-mlir.sh

* Update prereq.Dockerfile

* Update clone-mlir.sh

* Update build-docker-prereq.yml

* Update prereq.Dockerfile

* Update clone-mlir.sh

* Update build-docker-prereq.yml

* Update clone-mlir.sh

* Update Dockerfile

* Update .travis.yml

* Update .travis.yml

* Update Dockerfile

* Update Dockerfile

* Update build-docker-prereq.yml

* Update Dockerfile

* Update prereq.Dockerfile

* Update clone-mlir.sh

* Update build-docker-prereq.yml

* Update .travis.yml

Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
This commit is contained in:
Kevin O'Brien 2020-05-19 15:48:47 -04:00 committed by GitHub
parent c476f05a45
commit 661fa601ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 74 additions and 2 deletions

View File

@ -0,0 +1,28 @@
# This workflow will run whenever there is a change to the version of LLVM the project is based on
# It will create a new Docker image for the TravisCI build and push it to Docker Hub
# This image contains the prereqs for building onnx-mlir including a precompiled copy of the appropriate
# LLVM and MLIR code.
name: Build Docker Prereq Image
# Run this workflow when there is a change to clone-mlir.sh (that implies a new version of LLVM is being used)
on:
push:
paths:
- 'utils/clone-mlir.sh'
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: build image
run: |
docker build --tag onnxmlirczar/onnx-mlir-llvmimage:initial -f $GITHUB_WORKSPACE/.github/workflows/prereq.Dockerfile $GITHUB_WORKSPACE/utils
docker login -u onnxmlirczar -p 143f1da2-332f-45a1-8587-d6cb07c13230
docker push onnxmlirczar/onnx-mlir-llvmimage:initial

43
.github/workflows/prereq.Dockerfile vendored Normal file
View File

@ -0,0 +1,43 @@
FROM ubuntu:focal
WORKDIR /build
# install stuff that is needed for compiling LLVM, MLIR and ONNX
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y git cmake ninja-build libprotobuf-dev protobuf-compiler
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && \
apt-get -y install \
make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev \
libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils \
libffi-dev liblzma-dev
RUN git clone git://github.com/yyuu/pyenv.git .pyenv
RUN git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
ENV HOME=/build
ENV PYENV_ROOT=$HOME/.pyenv
ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
RUN pyenv install 3.7.0
RUN pyenv global 3.7.0
RUN pyenv rehash
# first install MLIR in llvm-project
RUN mkdir bin
ENV PATH=$PATH:/build/bin
COPY clone-mlir.sh bin/clone-mlir.sh
RUN chmod a+x bin/clone-mlir.sh
RUN clone-mlir.sh
WORKDIR /build/llvm-project/build
RUN cmake -G Ninja ../llvm \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_BUILD_EXAMPLES=ON \
-DLLVM_TARGETS_TO_BUILD="host" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_RTTI=ON
RUN cmake --build . --target -- ${MAKEFLAGS}
RUN cmake --build . --target check-mlir

View File

@ -1,5 +1,7 @@
FROM caoimhinuibrian/onnx-mlir-llvmimage:initial
# Grab pre-built LLVM from github packages
FROM onnxmlirczar/onnx-mlir-llvmimage:initial
WORKDIR /build/bin
WORKDIR /build
ENV HOME=/build
ENV PYENV_ROOT=$HOME/.pyenv
@ -7,7 +9,6 @@ ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
RUN pyenv global 3.7.0
RUN pyenv rehash
RUN mkdir bin
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