Skip to content
Snippets Groups Projects
Commit d97fed4b authored by Fons Rademakers's avatar Fons Rademakers
Browse files

Add sonarcloud static analysis to the gitlab-ci.

Created the cern-cta organization on GitHub with the CTA repository as mirror from gitlab.cern.ch: https://github.com/cern-cta. The new .github/workflows/sonar-source.yml will run nightly at 3am and (for the time being, on all pushes to main). The sonar reporting is here: https://sonarcloud.io/project/overview?id=cern-cta_CTA. The initial set of bugs and issues should be fixed and flagged so we arrive at 0. From then on we just need to maintain the clean code base. CTA developers should get a GitHub account with which they can join the sonarcloud CTA project so they can change the status of the issues.
parent 549836b7
No related branches found
No related tags found
No related merge requests found
Showing
with 137 additions and 11 deletions
name: Sonar Source Analysis
on:
schedule:
# Every day at 3 am
- cron: '0 3 * * *'
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Sonar Source Analysis
runs-on: ubuntu-20.04
container:
image: centos:7
env:
XROOTD_VERSION: 4
SCHED_TYPE: objectstore
ORACLE_SUPPORT: ON
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
steps:
- name: Install dependencies
run: |
yum -y update
yum -y install centos-release-scl epel-release yum-plugin-priorities yum-plugin-versionlock
yum -y install devtoolset-11 cmake3 make rpm-build git unzip ninja-build which
yum -y remove git*
yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo-1.10-1.x86_64.rpm
yum -y install git
curl -sL https://rpm.nodesource.com/setup_16.x | bash -
yum -y install nodejs
node -v
ls /etc/yum.repos.d
rm -f /etc/yum.repos.d/nodesource*
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-linux-x86_64.sh
chmod +x cmake-3.26.4-linux-x86_64.sh
./cmake-3.26.4-linux-x86_64.sh --skip-license --prefix=/usr/local
- name: Download CTA
uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v1
- name: Install CTA dependencies
run: |
export CMAKE_OPTIONS
export CTA_VERSION
export CTA_BUILD_ID=${GITHUB_RUN_ID}git${GITHUB_SHA:0:8}
cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d-public/*.repo /etc/yum.repos.d/
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
export TAG_VERSION=$(echo ${GITHUB_REF_NAME} | sed -e 's/^v//;s/-.*$//')
export TAG_RELEASE=$(echo ${GITHUB_REF_NAME} | sed -e 's/^[^-]*-//')
fi
major_version=$(echo ${TAG_VERSION} | cut -d. -f1)
if [[ ${major_version} == 5 ]]; then
echo "Setting to compile with XRootD version 5"
XROOTD_VERSION=5
fi
if [[ ${XROOTD_VERSION} -eq 5 ]]; then
echo "Using XRootD version 5"
./continuousintegration/docker/ctafrontend/cc7/opt/run/bin/cta-versionlock --file ./continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list config xrootd5
yum-config-manager --enable cta-ci-xrootd5
else
echo "Using XRootD version 4"
fi
CTA_VERSION=$XROOTD_VERSION
if [[ ${SCHED_TYPE} != "objectstore" ]]; then
echo "Using specified scheduler database type $SCHED_TYPE"
sched_opt="-DCTA_USE_$(echo ${SCHED_TYPE} | tr '[:lower:]' '[:upper:]'):Bool=true"
sched_version=$(echo ${SCHED_TYPE} | cut -c 1-3)
CTA_VERSION="${CTA_VERSION}${sched_version}"
CMAKE_OPTIONS+="-DSKIP_UNIT_TESTS:STRING=1 ${sched_opt} "
fi
if [[ ${ORACLE_SUPPORT} != "ON" ]]; then
echo "Disabling Oracle Support"
CMAKE_OPTIONS+="-DDISABLE_ORACLE_SUPPORT:BOOL=ON"
fi
git config --global --add safe.directory $(pwd)
git submodule update --init --recursive
mkdir build_srpm
cd build_srpm
echo "CMAKE_OPTIONS=${CMAKE_OPTIONS}" >> "$GITHUB_ENV"
echo "CTA_VERSION=${CTA_VERSION}" >> "$GITHUB_ENV"
echo "CTA_BUILD_ID=${CTA_BUILD_ID}" >> "$GITHUB_ENV"
source /opt/rh/devtoolset-11/enable
cmake -DPackageOnly:Bool=true -DVCS_VERSION=${CTA_BUILD_ID} ${CMAKE_OPTIONS} ..
make cta_srpm
- name: Run build-wrapper
run: |
cd xrootd-ssi-protobuf-interface && export XROOTD_SSI_PROTOBUF_INTERFACE_VERSION=$(git describe --tags --abbrev=0) && cd ..
cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list /etc/yum/pluginconf.d/
yum-builddep --nogpgcheck -y build_srpm/RPM/SRPMS/*
mkdir build_rpm
cd build_rpm
source /opt/rh/devtoolset-11/enable
cmake -DVCS_VERSION=${CTA_BUILD_ID} ${CMAKE_OPTIONS} ..
build-wrapper-linux-x86-64 --out-dir ../${{ env.BUILD_WRAPPER_OUT_DIR }} make
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
The CERN Tape Archive (CTA) project is a new tape system that will provide a tape backend to EOS.
The CERN Tape Archive (CTA) project is the tape backend to EOS.
[cta-ceph]
name=Ceph version 15.2.15 packages for $basearch
baseurl=http://download.ceph.com/rpm-15.2.15/el$releasever/$basearch
enabled=0
enabled=1
priority=4
gpgcheck=1
protect=1
......
[cta-eos-citrine-depend]
name=dependencies for EOS citrine releases from EOS project
baseurl=http://storage-ci.web.cern.ch/storage-ci/eos/citrine-depend/el-$releasever/$basearch/
enabled=0
enabled=1
gpgcheck=0
priority=4
[cta-eos-citrine]
name=EOS citrine releases from EOS project
baseurl=http://storage-ci.web.cern.ch/storage-ci/eos/citrine/tag/testing/el-$releasever/$basearch/
enabled=0
enabled=1
gpgcheck=1
priority=4
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-storageci
[cta-eos-quarkdb]
name=EOS quarkdb releases from EOS project
baseurl=http://storage-ci.web.cern.ch/storage-ci/quarkdb/tag/el$releasever/$basearch/
enabled=0
enabled=1
gpgcheck=1
priority=10
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-storageci
......@@ -3,5 +3,5 @@ name=Oracle instant client
baseurl=https://yum.oracle.com/repo/OracleLinux/OL$releasever/oracle/instantclient/$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
enabled=1
priority=1
[cta-public-4]
name=CTA public releases for CTA 4 project
baseurl=https://cta-public-repo.web.cern.ch/cta-4/el-$releasever/cta/
enabled=0
enabled=1
gpgcheck=0
priority=10
[cta-public-4-depend]
name=CTA public releases for CTA 4 project - dependencies
baseurl=https://cta-public-repo.web.cern.ch/cta-4/el-$releasever/cta-dependencies/
enabled=0
enabled=1
gpgcheck=0
priority=3
......@@ -24,4 +24,4 @@ name=CTA public releases for CTA 5 project - dependencies
baseurl=https://cta-public-repo.web.cern.ch/cta-5/el-$releasever/cta-dependencies/
enabled=0
gpgcheck=0
priority=3
\ No newline at end of file
priority=3
......@@ -3,6 +3,6 @@ name=XRootD Stable repository
baseurl=https://xrootd.slac.stanford.edu/binaries/stable/slc/7/$basearch http://xrootd.cern.ch/sw/repos/stable/slc/7/$basearch
gpgcheck=1
priority=4
enabled=0
enabled=1
protect=0
gpgkey=http://xrootd.cern.ch/sw/releases/RPM-GPG-KEY.txt
\ No newline at end of file
gpgkey=http://xrootd.cern.ch/sw/releases/RPM-GPG-KEY.txt
sonar.projectKey=cern-cta_CTA
sonar.organization=cern-cta
# This is the name and version displayed in the SonarCloud UI.
# sonar.projectName=CTA
# sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# sonar.sources=.
sonar.exclusions=build_srpm/_CPack_Packages/**, **/*.java, **/*.py
# Encoding of the source code. Default is default system encoding
# sonar.sourceEncoding=UTF-8
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment