Commit 78db248d authored by Guillaume Pasero's avatar Guillaume Pasero

Merge branch 'new-ci' into 'develop'

Add QA related jobs to CI pipeline

See merge request orfeotoolbox/otb!539
parents fb9a3b5f a403af04
Pipeline #2067 passed with stages
in 77 minutes and 18 seconds
......@@ -22,6 +22,7 @@ stages:
- precheck
- prepare
- build
- report
- deploy
.general:
......@@ -58,6 +59,9 @@ stages:
- build/Documentation/Doxygen/OTB-Doxygen-*.tar.bz2
- build_packages/OTB-*.run
- build_packages/OTB-*.zip
- build/compile_commands.json
- build/ctest_report.xml
- build/cppcheck_report.xml
.common-prepare:
extends: .general
......@@ -211,6 +215,60 @@ windows-8-build:
dependencies:
- windows-8-prepare
#------------------------- QA related jobs -------------------------------------
ubuntu-xdk-qa-code-coverage:
extends: .common-build
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa:18.04
script:
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96"
ctest -V -S CI/main_qa.cmake
-DIMAGE_NAME:string=ubuntu-18.04-llvm-xdk
-DQA:BOOL=ON
- saxon-xslt -o build/ctest_report.xml
build/Testing/`head -n 1 build/Testing/TAG`/Test.xml
CI/ctest2junit.xsl
after_script: []
dependencies:
- ubuntu-xdk-prepare
ubuntu-xdk-qa-static-analysis:
extends: .common-build
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa:18.04
script:
- find Modules -type f -regextype posix-extended -regex '.*\.(h|hxx)$' -exec dirname '{}' \; |
grep -vE '^Modules/ThirdParty/' |
sort -u > header_directories
- cppcheck -j 8 -q --xml --xml-version=2 --enable=all
--language=c++ --std=c++14 --platform=unix64
--includes-file=header_directories
-i Modules/ThirdParty Modules
2> build/cppcheck_report.xml
after_script: []
dependencies:
- ubuntu-xdk-prepare
ubuntu-xdk-report:
extends: .common
variables:
GIT_DEPTH: ""
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-qa:18.04
stage: report
only:
- merge_requests
- develop
- /^release-[0-9]+\.[0-9]+$/
script:
- sonar-scanner -Dproject.settings=sonar-project.properties
-Dsonar.host.url=https://sonar.orfeo-toolbox.org
-Dsonar.login=$SONAR_OTB_TOKEN
`test -z "$CI_COMMIT_TAG" || echo "-Dsonar.projectVersion=$CI_COMMIT_TAG"`
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
after_script: []
dependencies:
- ubuntu-xdk-qa-code-coverage
- ubuntu-xdk-qa-static-analysis
#---------------------------- Deploy job ---------------------------------------
deploy:
tags:
......@@ -228,7 +286,7 @@ deploy:
script:
- ./CI/deploy.sh $CI_COMMIT_REF_NAME $RC_NUMBER
dependencies:
- ubuntu-xdk-build
- ubuntu-xdk-build
- centos-xdk-build
- macos-xdk-build
- windows-8-build
......@@ -244,4 +302,8 @@ release-container:
variables:
- $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/
script:
- "curl --request POST --form token=$K8S_SECRET_RELEASE --form ref=master --form variables[OTB_TAG]=$CI_COMMIT_TAG https://gitlab.orfeo-toolbox.org/api/v4/projects/126/trigger/pipeline"
- curl --request POST
--form token=$K8S_SECRET_RELEASE
--form ref=master
--form variables[OTB_TAG]=$CI_COMMIT_TAG
https://gitlab.orfeo-toolbox.org/api/v4/projects/126/trigger/pipeline
......@@ -31,6 +31,9 @@ BUILD_EXAMPLES:BOOL=ON
BUILD_SHARED_LIBS:BOOL=ON
BUILD_TESTING:BOOL=ON")
set (otb_qa_option
"CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON")
set (otb_use_option
"OTB_USE_6S:BOOL=ON
OTB_USE_CURL:BOOL=ON
......@@ -88,6 +91,13 @@ ${cmake_configure_option}
${site_option}
")
if (QA)
set(concat_options
"${concat_options}
${otb_qa_option}
")
endif()
#Transform the previous string in list
string (REPLACE "\n" ";" otb_options ${concat_options})
......
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<!-- convert ctest output to junit format -->
<!--
Inspired by https://stackoverflow.com/questions/6329215/how-to-get-ctest-results-in-hudson-jenkins
Based on https://github.com/zanata/zanata-tests/blob/master/scripts/CTest2JUnit.xsl
Extended by providing total Start date, total time, total test stats
-->
<xsl:template match="/Site">
<xsl:variable name="StartDate"><xsl:value-of select="Testing/StartDateTime"/></xsl:variable>
<xsl:variable name="DoTime"><xsl:value-of select="Testing/EndTestTime - Testing/StartTestTime"/></xsl:variable>
<xsl:variable name="TotalTests"><xsl:value-of select="count(Testing/Test)"/></xsl:variable>
<xsl:variable name="Skipped"><xsl:value-of select="count(Testing/Test[@Status='notrun'])"/></xsl:variable>
<xsl:variable name="Disabled"><xsl:value-of select="count(Testing/Test/Results/Measurement[Value='Disabled'])"/></xsl:variable>
<xsl:variable name="Failed"><xsl:value-of select="count(Testing/Test[@Status='failed'])"/></xsl:variable>
<testsuite time="{$DoTime}" timestamp="{$StartDate}" tests="{$TotalTests}" failures="{$Failed}" skipped="{$Skipped}" disabled="{$Disabled}">
<xsl:variable name="BuildName"><xsl:value-of select="@BuildName"/></xsl:variable>
<xsl:variable name="BuildStamp"><xsl:value-of select="@BuildStamp"/></xsl:variable>
<xsl:variable name="Name"><xsl:value-of select="@Name"/></xsl:variable>
<xsl:variable name="Generator"><xsl:value-of select="@Generator"/></xsl:variable>
<xsl:variable name="CompilerName"><xsl:value-of select="@CompilerName"/></xsl:variable>
<xsl:variable name="OSName"><xsl:value-of select="@OSName"/></xsl:variable>
<xsl:variable name="Hostname"><xsl:value-of select="@Hostname"/></xsl:variable>
<xsl:variable name="OSRelease"><xsl:value-of select="@OSRelease"/></xsl:variable>
<xsl:variable name="OSVersion"><xsl:value-of select="@OSVersion"/></xsl:variable>
<xsl:variable name="OSPlatform"><xsl:value-of select="@OSPlatform"/></xsl:variable>
<xsl:variable name="Is64Bits"><xsl:value-of select="@Is64Bits"/></xsl:variable>
<xsl:variable name="VendorString"><xsl:value-of select="@VendorString"/></xsl:variable>
<xsl:variable name="VendorID"><xsl:value-of select="@VendorID"/></xsl:variable>
<xsl:variable name="FamilyID"><xsl:value-of select="@FamilyID"/></xsl:variable>
<xsl:variable name="ModelID"><xsl:value-of select="@ModelID"/></xsl:variable>
<xsl:variable name="ProcessorCacheSize"><xsl:value-of select="@ProcessorCacheSize"/></xsl:variable>
<xsl:variable name="NumberOfLogicalCPU"><xsl:value-of select="@NumberOfLogicalCPU"/></xsl:variable>
<xsl:variable name="NumberOfPhysicalCPU"><xsl:value-of select="@NumberOfPhysicalCPU"/></xsl:variable>
<xsl:variable name="TotalVirtualMemory"><xsl:value-of select="@TotalVirtualMemory"/></xsl:variable>
<xsl:variable name="TotalPhysicalMemory"><xsl:value-of select="@TotalPhysicalMemory"/></xsl:variable>
<xsl:variable name="LogicalProcessorsPerPhysical"><xsl:value-of select="@LogicalProcessorsPerPhysical"/></xsl:variable>
<xsl:variable name="ProcessorClockFrequency"><xsl:value-of select="@ProcessorClockFrequency"/></xsl:variable>
<properties>
<property name="BuildName" value="{$BuildName} {$DoTime}" />
<property name="BuildStamp" value="{$BuildStamp}" />
<property name="Name" value="{$Name}" />
<property name="Generator" value="{$Generator}" />
<property name="CompilerName" value="{$CompilerName}" />
<property name="OSName" value="{$OSName}" />
<property name="Hostname" value="{$Hostname}" />
<property name="OSRelease" value="{$OSRelease}" />
<property name="OSVersion" value="{$OSVersion}" />
<property name="OSPlatform" value="{$OSPlatform}" />
<property name="Is64Bits" value="{$Is64Bits}" />
<property name="VendorString" value="{$VendorString}" />
<property name="VendorID" value="{$VendorID}" />
<property name="FamilyID" value="{$FamilyID}" />
<property name="ModelID" value="{$ModelID}" />
<property name="ProcessorCacheSize" value="{$ProcessorCacheSize}" />
<property name="NumberOfLogicalCPU" value="{$NumberOfLogicalCPU}" />
<property name="NumberOfPhysicalCPU" value="{$NumberOfPhysicalCPU}" />
<property name="TotalVirtualMemory" value="{$TotalVirtualMemory}" />
<property name="TotalPhysicalMemory" value="{$TotalPhysicalMemory}" />
<property name="LogicalProcessorsPerPhysical" value="{$LogicalProcessorsPerPhysical}" />
<property name="ProcessorClockFrequency" value="{$ProcessorClockFrequency}" />
</properties>
<xsl:apply-templates select="Testing/Test"/>
<system-out>
BuildName: <xsl:value-of select="$BuildName" />
BuildStamp: <xsl:value-of select="$BuildStamp" />
Name: <xsl:value-of select="$Name" />
Generator: <xsl:value-of select="$Generator" />
CompilerName: <xsl:value-of select="$CompilerName" />
OSName: <xsl:value-of select="$OSName" />
Hostname: <xsl:value-of select="$Hostname" />
OSRelease: <xsl:value-of select="$OSRelease" />
OSVersion: <xsl:value-of select="$OSVersion" />
OSPlatform: <xsl:value-of select="$OSPlatform" />
Is64Bits: <xsl:value-of select="$Is64Bits" />
VendorString: <xsl:value-of select="$VendorString" />
VendorID: <xsl:value-of select="$VendorID" />
FamilyID: <xsl:value-of select="$FamilyID" />
ModelID: <xsl:value-of select="$ModelID" />
ProcessorCacheSize: <xsl:value-of select="$ProcessorCacheSize" />
NumberOfLogicalCPU: <xsl:value-of select="$NumberOfLogicalCPU" />
NumberOfPhysicalCPU: <xsl:value-of select="$NumberOfPhysicalCPU" />
TotalVirtualMemory: <xsl:value-of select="$TotalVirtualMemory" />
TotalPhysicalMemory: <xsl:value-of select="$TotalPhysicalMemory" />
LogicalProcessorsPerPhysical: <xsl:value-of select="$LogicalProcessorsPerPhysical" />
ProcessorClockFrequency: <xsl:value-of select="$ProcessorClockFrequency" />
</system-out>
</testsuite>
</xsl:template>
<xsl:template match="Testing/Test">
<xsl:variable name="testcasename"><xsl:value-of select="Name"/></xsl:variable>
<xsl:variable name="testclassname"><xsl:value-of select=" concat('this', substring(Path,2))"/></xsl:variable>
<xsl:variable name="exectime">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name='Execution Time'">
<xsl:value-of select="Value"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<testcase name="{$testcasename}" classname="{$testclassname}" time="{$exectime}">
<xsl:if test="@Status = 'passed'">
<system-out><xsl:value-of select="Results/Measurement/Value/text()"/></system-out>
</xsl:if>
<xsl:if test="@Status = 'failed'">
<xsl:variable name="failtype">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name = 'Exit Code'">
<xsl:value-of select="Value"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="failcode">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name = 'Exit Value'">
<xsl:value-of select="Value"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<failure message="{$failtype} ({$failcode})"><xsl:value-of select="Results/Measurement/Value/text()" /></failure>
</xsl:if>
<xsl:if test="@Status = 'notrun'">
<skipped><xsl:value-of select="Results/Measurement/Value/text()" /></skipped>
</xsl:if>
</testcase>
</xsl:template>
</xsl:stylesheet>
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
include( "${CMAKE_CURRENT_LIST_DIR}/macros.cmake" )
set( ENV{LANG} "C" ) # Only ascii output
get_filename_component( OTB_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY )
set( DEBUG "1" )
set( CMAKE_COMMAND "cmake" )
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
# retrieve XDK
get_xdk()
set( INSTALL_DIR "${XDK_PATH}" )
# FIX ME this part might platform dependent
set( GDAL_DATA "${XDK_PATH}/share/gdal" )
set( GEOTIFF_CSV "${XDK_PATH}/share/epsg_csv" )
set( PROJ_LIB "${XDK_PATH}/share" )
set( CTEST_ENVIRONMENT "PATH=${XDK_PATH}/lib:${XDK_PATH}/bin:$ENV{PATH}" )
set( ci_do_cookbook -1 )
set( ci_do_doxygen -1 )
include( "${CMAKE_CURRENT_LIST_DIR}/main_ci.cmake" )
sonar.projectKey=orfeotoolbox-otb
sonar.projectName=Orfeo Toolbox
sonar.projectDescription="Orfeo ToolBox is an open-source project for state-of-the-art remote sensing"
sonar.links.homepage="https://gitlab.orfeo-toolbox.org/sdinot/otb"
sonar.links.scm="https://gitlab.orfeo-toolbox.org/sdinot/otb.git"
sonar.links.ci="https://gitlab.orfeo-toolbox.org/sdinot/otb/pipelines"
sonar.sourceEncoding=UTF-8
sonar.language=c++
sonar.projectBaseDir=.
sonar.sources=Modules
sonar.cxx.includeDirectories=Modules
sonar.exclusions="Modules/ThirdParty/**"
sonar.cxx.suffixes.sources=.cpp,.cxx,.txx,.cc,.c
sonar.cxx.suffixes.headers=.hxx,.h
# Commented because the relative paths are not analyzed correctly
#sonar.cxx.jsonCompilationDatabase=build/compile_commands.json
sonar.cxx.compiler.parser=GCC
sonar.cxx.xunit.reportPath=build/ctest_report.xml
# Not provided yet
#sonar.cxx.coverage.reportPath=build/coverage_report.xml
sonar.cxx.cppcheck.reportPath=build/cppcheck_report.xml
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment