Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Introduce CI based on docker container build with Spack environment #37

Merged
merged 4 commits into from
Jun 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI Build

on:
pull_request:
branches: main

jobs:
cibuild:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build with Docker
uses: docker/build-push-action@v2
with:
cache-from: type=registry,ref=ghcr.io/star-bnl/star-sw-build
push: false
tags: ghcr.io/star-bnl/star-sw-build
101 changes: 101 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
FROM scientificlinux/sl:7 AS build-stage

WORKDIR /workdir

SHELL ["/bin/bash", "-c"]
ENV LC_ALL=en_US.UTF-8

# epel repo is for python pip only
RUN yum update -q -y \
&& yum install -y epel-release \
&& yum install -y \
binutils gcc gcc-c++ gcc-gfortran xorg-x11-proto-devel \
git bzip2 unzip file which make imake patch \
bison byacc flex flex-devel libcurl-devel \
perl perl-Data-Dumper perl-Env perl-Digest-MD5 \
lapack-static blas-static \
libX11-devel libXext-devel libXpm-devel openmotif-devel \
python python-pip \
&& yum clean all

# Install extra python modules used by the STAR software
RUN pip install pyparsing

ADD https://api.github.com/repos/star-bnl/star-spack/commits/main star-spack-ref.json
RUN git clone --recurse-submodules https://github.com/star-bnl/star-spack.git

RUN source star-spack/setup.sh \
&& spack env create mydocker star-spack/environments/star-x86_64-root534-docker.yaml \
&& spack env activate mydocker \
&& spack install -j 5 --fail-fast \
&& spack gc -y

# Install CERNLIB
RUN mkdir /cern && cd /cern \
&& curl -sL https://github.com/psilib/cernlib/archive/centos7.tar.gz | tar -xz --strip-components 1 \
&& ./build_cernlib.sh \
&& cd /cern/2006/lib \
&& ln -s /usr/lib64/libblas.a libblas.a \
&& ln -s /usr/lib64/liblapack.a liblapack3.a \
&& cd /cern \
&& ln -s 2006 pro \
&& rm -fr /cern/2006/src /cern/2006/build /tmp/*

ENV STAR=/star-sw
ENV USE_64BITS=1
ENV CERN=/cern
ENV CERN_LEVEL=pro
ENV CERN_ROOT=$CERN/$CERN_LEVEL
ENV OPTSTAR=/opt/view
ENV STAR_CVS_REF=YYY
ENV STAR_HOST_SYS=sl88_gcc789
ENV NODEBUG=yes
ENV STAR_LIB=$STAR/.${STAR_HOST_SYS}/LIB
ENV STAR_BIN=$STAR/.${STAR_HOST_SYS}/BIN
ENV STAR_SCRIPTS=$STAR/scripts
ENV STAR_CGI=$STAR/cgi
ENV STAR_MGR=$STAR/mgr
ENV STAR_PAMS=$STAR/pams
ENV STAR_LEVEL=$STAR_CVS_REF
ENV STAR_VERSION=$STAR_CVS_REF
ENV STAR_SYS=x8664_sl7
ENV PATH=$CERN_ROOT/bin:$STAR_BIN:$STAR_MGR:$PATH
ENV LD_LIBRARY_PATH=$STAR_LIB:$LD_LIBRARY_PATH
ENV LIBPATH+=":/lib64:/lib"

# Dummy directories checked by cons
RUN mkdir $OPTSTAR/lib && mkdir $OPTSTAR/include

COPY . /star-sw

# XXX TEMP XXX: Don't force mysql static libraries to be linked into root4star
RUN cd /star-sw \
&& cat > root4star_cons.patch <<<$'\
diff --git a/asps/rexe/Conscript b/asps/rexe/Conscript \n\
--- a/asps/rexe/Conscript \n\
+++ b/asps/rexe/Conscript \n\
@@ -79,9 +79,7 @@ \n\
} \n\
$LIBS .= " -lgeant321 -lgcalor"; \n\
$LIBS .= " " . $env->{CERNLIBS};\n\
-$LIBS .= $env->{LDALL};\n\
$LIBS .= " " . $env->{Packages}->{MYSQL}->{LIBS};\n\
-$LIBS .= $env->{LDNONE};\n\
$LIBS .= " " . $FLIBS . " " . $env->{CLIBS};# " " . $env->{SYSLIBS} ;\n\
if ($STAR_SYS =~ /^sun4x_5.$/) {\n\
if ($LIBPATH) { $LIBPATH .= $main::PATH_SEPARATOR; }\n' \
&& patch -p1 < root4star_cons.patch

RUN source star-spack/setup.sh && spack env activate mydocker \
&& export MYSQL=`spack location --install-dir mysql` \
&& export LIBXML2_DIR=`spack location --install-dir libxml2` \
&& cd /usr/include && ln -s $MYSQL/include mysql \
&& cd /star-sw \
&& cons +asps/staf \
&& cons +asps/Simulation/agetof \
&& cons +StarVMC/Geometry \
&& cons %GeoTestMaker %Kinematics %OnlTools %StAngleCorrMaker %StDaqClfMaker \
%StEEmcPool %StEbye2ptMaker %StEbyePool %StEbyeScaTagsMaker %StFgtPool \
%StFtpcV0Maker %StHighptPool %StJetFinder %StRoot/Stv %StRoot/StvMaker \
%StRoot/StvSeed %StShadowMaker %StSpinMaker %StSpinPool %StStrangePool \
%pams/sim/g2r %StRoot/StHbtMaker