Skip to content

Commit c10719f

Browse files
committed
Initialize Geant4 data vars before packaging
1 parent b53ae13 commit c10719f

3 files changed

Lines changed: 113 additions & 0 deletions

File tree

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Test GEMC binary tarballs in minimal OS images.
2+
name: Test GEMC Binary Tarballs
3+
4+
permissions:
5+
contents: read
6+
7+
concurrency:
8+
group: gemc-binary-tarballs-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
on:
12+
schedule:
13+
# nightly, after the GEMC dev release window
14+
- cron: '44 5 * * *'
15+
workflow_dispatch:
16+
17+
jobs:
18+
discover:
19+
name: Create Job Matrix
20+
runs-on: ubuntu-latest
21+
outputs:
22+
matrix_build: ${{ steps.scan.outputs.matrix_build }}
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v6
26+
- id: scan
27+
name: Build matrix
28+
run: ./ci/distros_tags.sh
29+
30+
test-tarball:
31+
name: ${{ matrix.image }}:${{ matrix.image_tag }} ${{ matrix.arch }}
32+
needs: [ discover ]
33+
runs-on: ${{ matrix.runner }}
34+
strategy:
35+
fail-fast: false
36+
matrix: ${{ fromJSON(needs.discover.outputs.matrix_build) }}
37+
env:
38+
TEST_IMAGE: gemc-binary-test:${{ matrix.image }}-${{ matrix.image_tag }}-${{ matrix.arch }}
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v6
42+
43+
- name: Generate minimal package Dockerfile
44+
shell: bash
45+
run: |
46+
python3 - "${{ matrix.image }}" "${{ matrix.image_tag }}" > Dockerfile.gemc-binary-test <<'PY'
47+
import sys
48+
49+
sys.path.insert(0, "ci")
50+
from functions import map_family
51+
from packages import packages_install_command
52+
53+
image = sys.argv[1]
54+
tag = sys.argv[2]
55+
family = map_family(image)
56+
57+
print(f"FROM {image}:{tag}")
58+
print('SHELL ["/bin/bash", "-c"]')
59+
60+
# Repo/bootstrap steps needed for package installation only. This
61+
# deliberately skips g4install's Geant4/CLHEP/Xerces/noVNC builds.
62+
if family == "archlinux":
63+
print("RUN pacman-key --init && pacman-key --populate")
64+
print("RUN pacman -Sy --noconfirm archlinux-keyring")
65+
elif image == "almalinux":
66+
print("RUN dnf install -y 'dnf-command(config-manager)' \\")
67+
print(" && dnf config-manager --set-enabled crb \\")
68+
print(" && dnf install -y almalinux-release-synergy")
69+
70+
print(packages_install_command(image, tag))
71+
PY
72+
cat Dockerfile.gemc-binary-test
73+
74+
- name: Build minimal package image
75+
shell: bash
76+
run: |
77+
docker build \
78+
--pull \
79+
--platform "${{ matrix.platform }}" \
80+
-f Dockerfile.gemc-binary-test \
81+
-t "${TEST_IMAGE}" \
82+
.
83+
84+
- name: Test GEMC binary tarball installation
85+
shell: bash
86+
run: |
87+
archive="gemc-${{ matrix.gemc_tag }}-geant4-${{ matrix.geant4_tag }}-${{ matrix.image }}-${{ matrix.image_tag }}-${{ matrix.arch }}.tar.gz"
88+
url="https://github.com/gemc/src/releases/download/${{ matrix.gemc_tag }}/${archive}"
89+
90+
docker run --rm \
91+
--platform "${{ matrix.platform }}" \
92+
-e GEMC_TARBALL_URL="${url}" \
93+
-e GEMC_TARBALL_ARCHIVE="${archive}" \
94+
"${TEST_IMAGE}" \
95+
bash -lc '
96+
set -euo pipefail
97+
gemc_home=/path/to/gemc
98+
mkdir -p "$gemc_home"
99+
cd "$gemc_home"
100+
curl -L -o "$GEMC_TARBALL_ARCHIVE" "$GEMC_TARBALL_URL"
101+
tar -xzf "$GEMC_TARBALL_ARCHIVE" -C "$gemc_home" --strip-components=1
102+
./install_geant4_data.sh
103+
source /path/to/gemc/gemc.env
104+
gemc -v
105+
test_gdynamic_plugin_load
106+
test_gdata_event_verbose
107+
'

ci/dockerfile_creator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def package_install(geant4_version: str, gemc_version: str, image: str, image_ta
6666
commands += f'RUN cd /root/src \\\n'
6767
commands += f" && DOCKER_ENTRYPOINT_SOURCE_ONLY=1 . {remote_entrypoint()} \\\n"
6868
commands += f' && module load geant4/{geant4_version} \\\n'
69+
commands += f' && eval "$(geant4-config --sh)" \\\n'
6970
commands += f' && GEANT4_VERSION={geant4_version} GEMC_PACKAGE_VERSION={gemc_version} \\\n'
7071
commands += f' ./ci/package_install.sh "${{SIM_HOME}}/gemc/dev" /root/src/dist "{package_name}" \n'
7172
return commands

ci/package_install.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ archive_name_from_data_dir() {
9292
}
9393

9494
geant4_dataset_records=()
95+
96+
if command -v geant4-config >/dev/null 2>&1; then
97+
eval "$(geant4-config --sh)"
98+
fi
99+
95100
while IFS='=' read -r env_name env_path; do
96101
[[ -n "${env_name}" && -n "${env_path}" ]] || continue
97102
if [[ ! -d "${env_path}" ]]; then

0 commit comments

Comments
 (0)