variables:
  FF_ENABLE_JOB_CLEANUP: 1

stages:
  - test
  - clean_up

hipcc:
  stage: test
  tags: [frontier, shell]
  id_tokens:
    OLCF_ID_TOKEN:
      aud: https://code.olcf.ornl.gov
  script:
    - module load rocm/6.3.1
    - export CMAKE_BUILD_PARALLEL_LEVEL=48
    - export CRAYPE_LINK_TYPE=dynamic
    - export ENV_CMAKE_OPTIONS=""
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_CXX_COMPILER=hipcc"
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_CXX_STANDARD=20"
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_HIP=ON"
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_COMPILER_WARNINGS=ON"
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_TESTS=ON"
    - ctest -VV -E Kokkos_CoreUnitTest_DeviceAndThreads -D CDASH_MODEL="Nightly" -D CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS}" -S scripts/CTestRun.cmake -D CTEST_SITE="frontier" -D CTEST_BUILD_NAME="hipcc-rocm/6.3.1"

amdclang:
  stage: test
  tags: [frontier, shell]
  id_tokens:
    OLCF_ID_TOKEN:
      aud: https://code.olcf.ornl.gov
  script:
    - module load rocm/6.2.4
    - export CMAKE_BUILD_PARALLEL_LEVEL=48
    - export CRAYPE_LINK_TYPE=dynamic
    - export ENV_CMAKE_OPTIONS=""
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_CXX_COMPILER=amdclang++"
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_CXX_CLANG_TIDY=/opt/rocm-6.2.4/llvm/bin/clang-tidy\;-warnings-as-errors=*"
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_CXX_STANDARD=20"
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_HIP=ON"
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_COMPILER_WARNINGS=ON"
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_TESTS=ON"
    - ctest -VV -E Kokkos_CoreUnitTest_DeviceAndThreads -D CDASH_MODEL="Nightly" -D CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS}" -S scripts/CTestRun.cmake -D CTEST_SITE="frontier" -D CTEST_BUILD_NAME="amdclang-rocm/6.2.4"

crayclang:
  stage: test
  tags: [frontier, shell]
  id_tokens:
    OLCF_ID_TOKEN:
      aud: https://code.olcf.ornl.gov
  script:
    - module load rocm/6.4.1
    - module load cce/19.0.0
    - export CMAKE_BUILD_PARALLEL_LEVEL=48
    - export CRAYPE_LINK_TYPE=dynamic
    - export ENV_CMAKE_OPTIONS=""
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_CXX_COMPILER=CC"
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_CXX_STANDARD=20"
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_HIP=ON"
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_COMPILER_WARNINGS=ON"
    - export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_TESTS=ON"
    - ctest -VV -E Kokkos_CoreUnitTest_DeviceAndThreads -D CDASH_MODEL="Nightly" -D CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS}" -S scripts/CTestRun.cmake -D CTEST_SITE="frontier" -D CTEST_BUILD_NAME="crayclang/19.0.0-rocm/6.4.1"

include:
- project: ci/resources/templates
  ref: main
  file:
    - /runners.yml

clear-ci-builds:
  stage: clean_up
  extends:
    - .frontier-shell-runner
  variables:
    GIT_STRATEGY: none
    OLCF_SERVICE_ACCOUNT: ums018_auser
  script:
    - ls -la $HOME
    - rm -rf $HOME/.jacamar-ci/{builds,cache}
