Skip to content

Commit

Permalink
modernize sonar ci
Browse files Browse the repository at this point in the history
  • Loading branch information
alfC committed Jan 27, 2025
1 parent b071f22 commit bf8d8c1
Showing 1 changed file with 3 additions and 77 deletions.
80 changes: 3 additions & 77 deletions .gitlab-ci-correaa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -910,30 +910,6 @@ qmcpack:
- ctest -R afqmc --output-on-failure
needs: ["g++"]

# qmcpack-cuda:
# stage: test
# image: nvcr.io/nvidia/cuda:11.8.0-devel-ubuntu22.04
# tags:
# - nvidia-gpu
# before_script:
# - apt-get -qq update && apt-get -qq install --no-install-recommends -y ca-certificates cmake git libopenmpi-dev cmake g++ git gfortran libblas-dev libboost-serialization-dev libfftw3-dev libhdf5-dev liblapack-dev libopenmpi-dev make numdiff pkg-config python3 python3-h5py python3-numpy python3-mpi4py python3-scipy libxml2-dev
# script:
# - nvidia-smi
# - git clone --depth 1 https://github.com/QMCPACK/qmcpack.git
# # - git clone https://github.com/correaa/qmcpack.git --branch fix_afqmc_pointer_traits
# - cd qmcpack
# - git config --global user.email "alfredo.correa@gmail.com" && git config --global user.name "Alfredo Correa"
# - git rm -r external_codes/boost_multi/multi && git commit -m "remove multi subtree"
# - git subtree add --squash -P external_codes/boost_multi/multi $CI_REPOSITORY_URL $CI_COMMIT_SHA # e.g. https://gitlab.com/correaa/boost-multi.git
# - cd build
# - nvcc --version
# - __nvcc_device_query
# - CUDACXX=/usr/local/cuda/bin/nvcc cmake .. -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DBUILD_AFQMC=1 -DQMC_CXX_STANDARD=17 -DENABLE_CUDA=1 -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc -DCMAKE_CUDA_HOST_COMPILER=g++ -DCMAKE_CXX_FLAGS="-Wno-deprecated -Wno-deprecated-declarations" -DCMAKE_CUDA_ARCHITECTURES=80
# - make -j 4 ppconvert afqmc test_afqmc_matrix test_afqmc_numerics test_afqmc_slaterdeterminantoperations test_afqmc_walkers test_afqmc_hamiltonians test_afqmc_hamiltonian_operations test_afqmc_phmsd test_afqmc_wfn_factory test_afqmc_prop_factory test_afqmc_estimators qmc-afqmc-performance
# - OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 ctest -R ppconvert --output-on-failure
# - OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 ctest -R afqmc --output-on-failure
# needs: ["qmcpack","cuda"]

qmcpack cuda-12.3.1:
stage: test
image: nvcr.io/nvidia/cuda:12.3.1-devel-ubuntu22.04
Expand Down Expand Up @@ -964,28 +940,6 @@ qmcpack cuda-12.3.1:
# from instructions
# another example here: https://github.com/sonarsource-cfamily-examples/linux-cmake-gitlab-ci-sc/blob/main/.gitlab-ci.yml

# get-sonar-binaries:
# stage: .pre
# cache:
# policy: push
# key: "${CI_COMMIT_SHORT_SHA}"
# paths:
# - build-wrapper/
# - sonar-scanner/
# script:
# - apt-get -qq update && apt-get -qq install curl unzip
# # Download sonar-scanner
# - curl -sSLo ./sonar-scanner.zip 'https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip'
# - unzip -o sonar-scanner.zip
# - mv sonar-scanner-5.0.1.3006-linux sonar-scanner
# # Download build-wrapper
# - curl -sSLo ./build-wrapper-linux-x86.zip "${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip"
# - unzip -oj build-wrapper-linux-x86.zip -d ./build-wrapper
# only:
# - merge_requests
# - master
# - develop

sonar:
stage: build
allow_failure: true
Expand All @@ -996,13 +950,6 @@ sonar:
- non-shared
- docker
- x86_64 # for executable
# cache:
# policy: pull-push
# key: "${CI_COMMIT_SHORT_SHA}"
# paths:
# - build-wrapper/
# - sonar-scanner/
# - bw-output/
interruptible: true
script:
# Run the build inside the build wrapper
Expand All @@ -1017,33 +964,12 @@ sonar:
# - Download build-wrapper
- curl -sSLo ./build-wrapper-linux-x86.zip "${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip"
- unzip -oj build-wrapper-linux-x86.zip -d ./build-wrapper
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=1 -DCMAKE_CXX_FLAGS="--coverage -O0 -fno-inline -fno-inline-small-functions -fno-default-inline" -DCMAKE_EXE_LINKER_FLAGS="--coverage"
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_FLAGS="--coverage -O0 -fno-inline -fno-inline-small-functions -fno-default-inline" -DCMAKE_EXE_LINKER_FLAGS="--coverage"
- build-wrapper/build-wrapper-linux-x86-64 --out-dir bw-output cmake --build build/ --verbose
- cd build
- ctest -j 1 --output-on-failure -T Test
- ctest -j 1 --output-on-failure -T Coverage
- gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o coverage.xml --root ${CI_PROJECT_DIR}
- cd ..
- sonar-scanner/bin/sonar-scanner -Dsonar.host.url="${SONAR_HOST_URL}" -Dsonar.token="${SONAR_TOKEN}" -Dsonar.cfamily.build-wrapper-output=bw-output -Dsonar.cfamily.gcov.reportsPath="build/"
# only:
# - merge_requests
# - master
# - main
# - develop
# needs: ["g++"]

# sonarcloud-check:
# stage: .post
# cache:
# policy: pull
# key: "${CI_COMMIT_SHORT_SHA}"
# paths:
# - build-wrapper/
# - sonar-scanner/
# - bw-output/
# script:
# - sonar-scanner/bin/sonar-scanner -Dsonar.host.url="${SONAR_HOST_URL}" -Dsonar.token="${SONAR_TOKEN}" -Dsonar.cfamily.build-wrapper-output=bw-output
# only:
# - merge_requests
# - master
# - develop
- sonar-scanner/bin/sonar-scanner -Dsonar.host.url="${SONAR_HOST_URL}" -Dsonar.token="${SONAR_TOKEN}" -Dsonar.cfamily.compile-commands=bw-output `#-Dsonar.cfamily.build-wrapper-output=bw-output` -Dsonar.cfamily.gcov.reportsPath="build/"
needs: ["g++"]

0 comments on commit bf8d8c1

Please sign in to comment.