Skip to content

Commit 759c2e4

Browse files
committed
Squashed commit of pr/backport_tpc_sim
1 parent 267b782 commit 759c2e4

21 files changed

Lines changed: 565 additions & 814 deletions

File tree

.github/workflows/build-containers.yml

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,59 @@ on:
99
- '*'
1010

1111
jobs:
12-
ROOT5:
12+
build:
1313
if: github.repository_owner == 'star-bnl'
1414
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
starenv: [root5]
18+
compiler: [gcc485]
19+
env:
20+
STARENV: ${{ matrix.starenv }}-${{ matrix.compiler }}
1521
steps:
1622
- name: Get branch name
1723
id: branch-name
18-
uses: tj-actions/branch-names@v4.8
24+
uses: tj-actions/branch-names@v6
1925

2026
- name: Set up Docker Buildx
21-
uses: docker/setup-buildx-action@v1
27+
uses: docker/setup-buildx-action@v2
2228

2329
- name: Login to GitHub Container Registry
24-
uses: docker/login-action@v1
30+
uses: docker/login-action@v2
2531
with:
2632
registry: ghcr.io
2733
username: ${{ github.actor }}
2834
password: ${{ secrets.GITHUB_TOKEN }}
2935

30-
- name: Rebuild up to base-stage
31-
uses: docker/build-push-action@v2
36+
- name: Build a release container
37+
uses: docker/build-push-action@v3
3238
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 }}
39+
build-args: |
40+
starenv=${{ matrix.starenv }}
41+
compiler=${{ matrix.compiler }}
42+
load: true
43+
tags: ghcr.io/${{ github.repository_owner }}/star-sw:${{ steps.branch-name.outputs.current_branch }}-${{ env.STARENV }}
44+
45+
- name: Push container image
46+
run: |
47+
docker push ghcr.io/${{ github.repository_owner }}/star-sw:${{ steps.branch-name.outputs.current_branch }}-${{ env.STARENV }}
48+
49+
- name: Create latest tag for default branch
50+
if: ${{ steps.branch-name.outputs.is_default == 'true' && env.STARENV == 'root5-gcc485' }}
51+
run: |
52+
docker tag ghcr.io/${{ github.repository_owner }}/star-sw:${{ steps.branch-name.outputs.current_branch }}-${{ env.STARENV }} ghcr.io/${{ github.repository_owner }}/star-sw:latest
53+
docker push ghcr.io/${{ github.repository_owner }}/star-sw:latest
54+
55+
- name: Create latest tag for SL* branches
56+
if: ${{ steps.branch-name.outputs.is_default == 'false' && env.STARENV == 'root5-gcc485' }}
57+
run: |
58+
docker tag ghcr.io/${{ github.repository_owner }}/star-sw:${{ steps.branch-name.outputs.current_branch }}-${{ env.STARENV }} ghcr.io/${{ github.repository_owner }}/star-sw:${{ steps.branch-name.outputs.current_branch }}
59+
docker push ghcr.io/${{ github.repository_owner }}/star-sw:${{ steps.branch-name.outputs.current_branch }}
60+
61+
build-cleanup:
62+
runs-on: ubuntu-latest
63+
needs: build
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v3
67+
- run: .github/workflows/delete_untagged.py ${{ secrets.STAR_BNL_STAR_SW_TOKEN }}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Build Pull Request
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- '.github/**'
7+
- 'docs/**'
8+
- '!.github/workflows/**'
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
starenv: [root5]
20+
compiler: [gcc485]
21+
env:
22+
STARENV: ${{ matrix.starenv }}-${{ matrix.compiler }}
23+
steps:
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v2
26+
with:
27+
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=10000000
28+
29+
- name: Build with Docker
30+
uses: docker/build-push-action@v3
31+
with:
32+
build-args: |
33+
starenv=${{ matrix.starenv }}
34+
compiler=${{ matrix.compiler }}
35+
tags: ghcr.io/star-bnl/star-sw-${{ env.STARENV }}
36+
outputs: type=docker,dest=/tmp/star-sw-${{ env.STARENV }}.tar
37+
38+
- name: Save built image for test jobs
39+
uses: actions/upload-artifact@v3
40+
with:
41+
name: star-sw-${{ env.STARENV }}
42+
path: /tmp/star-sw-${{ env.STARENV }}.tar
43+
44+
ROOT5_test:
45+
runs-on: ubuntu-latest
46+
needs: build
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
test_id: [10, 11, 22, 23, 24, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 60, 76, 77, 78, 90, 91, 92, 102, 103, 119, 120, 121]
51+
compiler: [gcc485]
52+
env:
53+
STARENV: root5-${{ matrix.compiler }}
54+
steps:
55+
- name: Download artifact
56+
uses: actions/download-artifact@v3
57+
with:
58+
name: star-sw-${{ env.STARENV }}
59+
path: /tmp
60+
61+
- run: docker load --input /tmp/star-sw-${{ env.STARENV }}.tar
62+
- run: docker run --name star-test-data --volume /star ghcr.io/star-bnl/star-test-data:v6
63+
- run: |
64+
TEST_CMD=$(docker run --rm ghcr.io/star-bnl/star-sw-${{ env.STARENV }} tests/executest.py -c ${{ matrix.test_id }})
65+
# Workaround https://sft.its.cern.ch/jira/browse/ROOT-7660 in ROOT 5 by checking the output log
66+
docker run --volumes-from star-test-data ghcr.io/star-bnl/star-sw-${{ env.STARENV }} \
67+
sh -c "set -e; MALLOC_CHECK_=3 $TEST_CMD 2>&1 | tee log; grep 'Run completed' log"
68+
69+
ROOT5_test_doEvents:
70+
runs-on: ubuntu-latest
71+
needs: build
72+
strategy:
73+
fail-fast: false
74+
matrix:
75+
test_id: [121, 122]
76+
compiler: [gcc485]
77+
env:
78+
STARENV: root5-${{ matrix.compiler }}
79+
steps:
80+
- name: Download artifact
81+
uses: actions/download-artifact@v3
82+
with:
83+
name: star-sw-${{ env.STARENV }}
84+
path: /tmp
85+
86+
- run: docker load --input /tmp/star-sw-${{ env.STARENV }}.tar
87+
- run: docker run --name star-test-data --volume /star ghcr.io/star-bnl/star-test-data:v6
88+
- run: |
89+
TEST_FILE=$(echo "$(docker run --rm ghcr.io/star-bnl/star-sw-${{ env.STARENV }} tests/executest.py ${{ matrix.test_id }} -a fullpath)" | sed -E 's/\.(daq|fzd)$/.event.root/')
90+
TEST_CMD="root4star -b -q -l 'StRoot/macros/analysis/doEvents.C(100, \"$TEST_FILE\")'"
91+
docker run --volumes-from star-test-data ghcr.io/star-bnl/star-sw-${{ env.STARENV }} \
92+
sh -c "set -e; $TEST_CMD 2>&1 | tee log; grep '<StIOMaker::Finish> IO:' log"
93+
94+
ROOT5_test_find_vertex:
95+
runs-on: ubuntu-latest
96+
needs: build
97+
strategy:
98+
fail-fast: false
99+
matrix:
100+
test_id: [102, 121, 122]
101+
compiler: [gcc485]
102+
env:
103+
STARENV: root5-${{ matrix.compiler }}
104+
steps:
105+
- name: Download artifact
106+
uses: actions/download-artifact@v3
107+
with:
108+
name: star-sw-${{ env.STARENV }}
109+
path: /tmp
110+
111+
- run: docker load --input /tmp/star-sw-${{ env.STARENV }}.tar
112+
- run: docker run --name star-test-data --volume /star ghcr.io/star-bnl/star-test-data:v6
113+
- run: |
114+
TEST_FILE=$(echo "$(docker run --rm ghcr.io/star-bnl/star-sw-${{ env.STARENV }} tests/executest.py ${{ matrix.test_id }} -a fullpath)" | sed -E 's/\.(daq|fzd)$/.event.root/')
115+
TEST_CMD="root4star -b -q -l 'StRoot/macros/analysis/find_vertex.C(\"$TEST_FILE\")'"
116+
docker run --volumes-from star-test-data ghcr.io/star-bnl/star-sw-${{ env.STARENV }} \
117+
sh -c "set -e; $TEST_CMD 2>&1 | tee log; grep '<StIOMaker::Finish> StIO:' log"

.github/workflows/ci-build.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env python3
2+
3+
import argparse
4+
import json
5+
import requests
6+
import types
7+
8+
parser = argparse.ArgumentParser()
9+
parser.add_argument("token", help="GitHub token")
10+
args = parser.parse_args()
11+
12+
domain = "api.github.com"
13+
org = "star-bnl"
14+
package_type = "container"
15+
package_name = "star-sw"
16+
17+
api_url = f"https://{domain}/orgs/{org}/packages/{package_type}/{package_name}/versions"
18+
19+
respjson = requests.get(api_url, auth=("token", args.token))
20+
entries = json.loads(respjson.text, object_hook=lambda d: types.SimpleNamespace(**d))
21+
22+
for e in entries:
23+
if not e.metadata.container.tags:
24+
response = requests.delete(api_url + f"/{e.id}", auth=("token", args.token))
25+
print("delete", e.id, e.html_url, e.name, response.url, response.status_code)

Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# syntax=docker/dockerfile:latest
2+
3+
ARG starenv=root5
4+
5+
# Pick one from [gcc485, gcc11]
6+
ARG compiler=gcc485
7+
8+
FROM ghcr.io/star-bnl/star-spack:v0.2.3-${starenv}-${compiler}
9+
10+
ARG compiler
11+
12+
ENV NODEBUG=yes
13+
ENV STAR=/star-sw
14+
ENV STAR_LIB=$STAR/.${STAR_HOST_SYS}/LIB
15+
ENV STAR_BIN=$STAR/.${STAR_HOST_SYS}/BIN
16+
ENV STAR_SYS=x8664_sl7
17+
ENV PATH=$STAR_BIN:$STAR/mgr:$PATH
18+
ENV LD_LIBRARY_PATH=$STAR_LIB:$LD_LIBRARY_PATH
19+
ENV ROOT_INCLUDE_PATH=$STAR/.${STAR_HOST_SYS}/include
20+
21+
WORKDIR ${STAR}
22+
COPY . ${STAR}
23+
24+
SHELL ["/bin/bash", "-l", "-c"]
25+
26+
RUN <<EOF
27+
SKIP_DIRS="pams/sim/g2r OnlTools StRoot/StShadowMaker" cons
28+
find .$STAR_HOST_SYS -name *.o -exec rm '{}' \;
29+
EOF
30+
31+
COPY --chmod=0755 <<-"EOF" /opt/entrypoint.sh
32+
#!/bin/bash -l
33+
set -e
34+
install $STAR/StRoot/macros/.rootrc .
35+
exec "$@"
36+
EOF
37+
38+
ENTRYPOINT ["/opt/entrypoint.sh"]
39+
CMD ["/bin/bash"]

StRoot/StDaqLib/SC/SC_Reader.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <assert.h>
1111
#include <math.h>
12+
#include <ctime>
1213

1314
using namespace OLDEVP;
1415

@@ -97,8 +98,8 @@ SC_Reader::SC_Reader(EventReader *er) {
9798
//Keep BBCBkg scalers flipped as theyStRoot/StDaqLib/SC/SC_Reader.cxx were historically before 2009
9899
//Note that new DAQ reader leads to UTime = 0, or tm_year=70 (1970)
99100
//but new DAQ reader only gets used for 2009+ anyhow
100-
unsigned int UTime = er->getEventInfo().UnixTime;
101-
struct tm *time=gmtime((time_t*) &UTime);
101+
std::time_t utime = er->getEventInfo().UnixTime;
102+
std::tm *time = gmtime(&utime);
102103
flipBBCBkg = (time->tm_year > 95 && time->tm_year < 109 ? 1 : 0) ;
103104

104105
// LDate = (((1900+time->tm_year)*100 + 1 + time->tm_mon)*100 + time->tm_mday)*100;

StRoot/StDaqLib/SSD/SSD_Reader.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <assert.h>
55
#include <math.h>
6+
#include <ctime>
67

78
static unsigned short log8to10_table[256] = {
89
0, 1, 2, 3, 4, 5, 6, 7,
@@ -118,8 +119,8 @@ SSD_Reader::SSD_Reader(EventReader *er) {
118119
datap=er->getDATAP();
119120
if (datap) {
120121

121-
unsigned int UTime = er->getEventInfo().UnixTime;
122-
struct tm *time=gmtime((time_t*) &UTime);
122+
std::time_t utime = er->getEventInfo().UnixTime;
123+
std::tm *time = gmtime(&utime);
123124

124125
//LDate = (((1900+time->tm_year)*100 + 1 + time->tm_mon)*100 + time->tm_mday)*100;
125126
//LDate = yyyymmdd

StRoot/StEEmcUtil/EEfeeRaw/RootWrapper.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <cstdlib>
22
#include <cstdio>
3+
#include <ctime>
34

45
#include "TROOT.h"
56
#include "TFile.h"
@@ -57,7 +58,8 @@ eemcfeerootopen_(long& run, long& runtime, char *chfile, int &nAuto, int len)
5758
char *idt = strchr(basefile,'.'); *idt = 0x00; // locate first dot
5859
}
5960
sprintf(filename,"%s/%s.ez.root",rootdir,basefile);
60-
sprintf(comment,"run:%05ld, time:%s ",run,ctime((time_t *)&runtime));
61+
std::time_t utime = runtime;
62+
sprintf(comment,"run:%05ld, time:%s ",run,ctime(&utime));
6163

6264
file = new TFile(filename,"RECREATE");
6365
tree = new TTree("ezstar","A tree with FEE events");

StRoot/StFgtPool/StFgtAlignmentMaker/StFgtAlignmentMaker.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include <stdio.h>
1212
#include <math.h>
13-
#include <curses.h>
1413

1514
#include "StFgtAlignmentMaker.h"
1615
#include "StEventTypes.h"

StRoot/St_trg_Maker/year2003.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ void St_trg_Maker::Emc2003(St_dst_TrgDet *dst1) {
101101
//pp_dsm_to_patch[7] for after 01-Dec-2001, AA_dsm_to_patch[5] for before that date
102102
EventReader *er=fVictorPrelim->getEventReader();
103103
EventInfo info=er->getEventInfo();
104-
unsigned int UnixTime=info.UnixTime;
105-
struct tm *time=gmtime((time_t*) &UnixTime);
104+
std::time_t utime = info.UnixTime;
105+
std::tm *time = gmtime(&utime);
106106
int year=1900+time->tm_year;
107107
int month=1+time->tm_mon;
108108
int day=time->tm_mday;

0 commit comments

Comments
 (0)