Skip to content

Commit ab33920

Browse files
committed
added workflow binary_tarballs.yml
1 parent 2ffc46a commit ab33920

2 files changed

Lines changed: 154 additions & 9 deletions

File tree

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Upload and test GEMC binary tarballs.
2+
name: Binary Tarballs
3+
4+
permissions:
5+
actions: read
6+
contents: write
7+
8+
concurrency:
9+
group: gemc-binary-tarballs-${{ github.event.workflow_run.id || github.ref }}
10+
cancel-in-progress: true
11+
12+
on:
13+
workflow_run:
14+
workflows: [ "Deploy and Test" ]
15+
types: [ completed ]
16+
schedule:
17+
# nightly, after the GEMC dev release window
18+
- cron: '44 5 * * *'
19+
workflow_dispatch:
20+
21+
jobs:
22+
release-tarballs:
23+
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'pull_request' }}
24+
name: Attach GEMC tarballs to dev release
25+
runs-on: ubuntu-latest
26+
env:
27+
TAG_NAME: dev
28+
steps:
29+
- name: Download GEMC tarballs from deploy run
30+
uses: actions/download-artifact@v7
31+
with:
32+
pattern: gemc-tarball-*
33+
path: ${{ runner.temp }}/gemc-release-artifacts
34+
merge-multiple: true
35+
github-token: ${{ secrets.GITHUB_TOKEN }}
36+
repository: ${{ github.repository }}
37+
run-id: ${{ github.event.workflow_run.id }}
38+
39+
- name: Upload GEMC tarballs to release
40+
env:
41+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
REPO: ${{ github.repository }}
43+
shell: bash
44+
run: |
45+
shopt -s nullglob
46+
tarballs=("${{ runner.temp }}/gemc-release-artifacts/"*.tar.gz)
47+
shopt -u nullglob
48+
if (( ${#tarballs[@]} == 0 )); then
49+
echo "No GEMC tarballs found"
50+
exit 1
51+
fi
52+
gh release view "${TAG_NAME}" --repo "$REPO" >/dev/null 2>&1 || \
53+
gh release create "${TAG_NAME}" --repo "$REPO" --title "Dev Nightly" --prerelease --notes "Dev nightly release."
54+
gh release upload "${TAG_NAME}" --repo "$REPO" "${tarballs[@]}" --clobber
55+
56+
discover:
57+
if: ${{ github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'pull_request') }}
58+
name: Create Job Matrix
59+
runs-on: ubuntu-latest
60+
outputs:
61+
matrix_build: ${{ steps.scan.outputs.matrix_build }}
62+
steps:
63+
- name: Checkout repository
64+
uses: actions/checkout@v6
65+
- id: scan
66+
name: Build matrix
67+
run: ./ci/distros_tags.sh
68+
69+
test-tarball:
70+
if: ${{ always() && needs.discover.result == 'success' && (github.event_name != 'workflow_run' || needs.release-tarballs.result == 'success') }}
71+
name: ${{ matrix.image }}:${{ matrix.image_tag }} ${{ matrix.arch }}
72+
needs: [ discover, release-tarballs ]
73+
runs-on: ${{ matrix.runner }}
74+
strategy:
75+
fail-fast: false
76+
matrix: ${{ fromJSON(needs.discover.outputs.matrix_build) }}
77+
env:
78+
TEST_IMAGE: gemc-binary-test:${{ matrix.image }}-${{ matrix.image_tag }}-${{ matrix.arch }}
79+
steps:
80+
- name: Checkout repository
81+
uses: actions/checkout@v6
82+
83+
- name: Generate minimal package Dockerfile
84+
shell: bash
85+
run: |
86+
python3 - "${{ matrix.image }}" "${{ matrix.image_tag }}" > Dockerfile.gemc-binary-test <<'PY'
87+
import sys
88+
89+
sys.path.insert(0, "ci")
90+
from binary_packages import map_family, packages_install_command
91+
92+
image = sys.argv[1]
93+
tag = sys.argv[2]
94+
family = map_family(image)
95+
96+
print(f"FROM {image}:{tag}")
97+
print('SHELL ["/bin/bash", "-c"]')
98+
99+
# Repo/bootstrap steps needed for package installation only. This
100+
# deliberately skips g4install's Geant4/CLHEP/Xerces/noVNC builds.
101+
if family == "archlinux":
102+
print("RUN pacman-key --init && pacman-key --populate")
103+
print("RUN pacman -Sy --noconfirm archlinux-keyring")
104+
elif image == "almalinux":
105+
print("RUN dnf install -y 'dnf-command(config-manager)' \\")
106+
print(" && dnf config-manager --set-enabled crb")
107+
108+
print(packages_install_command(image, tag))
109+
PY
110+
cat Dockerfile.gemc-binary-test
111+
112+
- name: Build minimal package image
113+
shell: bash
114+
run: |
115+
docker build \
116+
--pull \
117+
--platform "${{ matrix.platform }}" \
118+
-f Dockerfile.gemc-binary-test \
119+
-t "${TEST_IMAGE}" \
120+
.
121+
122+
- name: Test GEMC binary tarball installation
123+
shell: bash
124+
run: |
125+
archive="gemc-${{ matrix.gemc_tag }}-geant4-${{ matrix.geant4_tag }}-${{ matrix.image }}-${{ matrix.image_tag }}-${{ matrix.arch }}.tar.gz"
126+
url="https://github.com/gemc/src/releases/download/${{ matrix.gemc_tag }}/${archive}"
127+
128+
docker run --rm \
129+
--platform "${{ matrix.platform }}" \
130+
-e GEMC_TARBALL_URL="${url}" \
131+
-e GEMC_TARBALL_ARCHIVE="${archive}" \
132+
"${TEST_IMAGE}" \
133+
bash -lc '
134+
set -euo pipefail
135+
gemc_home=/root/gemc
136+
mkdir -p "$gemc_home"
137+
cd "$gemc_home"
138+
curl -L -o "$GEMC_TARBALL_ARCHIVE" "$GEMC_TARBALL_URL"
139+
tar -xzf "$GEMC_TARBALL_ARCHIVE" -C "$gemc_home" --strip-components=1
140+
./install_geant4_data.sh
141+
source /root/gemc/gemc.env
142+
gemc -v
143+
test_gdynamic_plugin_load
144+
test_gdata_event_verbose
145+
'

releases/0.3.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ This version includes:
1212
- Added Linux binary `gemc` tarballs to the development deployment workflow.
1313
The archives contain the installed executable, support files, selected smoke
1414
tests, `gemc.env`, and a generated Geant4 data installer.
15-
- Added automated binary tarball installation tests on base OS images using
16-
runtime packages only. These tests install Geant4 datasets into the unpacked
17-
tarball and run `gemc -v` plus smoke tests.
15+
- Added automated binary tarball release and installation tests on base OS
16+
images using runtime packages only. These tests install Geant4 datasets into
17+
the unpacked tarball and run `gemc -v` plus smoke tests after the tarballs are
18+
attached to the `dev` release.
1819
- Isolated ROOT linkage to the ROOT gstreamer plugin so the main `gemc`
1920
executable can run without ROOT shared libraries.
2021
- Removed the need for GEMC-specific environment variables in Python example
@@ -49,9 +50,9 @@ This version includes:
4950

5051
## Tests
5152

52-
- Added a nightly binary tarball workflow that builds base OS images, installs
53-
the runtime package subset, downloads the matching dev tarball, installs
54-
Geant4 data, and runs binary smoke checks.
53+
- Added a `Binary Tarballs` workflow that uploads deploy-produced tarballs to
54+
the `dev` release and then tests those release assets. It can also run the
55+
same install checks on a nightly schedule or by manual dispatch.
5556
- Added analyzer coverage in `pygemc` for y-vs-x plotting and CLI image output.
5657

5758
<br/>
@@ -100,9 +101,8 @@ Both x86_64 and ARM64 platforms are supported.
100101
smoke-test executables in `bin`.
101102
- Generated `gemc.env` and `install_geant4_data.sh` during tarball packaging
102103
from the Geant4 data environment exported by `geant4-config --sh`.
103-
- Added package-export stages to the deploy/test Dockerfile generation and
104-
attached tarballs to the `dev` GitHub release with explicit repository
105-
selection for `gh release`.
104+
- Added package-export stages to the deploy/test Dockerfile generation and moved
105+
dev release asset upload into the dedicated `Binary Tarballs` workflow.
106106
- Added `ci/binary_packages.py` as the dedicated source of truth for ROOT-free
107107
binary runtime packages used by tarball tests.
108108
- Added per-plugin dependency handling in Meson and moved `root_dep` from the

0 commit comments

Comments
 (0)