|
| 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 | + ' |
0 commit comments