1- # Build and test GEMC images without publishing containers.
21name : Test
32
43permissions :
54 contents : read
6- packages : read
75
86env :
9- GEMC_TAG : dev
10- GEANT4_TAG : 11.4.1
117 FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 : true
12- DOCKER_BUILD_SUMMARY : false
138
149concurrency :
1510 group : gemc-test-${{ github.ref }}
2419 merge_group :
2520 push :
2621 branches : [ main ]
27- tags : [ '*' ]
2822 paths-ignore :
2923 - " **/*.md"
3024
3125jobs :
3226 discover :
33- name : Create Job Matrix
27+ name : Create job matrix
3428 runs-on : ubuntu-latest
3529 outputs :
3630 matrix_build : ${{ steps.scan.outputs.matrix_build }}
4236
4337 - id : scan
4438 name : Build matrix
45- run : ci/distros_tags.sh
39+ shell : bash
40+ run : |
41+ set -euo pipefail
42+ ./ci/distros_tags.sh
43+
44+ - name : Fail if matrix is empty
45+ shell : bash
46+ run : |
47+ set -euo pipefail
48+ if [[ -z "${{ steps.scan.outputs.matrix_build }}" ]]; then
49+ echo "matrix_build output is empty. Check ci/distros_tags.sh writing to GITHUB_OUTPUT."
50+ exit 1
51+ fi
52+
53+ - name : Show matrix (debug)
54+ shell : bash
55+ run : |
56+ echo '${{ steps.scan.outputs.matrix_build }}'
4657
4758 build :
4859 name : ${{ matrix.image }}/${{ matrix.image_tag }} ${{ matrix.arch }}
@@ -51,83 +62,45 @@ jobs:
5162 strategy :
5263 fail-fast : false
5364 matrix : ${{ fromJSON(needs.discover.outputs.matrix_build) }}
54- env :
55- CACHE_REF : type=registry,ref=ghcr.io/${{ github.repository }}:cache-test-${{ matrix.arch }}
65+ container : ${{ matrix.container }}
66+
5667 steps :
57- - name : Checkout repository
68+ - name : Checkout
5869 uses : actions/checkout@v6
5970 with :
6071 fetch-depth : 0
6172
62- - name : Free up disk space
63- uses : ./.github/actions/free-disk-space
64- with :
65- prune_docker : " true"
66- show_tree : " true"
67-
68- - name : Set up Buildx
69- uses : docker/setup-buildx-action@v4
73+ - name : Build and test
74+ shell : bash
7075
71- - name : Log in to GHCR
72- uses : docker/login-action@v4
73- with :
74- registry : ghcr.io
75- username : ${{ github.actor }}
76- password : ${{ secrets.GITHUB_TOKEN }}
7776
78- - name : Generate Dockerfile
79- shell : bash
8077 run : |
81- python3 ci/dockerfile_creator.py \
82- -i "${{ matrix.image }}" \
83- -t "${{ matrix.image_tag }}" \
84- --gemc-version "${{ matrix.gemc_tag || env.GEMC_TAG }}" \
85- --geant4-version "${{ matrix.geant4_tag || env.GEANT4_TAG }}" \
86- --source context \
87- > Dockerfile.generated
88- cat Dockerfile.generated
89-
90- - name : Build and test
91- uses : docker/build-push-action@v7
92- with :
93- pull : true
94- context : .
95- file : ./Dockerfile.generated
96- target : final
97- platforms : ${{ matrix.platform }}
98- push : false
99- cache-from : ${{ env.CACHE_REF }}
100-
101- - name : Export logs
102- uses : docker/build-push-action@v7
103- with :
104- pull : true
105- context : .
106- file : ./Dockerfile.generated
107- target : logs-export
108- platforms : ${{ matrix.platform }}
109- push : false
110- cache-from : ${{ env.CACHE_REF }}
111- outputs : type=local,dest=${{ runner.temp }}/artifacts/${{ matrix.logs_dir }}
78+ set -euo pipefail
79+ export DOCKER_ENTRYPOINT_SOURCE_ONLY=1
80+ . /usr/local/bin/docker-entrypoint.sh
81+ module load geant4/"${{ matrix.geant4_tag || env.GEANT4_TAG }}"
82+ ./ci/build.sh
11283
11384 - name : Pack logs
85+ if : ${{ always() }}
11486 shell : bash
11587 run : |
11688 set -euo pipefail
11789 echo "LOG_TAR=" >> "$GITHUB_ENV"
118- LOGROOT="${{ runner.temp }}/artifacts/${{ matrix.logs_dir }}"
90+ LOGROOT="/root/src"
91+ OUTDIR="$GITHUB_WORKSPACE/_artifacts"
11992 TAR="logs-${{ matrix.gemc_tag }}-${{ matrix.image }}-${{ matrix.image_tag }}"
12093 TAR="${TAR}-${{ matrix.arch }}.tgz"
12194 if [[ -d "$LOGROOT/logs" ]]; then
122- cd "$LOGROOT "
123- tar -czf "$TAR" logs
124- echo "LOG_TAR=$LOGROOT /$TAR" >> "$GITHUB_ENV"
95+ mkdir -p "$OUTDIR "
96+ tar -C "$LOGROOT" - czf "$OUTDIR/ $TAR" logs
97+ echo "LOG_TAR=$OUTDIR /$TAR" >> "$GITHUB_ENV"
12598 else
12699 echo "No exported logs found at $LOGROOT/logs"
127100 fi
128101
129102 - name : Upload logs
130- if : ${{ env.LOG_TAR != '' }}
103+ if : ${{ always() && env.LOG_TAR != '' }}
131104 uses : actions/upload-artifact@v7
132105 with :
133106 name : logs-${{ matrix.gemc_tag }}-${{ matrix.image }}-${{ matrix.image_tag }}-${{ matrix.arch }}
0 commit comments