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