From 0e7254f78eae59e0c01ac42a3fecf949f1aad0b4 Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Thu, 12 Sep 2019 09:07:24 -0400 Subject: [PATCH] add CI files --- Dockerfile | 69 +++++++++++++++++++++++++++--------------- Jenkinsfile | 15 +++++++++ jenkins/Dockerfile.dev | 36 ++++++++++++++++++++++ jenkins/build.sh | 2 ++ jenkins/install.sh | 4 +++ jenkins/test.sh | 1 + 6 files changed, 102 insertions(+), 25 deletions(-) create mode 100644 Jenkinsfile create mode 100644 jenkins/Dockerfile.dev create mode 100755 jenkins/build.sh create mode 100755 jenkins/install.sh create mode 100755 jenkins/test.sh diff --git a/Dockerfile b/Dockerfile index 0e26daf..51d4031 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,54 @@ -FROM centos:7 -LABEL maintainer="Abdelrahman Hosny " +FROM centos:centos6 AS builder -# install gcc 7 +# install gcc 6 RUN yum -y install centos-release-scl && \ - yum -y install devtoolset-7 devtoolset-7-libatomic-devel -ENV CC=/opt/rh/devtoolset-7/root/usr/bin/gcc \ - CPP=/opt/rh/devtoolset-7/root/usr/bin/cpp \ - CXX=/opt/rh/devtoolset-7/root/usr/bin/g++ \ - PATH=/opt/rh/devtoolset-7/root/usr/bin:$PATH + yum -y install devtoolset-6 devtoolset-6-libatomic-devel +ENV CC=/opt/rh/devtoolset-6/root/usr/bin/gcc \ + CPP=/opt/rh/devtoolset-6/root/usr/bin/cpp \ + CXX=/opt/rh/devtoolset-6/root/usr/bin/g++ \ + PATH=/opt/rh/devtoolset-6/root/usr/bin:$PATH \ + LD_LIBRARY_PATH=/opt/rh/devtoolset-6/root/usr/lib64:/opt/rh/devtoolset-6/root/usr/lib:/opt/rh/devtoolset-6/root/usr/lib64/dyninst:/opt/rh/devtoolset-6/root/usr/lib/dyninst:/opt/rh/devtoolset-6/root/usr/lib64:/opt/rh/devtoolset-6/root/usr/lib:$LD_LIBRARY_PATH -# install dependencies -RUN yum update -y && \ - yum install -y wget libstdc++-devel libstdc++-static libX11-devel \ - boost-devel zlib-devel tcl-devel autoconf automake swig flex libtool \ - libtool-ltdl gmp-devel mpfr-devel libmpc-devel bison byacc ctags \ - ImageMagick ImageMagick-devel +# install dependencies +RUN yum install -y wget libstdc++-devel libstdc++-static libX11-devel \ + boost-devel zlib-devel tcl-devel tk-devel autoconf automake swig flex libtool \ + libtool-ltdl gmp-devel mpfr-devel libmpc-devel bison byacc ctags \ + ImageMagick ImageMagick-devel git glibc-static zlib-static libjpeg-turbo-static # install Intel MKL and IPP +RUN yum install -y yum-utils RUN yum-config-manager --add-repo https://yum.repos.intel.com/setup/intelproducts.repo && \ rpm --import https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \ - yum install -y intel-mkl-2018.2-046 intel-ipp-2018.4-057 + yum install -y intel-mkl-2018.2-046 -# add source code -COPY . RePlAce - -# install RePlAce -RUN cd RePlAce && \ - make clean && \ - make && \ +# Updating new bison 3+ +RUN yum remove -y bison +RUN wget https://ftp.gnu.org/gnu/bison/bison-3.0.1.tar.gz && \ + tar -xvzf bison-3.0.1.tar.gz && \ + cd bison-3.0.1 && \ + ./configure && \ + make -j$(nproc) && \ make install -# test installation -RUN cd RePlAce/test && \ - ./run.sh +# Installing cmake for build dependency +RUN wget https://cmake.org/files/v3.9/cmake-3.9.0-Linux-x86_64.sh && \ + chmod +x cmake-3.9.0-Linux-x86_64.sh && \ + ./cmake-3.9.0-Linux-x86_64.sh --skip-license --prefix=/usr/local + +COPY . /RePlAce +RUN mkdir /RePlAce/build +WORKDIR /RePlAce/build +RUN cmake -DCMAKE_INSTALL_PREFIX=/build .. +RUN make + +FROM centos:centos6 AS runner +RUN yum update -y && yum install -y tcl-devel libSM libX11-devel libXext libjpeg libgomp +COPY --from=builder /RePlAce/build/replace /build/replace +COPY --from=builder /RePlAce/module/OpenSTA/app/sta /build/sta +COPY --from=builder /RePlAce/ntuplace/ntuplace* /build/ +COPY --from=builder /RePlAce/test/PORT9.dat /build/share/PORT9.dat +COPY --from=builder /RePlAce/test/POST9.dat /build/share/POST9.dat +COPY --from=builder /RePlAce/test/POWV9.dat /build/share/POWV9.dat +RUN useradd -ms /bin/bash openroad +USER openroad +WORKDIR /home/openroad \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..fb36217 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,15 @@ +pipeline { + agent any + stages { + stage('Build') { + steps { + sh './jenkins/build.sh' + } + } + stage('Test') { + steps { + sh './jenkins/test.sh' + } + } + } +} diff --git a/jenkins/Dockerfile.dev b/jenkins/Dockerfile.dev new file mode 100644 index 0000000..b1008a7 --- /dev/null +++ b/jenkins/Dockerfile.dev @@ -0,0 +1,36 @@ +FROM openroad/centos6-tcl8.6 AS builder + +# install gcc 6 +RUN yum -y install centos-release-scl && \ + yum -y install devtoolset-6 devtoolset-6-libatomic-devel +ENV CC=/opt/rh/devtoolset-6/root/usr/bin/gcc \ + CPP=/opt/rh/devtoolset-6/root/usr/bin/cpp \ + CXX=/opt/rh/devtoolset-6/root/usr/bin/g++ \ + PATH=/opt/rh/devtoolset-6/root/usr/bin:$PATH \ + LD_LIBRARY_PATH=/opt/rh/devtoolset-6/root/usr/lib64:/opt/rh/devtoolset-6/root/usr/lib:/opt/rh/devtoolset-6/root/usr/lib64/dyninst:/opt/rh/devtoolset-6/root/usr/lib/dyninst:/opt/rh/devtoolset-6/root/usr/lib64:/opt/rh/devtoolset-6/root/usr/lib:$LD_LIBRARY_PATH + +# install dependencies +RUN yum install -y wget libstdc++-devel libstdc++-static libX11-devel \ + boost-devel zlib-devel tcl-devel tk-devel autoconf automake swig flex libtool \ + libtool-ltdl gmp-devel mpfr-devel libmpc-devel bison byacc ctags \ + ImageMagick ImageMagick-devel git glibc-static zlib-static libjpeg-turbo-static bc + +# install Intel MKL and IPP +RUN yum install -y yum-utils +RUN yum-config-manager --add-repo https://yum.repos.intel.com/setup/intelproducts.repo && \ + rpm --import https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \ + yum install -y intel-mkl-2018.2-046 + +# Updating new bison 3+ +RUN yum remove -y bison +RUN wget https://ftp.gnu.org/gnu/bison/bison-3.0.1.tar.gz && \ + tar -xvzf bison-3.0.1.tar.gz && \ + cd bison-3.0.1 && \ + ./configure && \ + make -j$(nproc) && \ + make install + +# Installing cmake for build dependency +RUN wget https://cmake.org/files/v3.9/cmake-3.9.0-Linux-x86_64.sh && \ + chmod +x cmake-3.9.0-Linux-x86_64.sh && \ + ./cmake-3.9.0-Linux-x86_64.sh --skip-license --prefix=/usr/local \ No newline at end of file diff --git a/jenkins/build.sh b/jenkins/build.sh new file mode 100755 index 0000000..d5e4ada --- /dev/null +++ b/jenkins/build.sh @@ -0,0 +1,2 @@ +docker build -f jenkins/Dockerfile.dev -t replace . +docker run -v $(pwd):/replace replace bash -c "./replace/jenkins/install.sh" \ No newline at end of file diff --git a/jenkins/install.sh b/jenkins/install.sh new file mode 100755 index 0000000..ca9b896 --- /dev/null +++ b/jenkins/install.sh @@ -0,0 +1,4 @@ +mkdir -p /replace/build +cd /replace/build +cmake -DCMAKE_INSTALL_PREFIX=/replace/build .. +make \ No newline at end of file diff --git a/jenkins/test.sh b/jenkins/test.sh new file mode 100755 index 0000000..9adc887 --- /dev/null +++ b/jenkins/test.sh @@ -0,0 +1 @@ +docker run -v $(pwd):/replace replace bash -c "echo Tests are not ready yet!" \ No newline at end of file