test(simg4ox): validate dRICH sensor hits #1332
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Pull Request | |
| on: | |
| pull_request: | |
| branches: | |
| - '**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| actions: write | |
| packages: read | |
| jobs: | |
| cpp-linter: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: cpp-linter/cpp-linter-action@main | |
| id: linter | |
| continue-on-error: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| style: file | |
| ignore: third_party | |
| lines-changed-only: true | |
| thread-comments: update | |
| format-review: false | |
| tidy-checks: '-*' | |
| tidy-review: false | |
| step-summary: true | |
| file-annotations: true | |
| - name: Fail fast?! | |
| if: steps.linter.outputs.checks-failed != 0 | |
| run: | | |
| echo "some linter checks failed. ${{ steps.linter.outputs.checks-failed }}" | |
| exit 1 | |
| build-image: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: [release, develop] | |
| config: &build_configs | |
| - os: ubuntu26.04 | |
| cuda_version: 13.3.0 | |
| optix_version: 9.1.0 | |
| geant4_version: 11.4.2 | |
| cmake_version: 4.3.4 | |
| - os: ubuntu24.04 | |
| cuda_version: 13.0.3 | |
| optix_version: 9.0.0 | |
| geant4_version: 11.4.2 | |
| cmake_version: 4.2.1 | |
| - os: ubuntu24.04 | |
| cuda_version: 12.5.1 | |
| optix_version: 9.0.0 | |
| geant4_version: 11.4.1 | |
| cmake_version: 3.28.3 | |
| - os: ubuntu22.04 | |
| cuda_version: 12.1.1 | |
| optix_version: 8.0.0 | |
| geant4_version: 11.3.2 | |
| cmake_version: 3.22.1 | |
| steps: | |
| - name: Define environment variables | |
| run: | | |
| IMAGE_NAME=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')-buildcache | |
| REF_SANITIZED=PR-${{ github.event.pull_request.number }} | |
| BASE_VARIANT=cuda${{ matrix.config.cuda_version }}-base-${{ matrix.config.os }}-optix${{ matrix.config.optix_version }}-geant4${{ matrix.config.geant4_version }}-cmake${{ matrix.config.cmake_version }} | |
| BUILD_VARIANT=cuda${{ matrix.config.cuda_version }}-${{ matrix.target }}-${{ matrix.config.os }}-optix${{ matrix.config.optix_version }}-geant4${{ matrix.config.geant4_version }}-cmake${{ matrix.config.cmake_version }} | |
| echo IMAGE_NAME=${IMAGE_NAME} >> $GITHUB_ENV | |
| echo IMAGE_TAG=${REF_SANITIZED}-${BUILD_VARIANT} >> $GITHUB_ENV | |
| echo BASE_CACHE_REF=${IMAGE_NAME}:${BASE_VARIANT} >> $GITHUB_ENV | |
| echo CACHE_REF=${IMAGE_NAME}:${BUILD_VARIANT} >> $GITHUB_ENV | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build PR image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| tags: | | |
| ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} | |
| target: ${{ matrix.target }} | |
| build-args: | | |
| OS=${{ matrix.config.os }} | |
| CUDA_VERSION=${{ matrix.config.cuda_version }} | |
| OPTIX_VERSION=${{ matrix.config.optix_version }} | |
| GEANT4_VERSION=${{ matrix.config.geant4_version }} | |
| CMAKE_VERSION=${{ matrix.config.cmake_version }} | |
| cache-from: | | |
| type=registry,ref=${{ env.BASE_CACHE_REF }} | |
| type=registry,ref=${{ env.CACHE_REF }} | |
| push: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | |
| test-image: | |
| if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | |
| needs: build-image | |
| runs-on: [gpu] | |
| permissions: | |
| contents: read | |
| packages: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: [release, develop] | |
| config: *build_configs | |
| exclude: | |
| # The gpu runner driver does not support the ubuntu26.04/CUDA 13.3.0 image yet. | |
| - config: | |
| os: ubuntu26.04 | |
| cuda_version: 13.3.0 | |
| optix_version: 9.1.0 | |
| geant4_version: 11.4.2 | |
| cmake_version: 4.3.4 | |
| steps: | |
| - name: Define environment variables | |
| run: | | |
| IMAGE_NAME=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')-buildcache | |
| REF_SANITIZED=PR-${{ github.event.pull_request.number }} | |
| BUILD_VARIANT=cuda${{ matrix.config.cuda_version }}-${{ matrix.target }}-${{ matrix.config.os }}-optix${{ matrix.config.optix_version }}-geant4${{ matrix.config.geant4_version }}-cmake${{ matrix.config.cmake_version }} | |
| echo IMAGE_NAME=${IMAGE_NAME} >> $GITHUB_ENV | |
| echo IMAGE_TAG=${REF_SANITIZED}-${BUILD_VARIANT} >> $GITHUB_ENV | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pull PR image | |
| run: | | |
| docker pull ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} | |
| - name: Run tests | |
| run: | | |
| docker run --rm --gpus 'device=1' ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} bash -lc 'ctest --test-dir "$SIMPHONY_BUILD"' | |
| docker run --rm --gpus 'device=1' ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} tests/test_GPURaytrace.sh | |
| docker run --rm --gpus 'device=1' ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} tests/test_triangulated.sh | |
| docker run --rm --gpus 'device=1' ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} tests/test_triangulated_multi.sh | |
| docker run --rm --gpus 'device=1' ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} tests/test_GPUPhotonFileSource.sh | |
| docker run --rm --gpus 'device=1' ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} tests/test_wavelength_shifting.sh | |
| docker run --rm --gpus 'device=1' ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} tests/g4trap_validation.sh | |
| - name: Build and run external example | |
| run: | | |
| docker run --rm --gpus 'device=1' ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} bash -lc examples/simphox/run.sh | |
| - name: Cleanup local test image | |
| if: ${{ success() }} | |
| run: | | |
| docker image rm -f ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} || true | |
| cleanup-pr-images: | |
| if: ${{ success() && github.event.pull_request.head.repo.full_name == github.repository }} | |
| needs: test-image | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: [release, develop] | |
| config: *build_configs | |
| steps: | |
| - name: Define environment variables | |
| run: | | |
| PACKAGE_NAME=$(echo ${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')-buildcache | |
| REF_SANITIZED=PR-${{ github.event.pull_request.number }} | |
| BUILD_VARIANT=cuda${{ matrix.config.cuda_version }}-${{ matrix.target }}-${{ matrix.config.os }}-optix${{ matrix.config.optix_version }}-geant4${{ matrix.config.geant4_version }}-cmake${{ matrix.config.cmake_version }} | |
| echo PACKAGE_NAME=${PACKAGE_NAME} >> $GITHUB_ENV | |
| echo IMAGE_TAG=${REF_SANITIZED}-${BUILD_VARIANT} >> $GITHUB_ENV | |
| - name: Delete successful PR image from GHCR | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| OWNER: ${{ github.repository_owner }} | |
| run: | | |
| VERSION_ID=$( | |
| gh api --paginate "/orgs/$OWNER/packages/container/$PACKAGE_NAME/versions?per_page=100" \ | |
| --jq ".[] | select((.metadata.container.tags // []) | index(\"$IMAGE_TAG\")) | .id" \ | |
| | head -n 1 | |
| ) | |
| if [ -z "$VERSION_ID" ]; then | |
| echo "No GHCR version found with tag $IMAGE_TAG" | |
| exit 0 | |
| fi | |
| echo "Deleting GHCR version $VERSION_ID for tag $IMAGE_TAG" | |
| gh api -X DELETE "/orgs/$OWNER/packages/container/$PACKAGE_NAME/versions/$VERSION_ID" |