Skip to content

Commit

Permalink
Enable QA pipeline at SonarSource
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Brandhof committed Feb 10, 2016
1 parent a1be1bb commit e851411
Show file tree
Hide file tree
Showing 44 changed files with 53,503 additions and 86 deletions.
28 changes: 28 additions & 0 deletions .cix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Definition of QA pipeline at SonarSource
#
# Possible values for SLAVE_TYPE: "performance" (for perf tests) and "gva" (for linux machines connected to DB services)


RUN_ACTIVITY:
- run-db-unit-tests-mysql56
- run-db-unit-tests-mssql2012
- run-db-unit-tests-mssql2014
- run-db-unit-tests-oracle11g
- run-db-unit-tests-oracle12c
- run-db-unit-tests-postgresql93

exclude:
- RUN_ACTIVITY: run-db-unit-tests-mysql56
SLAVE_TYPE: performance
- RUN_ACTIVITY: run-db-unit-tests-mssql2012
SLAVE_TYPE: performance
- RUN_ACTIVITY: run-db-unit-tests-mssql2014
SLAVE_TYPE: performance
- RUN_ACTIVITY: run-db-unit-tests-oracle11g
SLAVE_TYPE: performance
- RUN_ACTIVITY: run-db-unit-tests-oracle12c
SLAVE_TYPE: performance
- RUN_ACTIVITY: run-db-unit-tests-postgresql93
SLAVE_TYPE: performance
- RUN_ACTIVITY: run-perf-tests
SLAVE_TYPE: gva
28 changes: 15 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ install: true
jdk: oraclejdk7
script: ./travis.sh

env:
- TARGET=CI
- TARGET=IT IT_CATEGORY=Category1
- TARGET=IT IT_CATEGORY=Category2
- TARGET=IT IT_CATEGORY=Category3
- TARGET=IT IT_CATEGORY=Category4
- TARGET=IT IT_CATEGORY=Plugins
- TARGET=POSTGRES
- TARGET=MYSQL
- TARGET=WEB
#env:
# - TARGET=CI
# - TARGET=IT IT_CATEGORY=Category1
# - TARGET=IT IT_CATEGORY=Category2
# - TARGET=IT IT_CATEGORY=Category3
# - TARGET=IT IT_CATEGORY=Category4
# - TARGET=IT IT_CATEGORY=Plugins
# - TARGET=POSTGRES
# - TARGET=MYSQL
# - TARGET=WEB


matrix:
Expand All @@ -27,9 +27,11 @@ cache:
- 'server/sonar-web/node_modules'

before_cache:
- 'find ~/.m2/repository -type d -name \*-SNAPSHOT -exec rm -rf {} \;'
- 'find ~/.m2/repository -name maven-metadata-\* -exec rm {} \;'
- 'find ~/.m2/repository -name resolver-status.properties -exec rm {} \;'
- 'find $HOME/.m2/repository -type d -name \*-SNAPSHOT -exec rm -rf {} \;'
- 'find $HOME/.m2/repository -name maven-metadata-\* -exec rm {} \;'
- 'find $HOME/.m2/repository -name resolver-status.properties -exec rm {} \;'
# remove all the artifacts (JAR, ZIP) that are installed in local repo because of mvn deploy
- rm -rf $HOME/.m2/repository/org/sonarsource/sonarqube

notifications:
email: false
Expand Down
36 changes: 36 additions & 0 deletions cix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
#

set -euo pipefail

case "$RUN_ACTIVITY" in

run-db-unit-tests-*)
DB_ENGINE=`echo $RUN_ACTIVITY | sed "s/run-db-unit-tests-//g"`

./run-db-unit-tests.sh "http://infra.internal.sonarsource.com/jenkins/orch-${DB_ENGINE}.properties"
;;

run-db-integration-tests-*)
DB_ENGINE=`echo $RUN_ACTIVITY | sed "s/run-db-integration-tests-//g" | cut -d \- -f 1`
CATEGORY=`echo $RUN_ACTIVITY | sed "s/run-db-integration-tests-//g" | cut -d \- -f 2`

echo "./run-db-integration-tests.sh $DB_ENGINE $CATEGORY $SLAVE_TYPE"
;;

run-upgrade-tests-*)
DB_ENGINE=`echo $RUN_ACTIVITY | sed "s/run-upgrade-tests-//g"`

echo "./run-upgrade-tests.sh $DB_ENGINE $SLAVE_TYPE"
;;

run-perf-tests)
./run-perf-tests.sh
;;

*)
echo "unknown RUN_ACTIVITY = $RUN_ACTIVITY"
exit 1
;;

esac
86 changes: 77 additions & 9 deletions it/it-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,14 @@
<dependency>
<groupId>org.sonarsource.orchestrator</groupId>
<artifactId>sonar-orchestrator</artifactId>
<version>3.10.1</version>
<version>${orchestrator.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-xoo-plugin</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<groupId>${project.groupId}</groupId>
<artifactId>sonar-application</artifactId>
<version>${project.version}</version>
<type>zip</type>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -121,7 +116,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xmx128m -Dsonar.runtimeVersion=${project.version}</argLine>
<argLine>-Xmx128m -Dsonar.runtimeVersion=${project.version} -Dmaven.localRepository=${settings.localRepository}</argLine>
<skipTests>${skipIts}</skipTests>
<includes>
<include>*/${category}Suite.java</include>
Expand All @@ -131,4 +126,77 @@
</plugins>
</build>

<profiles>
<profile>
<id>qa</id>
<activation>
<property>
<name>env.SONARSOURCE_QA</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-xoo-plugin</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>sonar-xoo-plugin</artifactId>
<version>${project.version}</version>
<type>sonar-plugin</type>
<overWrite>true</overWrite>
</artifactItem>
</artifactItems>
<outputDirectory>../../plugins/sonar-xoo-plugin/target</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>with-db-drivers</id>
<activation>
<property>
<name>with-db-drivers</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
</dependency>
<dependency>
<groupId>com.microsoft.sqljdbc</groupId>
<artifactId>sqljdbc41</artifactId>
<version>4.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/../../sonar-application/src/main/assembly/lib/jdbc/mssql/sqljdbc41.jar
</systemPath>
</dependency>
</dependencies>
</profile>
</profiles>

</project>
9 changes: 6 additions & 3 deletions it/it-tests/src/test/java/it/Category1Suite.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,17 @@
import it.projectAdministration.BackgroundTasksTest;
import it.projectAdministration.BulkDeletionTest;
import it.projectAdministration.ProjectAdministrationTest;
import it.projectServices.*;
import it.projectServices.AllProjectsTest;
import it.projectServices.ProjectCodeTest;
import it.projectServices.ProjectComparisonTest;
import it.projectServices.ProjectDrilldownTest;
import it.projectServices.ProjectOverviewTest;
import it.projectServices.ProjectWidgetsTest;
import it.qualityGate.QualityGateNotificationTest;
import it.qualityGate.QualityGateTest;
import it.qualityGate.QualityGateUiTest;
import it.settings.PropertySetsTest;
import it.settings.SettingsTest;
import it.settings.SettingsTestRestartingOrchestrator;
import it.settings.SubCategoriesTest;
import it.user.MyAccountPageTest;
import org.junit.ClassRule;
Expand Down Expand Up @@ -91,7 +95,6 @@
PropertySetsTest.class,
SubCategoriesTest.class,
SettingsTest.class,
SettingsTestRestartingOrchestrator.class,
// i18n
I18nTest.class,
// quality gate
Expand Down
9 changes: 0 additions & 9 deletions it/it-tests/src/test/java/it/Category4Suite.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@
import it.duplication.CrossProjectDuplicationsOnRemoveFileTest;
import it.duplication.CrossProjectDuplicationsTest;
import it.duplication.DuplicationsTest;
import it.serverSystem.HttpsTest;
import it.serverSystem.RestartTest;
import it.serverSystem.ServerSystemRestartingOrchestrator;
import it.serverSystem.ServerSystemTest;
import it.updateCenter.UpdateCenterTest;
import it.user.FavouriteTest;
import it.user.ForceAuthenticationTest;
import org.junit.ClassRule;
Expand All @@ -44,18 +40,13 @@
@RunWith(Suite.class)
@Suite.SuiteClasses({
// server system
RestartTest.class,
HttpsTest.class,
ServerSystemTest.class,
ServerSystemRestartingOrchestrator.class,
// user
ForceAuthenticationTest.class,
FavouriteTest.class,
// component search
ProjectSearchTest.class,
ComponentsWsTest.class,
// update center
UpdateCenterTest.class,
// analysis exclusion
FileExclusionsTest.class,
IssueExclusionsTest.class,
Expand Down
47 changes: 47 additions & 0 deletions it/it-tests/src/test/java/it/Category5Suite.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* SonarQube
* Copyright (C) 2009-2016 SonarSource SA
* mailto:contact AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package it;

import it.serverSystem.HttpsTest;
import it.serverSystem.RestartTest;
import it.serverSystem.ServerSystemRestartingOrchestrator;
import it.settings.SettingsTestRestartingOrchestrator;
import it.updateCenter.UpdateCenterTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

/**
* This suite is reserved to the tests that start their own instance of Orchestrator.
* Indeed multiple instances of Orchestrator can't be started in parallel, so this
* suite does not declare a shared Orchestrator.
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
ServerSystemRestartingOrchestrator.class,
RestartTest.class,
HttpsTest.class,
SettingsTestRestartingOrchestrator.class,
// update center
UpdateCenterTest.class

})
public class Category5Suite {

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
import org.junit.rules.ExpectedException;
import util.selenium.SeleneseTest;

import static util.ItUtils.*;
import static util.ItUtils.pluginArtifact;
import static util.ItUtils.projectDir;
import static util.ItUtils.xooPlugin;

/**
* This class start a new orchestrator on each test case
Expand Down
Loading

0 comments on commit e851411

Please sign in to comment.