Skip to content

Commit 090af99

Browse files
authored
Merge pull request #307 from VERITAS-Observatory/build-action
Fix github actions for compilation
2 parents 37eb5e6 + 2fae302 commit 090af99

File tree

5 files changed

+103
-56
lines changed

5 files changed

+103
-56
lines changed

.github/workflows/ci-buildmatrix-cpp11.yml

Lines changed: 75 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,88 @@ name: cpp11-buildmatrix
33

44
# Controls when the workflow will run
55
on:
6-
# pull_request:
7-
# branches: [main, master]
6+
pull_request:
87
workflow_dispatch:
98

109
jobs:
11-
build:
12-
strategy:
13-
matrix:
14-
os: [ubuntu-latest]
15-
root:
16-
- "rootproject/root:6.24.06-centos7"
17-
runs-on: ${{ matrix.os }}
18-
container: ${{ matrix.root }}
19-
10+
# Job 1: run on Ubuntu host (no container) to execute Node20-based actions safely
11+
source:
12+
runs-on: ubuntu-latest
2013
steps:
21-
- uses: actions/checkout@v4
14+
- name: Checkout source
15+
uses: actions/checkout@v4
2216

23-
- name: vbf
17+
- name: Create source tarball
2418
run: |
25-
curl https://syncandshare.desy.de/index.php/s/${{ secrets.VBFcpp11 }}/download > VBF.tar.gz
26-
mkdir VBF && tar -xzf VBF.tar.gz -C VBF --strip-components=1
27-
cd VBF && ./configure --prefix=$(echo $GITHUB_WORKSPACE)/VBF
28-
make
29-
make install
19+
set -euo pipefail
20+
# Use git archive to avoid including .git directory and prevent 'file changed as we read it' warnings
21+
git archive --format=tar HEAD | gzip > src.tgz
22+
23+
- name: Upload source artifact
24+
# v4 okay here (runs on ubuntu host with modern glibc)
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: src
28+
path: src.tgz
29+
30+
# Job 2: build inside CentOS7 ROOT container avoiding Node20 (use only Node16-compatible actions)
31+
build:
32+
needs: source
33+
runs-on: ubuntu-latest
34+
env:
35+
ROOT_IMAGE: rootproject/root:6.24.06-centos7
36+
steps:
37+
- name: Download source artifact
38+
uses: actions/download-artifact@v4
39+
with:
40+
name: src
3041

31-
- name: sofa
42+
- name: Extract source
43+
run: tar -xzf src.tgz
44+
45+
- name: Build inside ROOT CentOS7 container
46+
env:
47+
VBF_TOKEN: ${{ secrets.VBFcpp11 }}
48+
SOFA20231011: ${{ secrets.SOFA20231011 }}
3249
run: |
33-
curl https://syncandshare.desy.de/index.php/s/${{ secrets.SOFA }}/download > sofa/sofa.tar.gz
34-
./install_sofa.sh
50+
set -euo pipefail
51+
echo "Using ROOT image: $ROOT_IMAGE"
52+
docker run --rm \
53+
-e VBF_TOKEN="$VBF_TOKEN" \
54+
-e SOFA20231011="$SOFA20231011" \
55+
-v "$PWD:/workspace" \
56+
-w /workspace \
57+
"$ROOT_IMAGE" /bin/bash -c '
58+
set -euo pipefail
59+
echo "ROOT version: $(root-config --version)"
60+
# Build VBF
61+
curl -L "https://syncandshare.desy.de/index.php/s/${VBF_TOKEN}/download" -o VBF.tar.gz
62+
mkdir -p VBF && tar -xzf VBF.tar.gz -C VBF --strip-components=1
63+
pushd VBF
64+
./configure --prefix=/workspace/VBF
65+
make -j4
66+
make install
67+
popd
68+
# Install SOFA
69+
mkdir -p sofa
70+
curl -L "https://syncandshare.desy.de/index.php/s/${SOFA20231011}/download" -o sofa/sofa.tar.gz
71+
./install_sofa.sh
72+
# Build EventDisplay
73+
export EVNDISPSYS=/workspace
74+
export VBFSYS=/workspace/VBF
75+
export SOFASYS=/sofa
76+
export LD_LIBRARY_PATH=$EVNDISPSYS/obj:$EVNDISPSYS/lib:$VBFSYS/lib:${LD_LIBRARY_PATH:-}
77+
make -j4 VTS
78+
'
3579
36-
- name: eventdisplay
80+
- name: Archive build outputs
81+
if: always()
3782
run: |
38-
root-config --version
39-
export EVNDISPSYS=$(echo $GITHUB_WORKSPACE)
40-
export VBFSYS=$(echo $GITHUB_WORKSPACE)/VBF
41-
export LD_LIBRARY_PATH="${EVNDISPSYS}/obj:${EVNDISPSYS}/lib:${LD_LIBRARY_PATH}"
42-
export LD_LIBRARY_PATH="${VBFSYS}/lib:${LD_LIBRARY_PATH}"
43-
export SOFASYS=/sofa
44-
make -j 4 VTS
83+
tar -czf build-artifacts.tgz VBF obj lib || true
84+
85+
- name: Upload build artifacts
86+
if: always()
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: build-artifacts
90+
path: build-artifacts.tgz

.github/workflows/ci-buildmatrix-cpp17.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ jobs:
2727

2828
- name: vbf
2929
run: |
30-
curl https://syncandshare.desy.de/index.php/s/${{ secrets.VBFcpp17 }}/download > VBF.tar.gz
30+
curl -L https://syncandshare.desy.de/index.php/s/${{ secrets.VBFcpp17 }}/download -o VBF.tar.gz
3131
mkdir VBF && tar -xzf VBF.tar.gz -C VBF --strip-components=1
3232
cd VBF && ./configure --prefix=$(echo $GITHUB_WORKSPACE)/VBF
3333
make
3434
make install
3535
3636
- name: sofa
3737
run: |
38-
curl https://syncandshare.desy.de/index.php/s/${{ secrets.SOFA20231011 }}/download > sofa/sofa.tar.gz
38+
curl -L https://syncandshare.desy.de/index.php/s/${{ secrets.SOFA20231011 }}/download -o sofa/sofa.tar.gz
3939
./install_sofa.sh
4040
4141
- name: eventdisplay

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ repos:
1212
args: ["--line-length=100"]
1313
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html?highlight=other%20tools#flake8
1414
- repo: https://github.com/PyCQA/flake8
15-
rev: 7.2.0
15+
rev: 7.3.0
1616
hooks:
1717
- id: flake8
1818
args: ["--max-line-length=100", "--extend-ignore=E203,E712"]
1919
# https://github.com/pre-commit/pre-commit-hooks
2020
- repo: https://github.com/pre-commit/pre-commit-hooks
21-
rev: v5.0.0
21+
rev: v6.0.0
2222
hooks:
2323
- id: trailing-whitespace
2424
- id: end-of-file-fixer

dockerfiles/Dockerfile

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,43 @@ ARG NUM_CORES=4
77
RUN dnf install -y diffutils && dnf clean all
88

99
# VBF
10-
ADD https://syncandshare.desy.de/index.php/s/NrnZNKfT8WxFpcn/download /workdir/VBF-$VBF_VERSION.tar.gz
10+
ADD https://syncandshare.desy.de/index.php/s/7i29qcgzgS3zpEk/download /workdir/VBF-$VBF_VERSION.tar.gz
1111
WORKDIR /workdir/
1212
RUN mkdir VBF && tar -xzf VBF-$VBF_VERSION.tar.gz -C VBF --strip-components=1 && \
1313
cd VBF && \
1414
./configure --prefix=/opt/VBF && \
1515
make && make install && make clean
16-
ENV VBFSYS /opt/VBF
17-
ENV EVNDISPSYS /opt/EventDisplay_v4
18-
ENV SOFASYS "${EVNDISPSYS}/sofa"
19-
ENV PATH ${VBFSYS}/bin:${PATH}
20-
ENV LD_LIBRARY_PATH "${EVNDISPSYS}/obj:${EVNDISPSYS}/lib:${ROOTSYS}/lib:${VBFSYS}/lib:${LD_LIBRARY_PATH}"
16+
17+
# Environment (build stage)
18+
ENV VBFSYS=/opt/VBF \
19+
EVNDISPSYS=/opt/EventDisplay_v4 \
20+
SOFASYS=/opt/EventDisplay_v4/sofa \
21+
PATH=/opt/VBF/bin:$PATH \
22+
LD_LIBRARY_PATH=/opt/EventDisplay_v4/obj:/opt/EventDisplay_v4/lib:$ROOTSYS/lib:/opt/VBF/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
2123

2224
WORKDIR /opt/
2325
RUN BUILD_BRANCH=$(echo ${BUILD_BRANCH} | sed 's#refs/tags/##') && \
2426
git clone -b ${BUILD_BRANCH} https://github.com/VERITAS-Observatory/EventDisplay_v4.git --depth 1
2527
ADD https://syncandshare.desy.de/index.php/s/RamRFYJtZjDGsfL/download ${SOFASYS}/sofa.tar.gz
2628

27-
RUN cd ${EVNDISPSYS} \
28-
&& ./install_sofa.sh && make -j$NUM_CORES VTS
29+
WORKDIR /opt/EventDisplay_v4
30+
RUN ./install_sofa.sh && make -j"${NUM_CORES}" VTS
2931

3032
FROM rootproject/root:${ROOT_VERSION}
3133
WORKDIR /opt/
3234
COPY --from=build /opt/VBF /opt/VBF
3335
COPY --from=build /opt/EventDisplay_v4 /opt/EventDisplay_v4
3436

35-
LABEL maintainer.name="Eventdisplay Team"
36-
LABEL maintainer.email="gernot.maier@desy.de"
37-
38-
ENV EVNDISPSYS /opt/EventDisplay_v4
39-
ENV VBFSYS /opt/VBF
40-
ENV LD_LIBRARY_PATH "${VBFSYS}/lib/:${LD_LIBRARY_PATH}"
41-
ENV PATH ${VBFSYS}/bin:${PATH}
42-
ENV LD_LIBRARY_PATH "${EVNDISPSYS}/obj:${EVNDISPSYS}/lib:${ROOTSYS}/lib:${VBFSYS}/lib:${LD_LIBRARY_PATH}"
43-
ENV SOFASYS "${EVNDISPSYS}/sofa"
44-
45-
# data and user data and log directory (to be mounted)
46-
ENV VERITAS_DATA_DIR /opt/data
47-
ENV VERITAS_LOG_DIR /opt/data
48-
ENV VERITAS_USER_DATA_DIR /opt/user_data
49-
ENV VERITAS_USER_LOG_DIR /opt/user_data
37+
LABEL maintainer.name="Eventdisplay Team" \
38+
maintainer.email="gernot.maier@desy.de"
39+
40+
# Environment (runtime stage)
41+
ENV EVNDISPSYS=/opt/EventDisplay_v4 \
42+
VBFSYS=/opt/VBF \
43+
SOFASYS=/opt/EventDisplay_v4/sofa \
44+
PATH=/opt/VBF/bin:$PATH \
45+
LD_LIBRARY_PATH=/opt/EventDisplay_v4/obj:/opt/EventDisplay_v4/lib:$ROOTSYS/lib:/opt/VBF/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} \
46+
VERITAS_DATA_DIR=/opt/data \
47+
VERITAS_LOG_DIR=/opt/data \
48+
VERITAS_USER_DATA_DIR=/opt/user_data \
49+
VERITAS_USER_LOG_DIR=/opt/user_data

docs/changes/307.maintenance.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix github action worklows to compile Eventdisplay. Add cpp11 workflow.

0 commit comments

Comments
 (0)