## Copyright 2022 Intel Corporation
## SPDX-License-Identifier: Apache-2.0

name: CI Single Volume Workflow
on:
  push:
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build-amr:
    secrets: inherit
    uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
    with:
      force-delete: true    # guarantees .gitattributes are respected in working dir
      submodules: true
      image: centos:8
      artifact-out: build-amr
      artifact-path: ./build/install ./build/openvkl/build
      cmd: |
        gitlab/build.sh -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_DEVICE_CPU_AMR=ON -DOPENVKL_DEVICE_CPU_PARTICLE=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_SPHERICAL=OFF -DOPENVKL_DEVICE_CPU_UNSTRUCTURED=OFF -DOPENVKL_DEVICE_CPU_VDB=OFF"

  build-particle:
    secrets: inherit
    uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
    with:
      force-delete: true    # guarantees .gitattributes are respected in working dir
      submodules: true
      image: centos:8
      artifact-out: build-particle
      artifact-path: ./build/install ./build/openvkl/build
      cmd: |
        gitlab/build.sh -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_DEVICE_CPU_AMR=OFF -DOPENVKL_DEVICE_CPU_PARTICLE=ON -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_SPHERICAL=OFF -DOPENVKL_DEVICE_CPU_UNSTRUCTURED=OFF -DOPENVKL_DEVICE_CPU_VDB=OFF"

  build-structuredRegular:
    secrets: inherit
    uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
    with:
      force-delete: true    # guarantees .gitattributes are respected in working dir
      submodules: true
      image: centos:8
      artifact-out: build-structuredRegular
      artifact-path: ./build/install ./build/openvkl/build
      cmd: |
        gitlab/build.sh -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_DEVICE_CPU_AMR=OFF -DOPENVKL_DEVICE_CPU_PARTICLE=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=ON -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_SPHERICAL=OFF -DOPENVKL_DEVICE_CPU_UNSTRUCTURED=OFF -DOPENVKL_DEVICE_CPU_VDB=OFF"

  build-structuredRegularLegacy:
    secrets: inherit
    uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
    with:
      force-delete: true    # guarantees .gitattributes are respected in working dir
      submodules: true
      image: centos:8
      artifact-out: build-structuredRegularLegacy
      artifact-path: ./build/install ./build/openvkl/build
      cmd: |
        gitlab/build.sh -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_DEVICE_CPU_AMR=OFF -DOPENVKL_DEVICE_CPU_PARTICLE=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=ON -DOPENVKL_DEVICE_CPU_STRUCTURED_SPHERICAL=OFF -DOPENVKL_DEVICE_CPU_UNSTRUCTURED=OFF -DOPENVKL_DEVICE_CPU_VDB=OFF"

  build-structuredSpherical:
    secrets: inherit
    uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
    with:
      force-delete: true    # guarantees .gitattributes are respected in working dir
      submodules: true
      image: centos:8
      artifact-out: build-structuredSpherical
      artifact-path: ./build/install ./build/openvkl/build
      cmd: |
        gitlab/build.sh -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_DEVICE_CPU_AMR=OFF -DOPENVKL_DEVICE_CPU_PARTICLE=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_SPHERICAL=ON -DOPENVKL_DEVICE_CPU_UNSTRUCTURED=OFF -DOPENVKL_DEVICE_CPU_VDB=OFF"

  build-unstructured:
    secrets: inherit
    uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
    with:
      force-delete: true    # guarantees .gitattributes are respected in working dir
      submodules: true
      image: centos:8
      artifact-out: build-unstructured
      artifact-path: ./build/install ./build/openvkl/build
      cmd: |
        gitlab/build.sh -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_DEVICE_CPU_AMR=OFF -DOPENVKL_DEVICE_CPU_PARTICLE=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_SPHERICAL=OFF -DOPENVKL_DEVICE_CPU_UNSTRUCTURED=ON -DOPENVKL_DEVICE_CPU_VDB=OFF"

  build-vdb:
    secrets: inherit
    uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
    with:
      force-delete: true    # guarantees .gitattributes are respected in working dir
      submodules: true
      image: centos:8
      artifact-out: build-vdb
      artifact-path: ./build/install ./build/openvkl/build
      cmd: |
        gitlab/build.sh -D OPENVKL_EXTRA_OPTIONS="-DOPENVKL_DEVICE_CPU_AMR=OFF -DOPENVKL_DEVICE_CPU_PARTICLE=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_REGULAR_LEGACY=OFF -DOPENVKL_DEVICE_CPU_STRUCTURED_SPHERICAL=OFF -DOPENVKL_DEVICE_CPU_UNSTRUCTURED=OFF -DOPENVKL_DEVICE_CPU_VDB=ON"

  # test jobs - per volume type

  test-amr:
    needs: build-amr
    secrets: inherit
    uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
    with:
      artifact-in: build-amr
      image: centos:8
      cmd: |
        ./build/openvkl/build/vklTestsCPU --durations yes

  test-particle:
    needs: build-particle
    secrets: inherit
    uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
    with:
      artifact-in: build-particle
      image: centos:8
      cmd: |
        ./build/openvkl/build/vklTestsCPU --durations yes

  test-structuredRegular:
    needs: build-structuredRegular
    secrets: inherit
    uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
    with:
      artifact-in: build-structuredRegular
      image: centos:8
      cmd: |
        ./build/openvkl/build/vklTestsCPU --durations yes

  test-structuredRegularLegacy:
    needs: build-structuredRegularLegacy
    secrets: inherit
    uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
    with:
      artifact-in: build-structuredRegularLegacy
      image: centos:8
      cmd: |
        ./build/openvkl/build/vklTestsCPU --durations yes

  test-structuredSpherical:
    needs: build-structuredSpherical
    secrets: inherit
    uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
    with:
      artifact-in: build-structuredSpherical
      image: centos:8
      cmd: |
        ./build/openvkl/build/vklTestsCPU --durations yes

  test-unstructured:
    needs: build-unstructured
    secrets: inherit
    uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
    with:
      artifact-in: build-unstructured
      image: centos:8
      cmd: |
        ./build/openvkl/build/vklTestsCPU --durations yes

  test-vdb:
    needs: build-vdb
    secrets: inherit
    uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/docker.yml@main
    with:
      artifact-in: build-vdb
      image: centos:8
      cmd: |
        ./build/openvkl/build/vklTestsCPU --durations yes