Skip to content

Commit 9010d91

Browse files
committed
Backport CI machinery from main branch (star-bnl#235)
This is done by simply checking out the corresponding files: git checkout aed3dcc -- .github/workflows docker/Dockerfile.root5 tests/ StRoot/macros/rootlogoff.C StRoot/macros/rootlogon.C StRoot/macros/.rootrc The changes related to ROOT6 CI builds are not included
1 parent 24c2071 commit 9010d91

10 files changed

Lines changed: 1413 additions & 56 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build Containers
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'SL*'
8+
tags:
9+
- '*'
10+
11+
jobs:
12+
ROOT5:
13+
if: github.repository_owner == 'star-bnl'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Get branch name
17+
id: branch-name
18+
uses: tj-actions/branch-names@v4.8
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v1
22+
23+
- name: Login to GitHub Container Registry
24+
uses: docker/login-action@v1
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Rebuild up to base-stage
31+
uses: docker/build-push-action@v2
32+
with:
33+
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/star-sw-root5-base:cache
34+
file: docker/Dockerfile.root5
35+
target: base-stage
36+
push: true
37+
tags: ghcr.io/${{ github.repository_owner }}/star-sw-root5-base:${{ steps.branch-name.outputs.current_branch }}_latest
38+
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/star-sw-root5-base:cache,mode=max
39+
40+
- name: Build release container
41+
if: steps.branch-name.outputs.is_tag == 'true'
42+
uses: docker/build-push-action@v2
43+
with:
44+
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/star-sw-root5-base:cache
45+
file: docker/Dockerfile.root5
46+
target: build-stage
47+
push: true
48+
tags: ghcr.io/${{ github.repository_owner }}/star-sw-root5-build:${{ steps.branch-name.outputs.tag }}

.github/workflows/ci-build.yml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,56 @@
11
name: CI Build
22

3-
on:
4-
pull_request:
5-
branches: main
3+
on: [pull_request]
64

75
jobs:
86
ROOT5:
97
runs-on: ubuntu-latest
108
steps:
119
- name: Set up Docker Buildx
1210
uses: docker/setup-buildx-action@v1
11+
with:
12+
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=10000000
1313

1414
- name: Build with Docker
1515
uses: docker/build-push-action@v2
1616
with:
17-
cache-from: type=registry,ref=ghcr.io/star-bnl/star-sw-base-root5
17+
cache-from: type=registry,ref=ghcr.io/star-bnl/star-sw-root5-base@sha256:4bed8a8b729fa9e6c8e92b2bdecd6b73869e67a07bfbde969936f921123d4c3e
1818
push: false
19-
tags: ghcr.io/star-bnl/star-sw-base-root5
19+
tags: ghcr.io/star-bnl/star-sw-root5-build
2020
file: docker/Dockerfile.root5
21+
outputs: type=docker,dest=/tmp/star-sw-root5-build.tar
22+
23+
- name: Save built image for test jobs
24+
uses: actions/upload-artifact@v2
25+
with:
26+
name: star-sw-root5-build
27+
path: /tmp/star-sw-root5-build.tar
28+
29+
ROOT5_test_setup:
30+
runs-on: ubuntu-latest
31+
needs: ROOT5
32+
outputs:
33+
matrix: ${{ steps.set-matrix.outputs.matrix }}
34+
steps:
35+
- uses: actions/checkout@v2
36+
- run: echo "::set-output name=matrix::" $(cat tests/joblist_ci.json)
37+
id: set-matrix
38+
39+
ROOT5_test:
40+
runs-on: ubuntu-latest
41+
needs: ROOT5_test_setup
42+
strategy:
43+
matrix:
44+
test_id: ${{ fromJSON(needs.ROOT5_test_setup.outputs.matrix) }}
45+
steps:
46+
- name: Download artifact
47+
uses: actions/download-artifact@v2
48+
with:
49+
name: star-sw-root5-build
50+
path: /tmp
51+
52+
- run: docker load --input /tmp/star-sw-root5-build.tar
53+
- run: docker run --name star-test-data --volume /star ghcr.io/star-bnl/star-test-data:v2
54+
- run: |
55+
TEST_CMD=$(docker run --rm ghcr.io/star-bnl/star-sw-root5-build star-sw/tests/executest.py -c ${{ matrix.test_id }})
56+
docker run --volumes-from star-test-data ghcr.io/star-bnl/star-sw-root5-build sh -c "$TEST_CMD"

StRoot/macros/.rootrc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
Gui.Style: windows
2-
Gui.Backend: qt
3-
Gui.Factory: qtgui
1+
Rint.Logon: $(STAR)/StRoot/macros/rootlogon.C
2+
Rint.Logoff: $(STAR)/StRoot/macros/rootlogoff.C
3+
Unix.*.Root.MacroPath: .:$(STAR)/StRoot/macros:$(ROOTSYS)/macros
4+
Unix.*.Root.DynamicPath: .:$(STAR_LIB):$(ROOTSYS)/lib

StRoot/macros/rootlogoff.C

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
if (TClassTable::GetDict("StMaker"))
3+
{
4+
StMaker* mk = StMaker::GetChain();
5+
if (mk) {
6+
mk->Finish();
7+
}
8+
}
9+
10+
std::cout << "\nThis is the end of STAR ROOT -- Goodbye\n" << std::endl;
11+
}

StRoot/macros/rootlogon.C

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
gSystem->Load("libStarClassLibrary");
3+
gSystem->Load("libGeom");
4+
gSystem->Load("libTable");
5+
gSystem->Load("libPhysics");
6+
gSystem->Load("libEG");
7+
gSystem->Load("libStarRoot");
8+
9+
if (gSystem->GetLibraries("*libTable*"))
10+
{
11+
gInterpreter->ProcessLine("typedef TCL StCL;");
12+
gInterpreter->ProcessLine("typedef TDataSet St_DataSet ;");
13+
gInterpreter->ProcessLine("typedef TDataSetIter St_DataSetIter;");
14+
gInterpreter->ProcessLine("typedef TFileSet St_FileSet;");
15+
gInterpreter->ProcessLine("typedef TVolume St_Node;");
16+
gInterpreter->ProcessLine("typedef TVolumePosition St_NodePosition;");
17+
gInterpreter->ProcessLine("typedef TVolumeView St_NodeView;");
18+
gInterpreter->ProcessLine("typedef TVolumeViewIter St_NodeViewIter;");
19+
gInterpreter->ProcessLine("typedef TObjectSet St_ObjectSet;");
20+
gInterpreter->ProcessLine("typedef TPoints3D St_Points3D;");
21+
gInterpreter->ProcessLine("typedef TPointsArray3D St_PointsArray3D;");
22+
gInterpreter->ProcessLine("typedef TPolyLineShape St_PolyLineShape;");
23+
gInterpreter->ProcessLine("typedef TTable St_Table;");
24+
gInterpreter->ProcessLine("typedef TTable3Points St_Table3Points;");
25+
gInterpreter->ProcessLine("typedef TTableIter St_TableIter;");
26+
gInterpreter->ProcessLine("typedef TTablePoints St_TablePoints;");
27+
gInterpreter->ProcessLine("typedef TTableSorter St_TableSorter;");
28+
gInterpreter->ProcessLine("typedef TTableDescriptor St_tableDescriptor;");
29+
}
30+
31+
std::cout << " *** Start at Date : " << TDatime().AsString() << std::endl;
32+
33+
gSystem->AddIncludePath(" -I. -I./.$STAR_HOST_SYS/include -I./StRoot -I$STAR/.$STAR_HOST_SYS/include -I$STAR/StRoot -I/usr/include/mysql");
34+
}

docker/Dockerfile.root5

Lines changed: 87 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,104 @@
1-
FROM scientificlinux/sl:7 AS build-stage
2-
3-
WORKDIR /workdir
1+
# Pull SL7 image by digest (immutable identifier)
2+
FROM scientificlinux/sl@sha256:437d3402c454319a5443bb5a99844c8d6f454828c59dcfb2730f1bdff8f2f48c AS prep-stage
43

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

8-
# epel repo is for python pip only
97
RUN yum update -q -y \
10-
&& yum install -y epel-release \
118
&& yum install -y \
12-
binutils gcc gcc-c++ gcc-gfortran xorg-x11-proto-devel \
9+
gcc gcc-c++ gcc-gfortran \
1310
git bzip2 unzip file which make imake patch \
14-
bison byacc flex flex-devel libcurl-devel \
15-
perl perl-Data-Dumper perl-Env perl-Digest-MD5 \
11+
flex-devel libcurl-devel \
12+
perl perl-Data-Dumper \
1613
lapack-static blas-static \
1714
libX11-devel libXext-devel libXpm-devel openmotif-devel \
18-
python python-pip \
19-
environment-modules \
2015
&& yum clean all
2116

22-
# Install extra python modules used by the STAR software
23-
RUN pip install pyparsing
17+
# Install cernlib
18+
RUN mkdir /cern && cd /cern \
19+
&& curl -sL https://github.com/psilib/cernlib/archive/centos7.tar.gz | tar -xz --strip-components 1 \
20+
&& ./build_cernlib.sh \
21+
&& mv /usr/lib64/libblas.a /cern/2006/lib/libblas.a \
22+
&& mv /usr/lib64/liblapack.a /cern/2006/lib/liblapack3.a \
23+
&& ln -s 2006 /cern/pro \
24+
&& rm -fr /cern/2006/src /cern/2006/build
2425

2526
RUN mkdir -p star-spack \
26-
&& curl -sL https://github.com/star-bnl/star-spack/archive/9299449b078f4f0ad0d6fd1b0a220449d38b340d.tar.gz | tar -xz --strip-components 1 -C star-spack \
27+
&& curl -sL https://github.com/star-bnl/star-spack/archive/fba3a3ffbafc0c77fa46085d807b717ca807f345.tar.gz | tar -xz --strip-components 1 -C star-spack \
2728
&& curl -sL https://github.com/spack/spack/archive/010e5761d6631eae102d1eec87e5e74a0e16ed82.tar.gz | tar -xz --strip-components 1 -C star-spack/spack
2829

2930
RUN source star-spack/setup.sh \
30-
&& spack env create star-env-root5 star-spack/environments/star-x86_64-root-5.34.38-container.yaml \
31-
&& spack env activate star-env-root5 \
31+
&& spack env create star-env-root star-spack/environments/star-x86_64-root-5.34.38-container.yaml \
32+
&& spack env activate star-env-root \
3233
&& spack install -j 5 --fail-fast \
33-
&& spack gc -y
34+
&& spack gc -y \
35+
&& spack clean --all \
36+
&& spack uninstall --force -y llvm \
37+
# Create star-spack/spack/var/spack/environments/star-env-root/loads
38+
&& spack -e star-env-root env loads
3439

35-
# Install CERNLIB
36-
RUN mkdir /cern && cd /cern \
37-
&& curl -sL https://github.com/psilib/cernlib/archive/centos7.tar.gz | tar -xz --strip-components 1 \
38-
&& ./build_cernlib.sh \
39-
&& cd /cern/2006/lib \
40-
&& ln -s /usr/lib64/libblas.a libblas.a \
41-
&& ln -s /usr/lib64/liblapack.a liblapack3.a \
42-
&& cd /cern \
43-
&& ln -s 2006 pro \
44-
&& rm -fr /cern/2006/src /cern/2006/build /tmp/*
40+
# Strip all the binaries
41+
RUN find -L /opt/software/* -type f -exec readlink -f '{}' \; | \
42+
xargs file -i | \
43+
grep 'charset=binary' | \
44+
grep 'x-executable\|x-archive\|x-sharedlib' | \
45+
awk -F: '{print $1}' | xargs strip -S
46+
47+
48+
FROM scientificlinux/sl@sha256:437d3402c454319a5443bb5a99844c8d6f454828c59dcfb2730f1bdff8f2f48c AS base-stage
49+
50+
SHELL ["/bin/bash", "-c"]
51+
ENV LC_ALL=en_US.UTF-8
52+
53+
COPY --from=prep-stage /opt/software /opt/software
54+
COPY --from=prep-stage /cern /cern
55+
COPY --from=prep-stage /star-spack/spack/var/spack/environments/star-env-root/loads /etc/profile.d/z10_load_spack_env_modules.sh
56+
COPY --from=prep-stage /star-spack/spack/share/spack/modules/linux-scientific7-x86_64 /opt/linux-scientific7-x86_64
57+
58+
# epel repo is for python-pip only
59+
RUN yum update -q -y \
60+
&& yum install -y epel-release \
61+
&& yum install -y \
62+
binutils gcc gcc-c++ gcc-gfortran \
63+
git bzip2 file which make patch \
64+
bison byacc flex flex-devel libcurl-devel \
65+
perl perl-Env perl-Digest-MD5 \
66+
libX11-devel libXext-devel libXpm-devel libXt-devel \
67+
python python-pip \
68+
environment-modules \
69+
&& yum clean all
70+
71+
# Install extra python modules used by the STAR software
72+
RUN pip install pyparsing
73+
74+
ENV MODULEPATH=/opt/linux-scientific7-x86_64
4575

4676
ENV STAR=/star-sw
4777
ENV USE_64BITS=1
4878
ENV CERN=/cern
4979
ENV CERN_LEVEL=pro
5080
ENV CERN_ROOT=$CERN/$CERN_LEVEL
51-
ENV OPTSTAR=/opt/view
52-
ENV STAR_CVS_REF=YYY
53-
ENV STAR_HOST_SYS=sl88_gcc789
81+
ENV OPTSTAR=/opt/software
82+
ENV STAR_HOST_SYS=sl79_gcc485
5483
ENV NODEBUG=yes
5584
ENV STAR_LIB=$STAR/.${STAR_HOST_SYS}/LIB
5685
ENV STAR_BIN=$STAR/.${STAR_HOST_SYS}/BIN
57-
ENV STAR_SCRIPTS=$STAR/scripts
58-
ENV STAR_CGI=$STAR/cgi
59-
ENV STAR_MGR=$STAR/mgr
60-
ENV STAR_PAMS=$STAR/pams
61-
ENV STAR_LEVEL=$STAR_CVS_REF
62-
ENV STAR_VERSION=$STAR_CVS_REF
6386
ENV STAR_SYS=x8664_sl7
64-
ENV PATH=$CERN_ROOT/bin:$STAR_BIN:$STAR_MGR:$PATH
87+
ENV PATH=$CERN_ROOT/bin:$STAR_BIN:$STAR/mgr:$PATH
6588
ENV LD_LIBRARY_PATH=$STAR_LIB:$LD_LIBRARY_PATH
66-
ENV LIBPATH+=":/lib64:/lib"
89+
ENV LIBPATH+=:/lib64:/lib
90+
91+
ENV MYSQL=/opt/software/linux-scientific7-x86_64/gcc-4.8.5/mysql-5.7.27-pfyt3fwtkubcc5eazmoqfick3lgp67mf
92+
ENV LIBXML2_DIR=/opt/software/linux-scientific7-x86_64/gcc-4.8.5/libxml2-2.9.10-4lxsmpa57bm3xs2cs3xapk3qccxflkfl
93+
ENV FASTJET_DIR=/opt/software/linux-scientific7-x86_64/gcc-4.8.5/fastjet-3.3.3-xj22tput5pd5atejy4igsrtgdtygi74u
94+
ENV GSL_DIR=/opt/software/linux-scientific7-x86_64/gcc-4.8.5/gsl-2.6-ao26bt7pm6xxywo2q7dcmhhg2lp2inx7
6795

6896
# Dummy directories checked by cons
6997
RUN mkdir $OPTSTAR/lib && mkdir $OPTSTAR/include
98+
RUN ln -s $MYSQL/include /usr/include/mysql
99+
100+
101+
FROM base-stage AS build-stage
70102

71103
COPY . /star-sw
72104

@@ -88,16 +120,23 @@ diff --git a/asps/rexe/Conscript b/asps/rexe/Conscript \n\
88120
if ($LIBPATH) { $LIBPATH .= $main::PATH_SEPARATOR; }\n' \
89121
&& patch -p1 < root4star_cons.patch
90122

91-
RUN source star-spack/setup.sh && spack env activate star-env-root5 \
92-
&& export MYSQL=`spack location --install-dir mysql` \
93-
&& export LIBXML2_DIR=`spack location --install-dir libxml2` \
94-
&& cd /usr/include && ln -s $MYSQL/include mysql \
123+
RUN source /etc/profile \
95124
&& cd /star-sw \
96-
&& cons +asps/staf \
97-
&& cons +asps/Simulation/agetof \
98125
&& cons +StarVMC/Geometry \
99-
&& cons %GeoTestMaker %Kinematics %OnlTools %StAngleCorrMaker %StDaqClfMaker \
100-
%StEEmcPool %StEbye2ptMaker %StEbyePool %StEbyeScaTagsMaker %StFgtPool \
101-
%StFtpcV0Maker %StHighptPool %StJetFinder %StRoot/Stv %StRoot/StvMaker \
102-
%StRoot/StvSeed %StShadowMaker %StSpinMaker %StStrangePool \
103-
%pams/sim/g2r %StRoot/StHbtMaker
126+
&& cons %GeoTestMaker %Kinematics %OnlTools %StEEmcPool %StFgtPool %StHighptPool %StJetFinder \
127+
%StRoot/Stv %StRoot/StvMaker %StRoot/StvSeed \
128+
%StShadowMaker %StSpinMaker %StStrangePool %pams/sim/g2r %StRoot/StHbtMaker \
129+
&& find /star-sw/.$STAR_HOST_SYS -name *.o -exec rm '{}' \;
130+
131+
RUN install /star-sw/StRoot/macros/.rootrc .
132+
133+
# One might expect the single ENTRYPOINT command below to work but for some
134+
# reason it chokes on a complex command such as
135+
#
136+
# docker run image root4star -b 'bfc.C(10, "opt1", "infile.root")'
137+
#
138+
#ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l", "-c"]
139+
140+
RUN install -m 755 <(echo $'#!/bin/sh\n . /etc/profile; exec "$@"') entrypoint.sh
141+
ENTRYPOINT ["./entrypoint.sh"]
142+
CMD ["/bin/bash"]

tests/executest.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env python
2+
#
3+
# Use this script to read the `test/joblist.json` file with job information for
4+
# STAR tests. It prints to the standard output the description and/or the
5+
# actual test command for the job specified by its id
6+
#
7+
# Usage:
8+
#
9+
# executest.py -d 45
10+
# pp 200GeV, pythia minbias, year 2009
11+
#
12+
# executest.py -c 45
13+
# root4star -b -q -l 'bfc.C(10, "tpcRS,TpxClu,fss,y2009a,Idst,IAna,l0,tpcI,ftpc,Tree,logger,ITTF,Sti,genvtx,NoSsdIt,NoSvtIt,MakeEvent,bbcSim,btofsim,vpdSim,tags,emcY2,EEfs,evout,IdTruth,geantout,big,fzin,MiniMcMk,clearmem", "/star-test-data/quick/rcf9993_01_1000evts.fzd")'
14+
15+
import argparse
16+
import json
17+
import os
18+
from collections import namedtuple
19+
20+
JobInfo = namedtuple('JobInfo', ['jobid', 'descr', 'chopts', 'inpfile', 'inppath', 'outpath', 'nevents'])
21+
22+
def _json_object_hook(d):
23+
return namedtuple('JobInfo', d.keys())(*d.values())
24+
25+
26+
if __name__ == "__main__":
27+
28+
parser = argparse.ArgumentParser(description="Form or execute test job")
29+
parser.add_argument("jobid")
30+
parser.add_argument("-d", "--description", default=False, action="store_true", help="Print job description")
31+
parser.add_argument("-c", "--command", default=False, action="store_true", help="Print command")
32+
args = parser.parse_args()
33+
34+
joblist_file = os.path.join(os.path.dirname(__file__), "joblist.json")
35+
36+
with open(joblist_file, 'r') as jlfile:
37+
joblist = json.load(jlfile, object_hook=_json_object_hook)
38+
39+
for job in joblist:
40+
if job.jobid != args.jobid: continue
41+
if args.description: print("{descr}".format(**job._asdict()))
42+
if args.command: print("root4star -b -q -l \'bfc.C({nevents}, \"{chopts}\", \"{inppath}/{inpfile}\")\'".format(**job._asdict()))

0 commit comments

Comments
 (0)