|
| 1 | +name: Deploy on CentOS |
| 2 | +runs: |
| 3 | + using: composite |
| 4 | + steps: |
| 5 | + - name: Install environment |
| 6 | + shell: bash |
| 7 | + run: | |
| 8 | + cd /root |
| 9 | +
|
| 10 | + SCL_ENABLE="devtoolset-7" |
| 11 | + CENTOS_VERSION=$(rpm --eval '%{centos_ver}') |
| 12 | + if [[ "$CENTOS_VERSION" == "6" ]]; then |
| 13 | + find /etc/yum.repos.d/ -name *.repo | xargs -i sed -i 's/mirror\.centos\.org\/centos/vault.centos.org/g;s/$releasever/6.10/g;s/mirrorlist/#mirrorlist/g;s/#baseurl/baseurl/g' {} |
| 14 | + SCL_ENABLE="devtoolset-7 rh-python36 python27" |
| 15 | + fi |
| 16 | + echo "SCL_ENABLE=$SCL_ENABLE" >> $GITHUB_ENV |
| 17 | +
|
| 18 | + yum -y update |
| 19 | + yum -y install centos-release-scl-rh epel-release |
| 20 | + if [[ "$CENTOS_VERSION" == "6" ]]; then |
| 21 | + sed -i 's/mirror\.centos\.org\/centos/vault.centos.org/g;s/6\/sclo/6.10\/sclo/g;s/mirrorlist/#mirrorlist/g;s/#baseurl/baseurl/g' /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo |
| 22 | + fi |
| 23 | + yum -y install $SCL_ENABLE rh-java-common-ant boost-devel ccache clang gcc-c++ gcc-gfortran java-1.8.0-openjdk-devel ant python python36-devel python36-pip swig file which wget unzip tar bzip2 gzip xz patch autoconf-archive automake make libtool bison flex perl nasm alsa-lib-devel freeglut-devel gtk2-devel libusb-devel libusb1-devel curl-devel expat-devel gettext-devel openssl-devel zlib-devel SDL-devel libva-devel libxkbcommon-devel libxkbcommon-x11-devel xcb-util* fontconfig-devel libffi-devel ragel ocl-icd-devel |
| 24 | + # https://gcc.gnu.org/legacy-ml/gcc-patches/2018-01/msg01962.html |
| 25 | + sed -i 's/_mm512_abs_pd (__m512 __A)/_mm512_abs_pd (__m512d __A)/g' /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include/avx512fintrin.h |
| 26 | + source scl_source enable $SCL_ENABLE || true |
| 27 | +
|
| 28 | + curl -LO https://github.com/Kitware/CMake/releases/download/v3.16.6/cmake-3.16.6-Linux-x86_64.tar.gz |
| 29 | + curl -LO https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz |
| 30 | + curl -LO https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.18.3.tar.gz |
| 31 | + tar -xzf cmake-3.16.6-Linux-x86_64.tar.gz -C /opt/ |
| 32 | + tar -xzf apache-maven-3.6.3-bin.tar.gz -C /opt/ |
| 33 | + tar -xzf git-2.18.3.tar.gz |
| 34 | + pushd git-2.18.3; make -j2 prefix=/usr/local/; make -j2 prefix=/usr/local/ install; popd |
| 35 | + ln -sf /usr/bin/python3.6 /usr/bin/python3 |
| 36 | + ln -sf /opt/cmake-3.16.6-Linux-x86_64/bin/* /usr/bin/ |
| 37 | + ln -sf /opt/apache-maven-3.6.3/bin/mvn /usr/bin/mvn |
| 38 | +
|
| 39 | + python3 -m pip install gdown |
| 40 | +
|
| 41 | + if [[ $CI_DEPLOY_PLATFORM == android-* ]]; then |
| 42 | + curl -LO https://dl.google.com/android/repository/android-ndk-r18b-linux-x86_64.zip |
| 43 | + unzip -qq android-ndk-r18b-linux-x86_64.zip |
| 44 | + ln -sf android-ndk-r18b android-ndk |
| 45 | + echo "MAVEN_OPTIONS=-Djavacpp.platform.root=$(pwd)/android-ndk/ -Djava.library.path=" >> $GITHUB_ENV |
| 46 | + fi |
| 47 | +
|
| 48 | + if [[ $CI_DEPLOY_PLATFORM == "linux-x86" ]]; then |
| 49 | + rpm -qa | sed s/.x86_64$/.i686/ | xargs yum -q -y install |
| 50 | + wget --no-directories --no-parent -r https://www.repo.cloudlinux.com/cloudlinux/$CENTOS_VERSION/sclo/devtoolset-7/i386/ |
| 51 | + rpm -i --force --nodeps *.rpm |
| 52 | + fi |
| 53 | +
|
| 54 | + if [[ -n ${CI_DEPLOY_NEED_BAZEL:-} ]]; then |
| 55 | + echo Installing Bazel |
| 56 | + curl -LO https://github.com/bazelbuild/bazel/releases/download/0.25.3/bazel-0.25.3-installer-linux-x86_64.sh |
| 57 | + bash bazel-0.25.3-installer-linux-x86_64.sh |
| 58 | + fi |
| 59 | +
|
| 60 | + if [[ "$CI_DEPLOY_PLATFORM" == "linux-x86_64" ]] && [[ -n ${CI_DEPLOY_NEED_CUDA:-} ]]; then |
| 61 | + echo Installing CUDA, cuDNN, etc |
| 62 | + curl -LO https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda-repo-rhel7-11-1-local-11.1.1_455.32.00-1.x86_64.rpm |
| 63 | + curl -LO https://developer.download.nvidia.com/compute/redist/cudnn/v8.0.4/cudnn-11.1-linux-x64-v8.0.4.30.tgz |
| 64 | + curl -LO https://developer.download.nvidia.com/compute/redist/nccl/v2.7/nccl_2.7.8-1+cuda11.1_x86_64.txz |
| 65 | +
|
| 66 | + rpm -i cuda-repo-rhel7-11-1-local-11.1.1_455.32.00-1.x86_64.rpm |
| 67 | + pushd /var/cuda-repo-rhel7-11-1-local/; rpm -i --nodeps cuda*.rpm libc*.rpm libn*.rpm; rm *.rpm; popd |
| 68 | + ln -sf /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/libcuda.so |
| 69 | + ln -sf /usr/local/cuda/lib64/stubs/libnvidia-ml.so /usr/local/cuda/lib64/libnvidia-ml.so |
| 70 | + tar -hxvf cudnn-11.1-linux-x64-v8.0.4.30.tgz -C /usr/local/ |
| 71 | + tar -hxvf nccl_2.7.8-1+cuda11.1_x86_64.txz --strip-components=1 -C /usr/local/cuda/ |
| 72 | + mv /usr/local/cuda/lib/* /usr/local/cuda/lib64/ |
| 73 | +
|
| 74 | + # Work around issues with CUDA 10.2/11.x |
| 75 | + mv /usr/include/cublas* /usr/include/nvblas* /usr/local/cuda/include/ || true |
| 76 | + mv /usr/lib64/libcublas* /usr/lib64/libnvblas* /usr/local/cuda/lib64/ || true |
| 77 | + for f in /usr/local/cuda/lib64/*.so.10; do ln -s $f $f.2; done |
| 78 | + for f in /usr/local/cuda/lib64/*.so.10; do ln -s $f ${f:0:${#f}-1}1; done |
| 79 | + ln -s libcudart.so.11.0 /usr/local/cuda/lib64/libcudart.so.11.1 |
| 80 | + cp /usr/local/cuda/lib64/stubs/libcuda.so /usr/lib64/libcuda.so |
| 81 | + cp /usr/local/cuda/lib64/stubs/libcuda.so /usr/lib64/libcuda.so.1 |
| 82 | + cp /usr/local/cuda/lib64/stubs/libnvidia-ml.so /usr/lib64/libnvidia-ml.so |
| 83 | + cp /usr/local/cuda/lib64/stubs/libnvidia-ml.so /usr/lib64/libnvidia-ml.so.1 |
| 84 | +
|
| 85 | + python3 -m gdown.cli https://drive.google.com/uc?id=1-SQo1jZZ6FM6PWbAt9YLZisWQolCxbxX |
| 86 | + tar -hxvf TensorRT-7.2.1.6.CentOS-7.6.x86_64-gnu.cuda-11.1.cudnn8.0.tar.gz -C /usr/local/ |
| 87 | + ln -sf /usr/local/TensorRT* /usr/local/tensorrt |
| 88 | +
|
| 89 | + # Remove downloaded archives and unused libraries to avoid running out of disk space |
| 90 | + rm -f *.rpm *.tgz *.txz *.tar.* |
| 91 | + rm -f $(find /usr/local/cuda/ -name '*.a' -and -not -name libcudart_static.a -and -not -name libcudadevrt.a) |
| 92 | + fi |
| 93 | +
|
| 94 | + if [[ "$CI_DEPLOY_MODULE" == "mkl" ]]; then |
| 95 | + echo Installing MKL |
| 96 | + curl -LO https://registrationcenter-download.intel.com/akdlm/irc_nas/tec/16917/l_mkl_2020.4.304.tgz |
| 97 | + tar -xzvf l_mkl_2020.4.304.tgz |
| 98 | + sed -i -e 's/decline/accept/g' l_mkl_2020.4.304/silent.cfg |
| 99 | + l_mkl_2020.4.304/install.sh -s l_mkl_2020.4.304/silent.cfg |
| 100 | + fi |
| 101 | +
|
| 102 | + if [[ "$CI_DEPLOY_PLATFORM" == "linux-x86" ]] && [[ "$CI_DEPLOY_MODULE" == "flycapture" ]]; then |
| 103 | + echo Installing FlyCapture i386 |
| 104 | + python3 -m gdown.cli https://drive.google.com/uc?id=1BOpSik1Fndagzjf4ykwzermt2qlTzsWI |
| 105 | + tar -xzvf flycapture2-2.13.3.31-i386-pkg_xenial.tgz |
| 106 | + find -name *.deb | while read f; do ar -xv $f; tar --totals -xf data.tar.xz -C /; done; |
| 107 | + fi |
| 108 | +
|
| 109 | + if [[ "$CI_DEPLOY_PLATFORM" == "linux-x86_64" ]] && [[ "$CI_DEPLOY_MODULE" == "flycapture" ]]; then |
| 110 | + echo Installing FlyCapture amd64 |
| 111 | + python3 -m gdown.cli https://drive.google.com/uc?id=1YtVjdnbQLZHX_ocQ6xAmiq6pjftuPOPd |
| 112 | + tar -xzvf flycapture2-2.13.3.31-amd64-pkg_xenial.tgz |
| 113 | + find -name *.deb | while read f; do ar -xv $f; tar --totals -xf data.tar.xz -C /; done; |
| 114 | + fi |
| 115 | +
|
| 116 | + if [[ "$CI_DEPLOY_PLATFORM" == "linux-x86_64" ]] && [[ "$CI_DEPLOY_MODULE" == "spinnaker" ]]; then |
| 117 | + echo Installing Spinnaker amd64 |
| 118 | + python3 -m gdown.cli https://drive.google.com/uc?id=1DiI8mG1fyewEGWxW7keg-dqXk0rLwmAK |
| 119 | + tar -xzvf spinnaker-1.27.0.48-Ubuntu16.04-amd64-pkg.tar.gz |
| 120 | + find -name *.deb | while read f; do ar -xv $f; tar --totals -xf data.tar.xz -C /; done; |
| 121 | + ln -s libSpinnaker_C.so.1.27.0.48 /usr/lib/libSpinnaker_C.so.1 |
| 122 | + ln -s libSpinnaker.so.1.27.0.48 /usr/lib/libSpinnaker.so.1 |
| 123 | + fi |
| 124 | +
|
| 125 | + rm -f /usr/lib/libgfortran.so.3* /usr/lib64/libgfortran.so.3* # not required for GCC 7+ |
| 126 | +
|
| 127 | + - name: Build project |
| 128 | + shell: bash |
| 129 | + run: | |
| 130 | + source scl_source enable $SCL_ENABLE || true |
| 131 | + git --version |
| 132 | + gcc --version |
| 133 | + mvn -version |
| 134 | + cmake --version |
| 135 | + gpg --version |
| 136 | + df -h |
| 137 | +
|
| 138 | + echo Fetching $GITHUB_REPOSITORY@$GITHUB_SHA |
| 139 | + git init |
| 140 | + git fetch --depth 1 https://github.com/$GITHUB_REPOSITORY $GITHUB_SHA |
| 141 | + git checkout $GITHUB_SHA |
| 142 | +
|
| 143 | + echo "Fixing HOME to /root (was '$HOME')" |
| 144 | + export HOME=/root |
| 145 | + mkdir -p $HOME/.m2 |
| 146 | + [[ "${{ github.event_name }}" == "pull_request" ]] && MAVEN_PHASE=install || MAVEN_PHASE=deploy |
| 147 | + echo "<settings>" > $HOME/.m2/settings.xml |
| 148 | + echo "<mirrors><mirror><id>google-maven-central</id><name>GCS Maven Central mirror</name><url>https://maven-central.storage-download.googleapis.com/maven2/</url><mirrorOf>central</mirrorOf></mirror></mirrors>" >> $HOME/.m2/settings.xml |
| 149 | + echo "<servers><server><id>sonatype-nexus-snapshots</id><username>$CI_DEPLOY_USERNAME</username><password>$CI_DEPLOY_PASSWORD</password></server><server><id>sonatype-nexus-staging</id><username>$CI_DEPLOY_USERNAME</username><password>$CI_DEPLOY_PASSWORD</password></server></servers>" >> $HOME/.m2/settings.xml |
| 150 | + echo "</settings>" >> $HOME/.m2/settings.xml |
| 151 | +
|
| 152 | + SECONDS=$(( RANDOM % 300 )) |
| 153 | + echo Sleeping $SECONDS seconds to help avoid race conditions with Maven |
| 154 | + sleep $SECONDS |
| 155 | +
|
| 156 | + export MAKEJ=$(getconf _NPROCESSORS_ONLN) |
| 157 | + echo Executing Maven $MAVEN_PHASE on $MAKEJ processors |
| 158 | + export EXT=${{ matrix.ext }} |
| 159 | + export EXT2=${EXT:1} |
| 160 | + export MAVEN_OPTIONS="clean $MAVEN_PHASE -B -U -e -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.count=3 -Djavacpp.platform=$CI_DEPLOY_PLATFORM -Djavacpp.platform.extension=$EXT $MAVEN_OPTIONS" |
| 161 | + for i in {1..5}; do STATUS=0; mvn $MAVEN_OPTIONS -f $CI_DEPLOY_MODULE && break || STATUS=$? && sleep 60; done; (exit $STATUS) |
| 162 | + for i in {1..5}; do STATUS=0; mvn $MAVEN_OPTIONS -f $CI_DEPLOY_MODULE/platform/$EXT2/pom.xml && break || STATUS=$? && sleep 60; done; (exit $STATUS) |
| 163 | + df -h |
| 164 | +
|
| 165 | + - name: Clean up |
| 166 | + shell: bash |
| 167 | + run: | |
| 168 | + cd /root |
| 169 | + rm -Rf $(find .m2/repository/ -name '*SNAPSHOT*') |
0 commit comments