Implement G4Trap and G4Trd support in geometries through convexpolyhedron #1097
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: include/argparse | |
| 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: | |
| include: | |
| - target: release | |
| os: ubuntu24.04 | |
| cuda_version: 13.2.0 | |
| optix_version: 9.1.0 | |
| geant4_version: 11.4.1 | |
| cmake_version: 4.3.1 | |
| - target: release | |
| os: ubuntu24.04 | |
| cuda_version: 13.0.2 | |
| optix_version: 9.0.0 | |
| geant4_version: 11.4.1 | |
| cmake_version: 4.2.1 | |
| - target: release | |
| os: ubuntu22.04 | |
| cuda_version: 12.1.1 | |
| optix_version: 8.0.0 | |
| geant4_version: 11.3.2 | |
| cmake_version: 3.22.1 | |
| - target: develop | |
| os: ubuntu24.04 | |
| cuda_version: 13.0.2 | |
| optix_version: 9.0.0 | |
| geant4_version: 11.4.1 | |
| cmake_version: 4.2.1 | |
| - target: develop | |
| os: ubuntu24.04 | |
| cuda_version: 12.5.1 | |
| optix_version: 9.0.0 | |
| geant4_version: 11.4.1 | |
| cmake_version: 3.28.3 | |
| - target: develop | |
| 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 }} | |
| BUILD_VARIANT=cuda${{ matrix.cuda_version }}-${{ matrix.target }}-${{ matrix.os }}-optix${{ matrix.optix_version }}-geant4${{ matrix.geant4_version }}-cmake${{ matrix.cmake_version }} | |
| echo IMAGE_NAME=${IMAGE_NAME} >> $GITHUB_ENV | |
| echo IMAGE_TAG=${REF_SANITIZED}-${BUILD_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.os }} | |
| CUDA_VERSION=${{ matrix.cuda_version }} | |
| OPTIX_VERSION=${{ matrix.optix_version }} | |
| GEANT4_VERSION=${{ matrix.geant4_version }} | |
| CMAKE_VERSION=${{ matrix.cmake_version }} | |
| cache-from: type=registry,ref=${{ env.CACHE_REF }} | |
| push: ${{ matrix.target == 'develop' && github.event.pull_request.head.repo.full_name == github.repository }} | |
| test-develop-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: &develop_matrix | |
| include: | |
| - os: ubuntu24.04 | |
| cuda_version: 13.0.2 | |
| optix_version: 9.0.0 | |
| geant4_version: 11.4.1 | |
| 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 }} | |
| BUILD_VARIANT=cuda${{ matrix.cuda_version }}-develop-${{ matrix.os }}-optix${{ matrix.optix_version }}-geant4${{ matrix.geant4_version }}-cmake${{ matrix.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 develop 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 }} tests/test_opticks.sh | |
| docker run --rm --gpus 'device=1' ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} tests/test_simg4ox.sh | |
| 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_GPUPhotonSource_8x8SiPM.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: 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-develop-image | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: *develop_matrix | |
| 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.cuda_version }}-develop-${{ matrix.os }}-optix${{ matrix.optix_version }}-geant4${{ matrix.geant4_version }}-cmake${{ matrix.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" |