Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests in parallel in travis-ci #1569

Merged
merged 1 commit into from Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
110 changes: 110 additions & 0 deletions .mvn/wrapper/MavenWrapperDownloader.java
@@ -0,0 +1,110 @@
/*
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A review is not required, it's a middleware, it was generated by maven wrapper

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
*/

import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;

public class MavenWrapperDownloader {

/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL =
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";

/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";

/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";

/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";

public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: : " + url);

File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}

private static void downloadFileFromURL(String urlString, File destination) throws Exception {
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}

}
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
1 change: 1 addition & 0 deletions .mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A review is not required, it's a middleware, it was generated by maven wrapper

57 changes: 47 additions & 10 deletions .travis.yml
@@ -1,22 +1,57 @@
language: java
sudo: required
dist: trusty
jdk:
- oraclejdk8
before_install:
- ".travis_scripts/generate_keys.sh $encrypted_026743b97986_key $encrypted_026743b97986_iv"
- ".travis_scripts/setup_env.sh"
script:
- ".travis_scripts/verify.sh"
after_success:
- bash <(curl -s https://codecov.io/bash)
- ".travis_scripts/javadocs.sh"
jdk: oraclejdk8

stages:
- name: test
if: type = pull_request
- name: code_quality
if: branch = master AND type != pull_request

before_cache:
- rm -rf $HOME/.m2/repository/org/corfudb

cache:
directories:
- "$HOME/.m2"
- "$HOME/.sonar/cache"

before_install: |
./mvnw build-helper:parse-version versions:set \
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}-${TRAVIS_BUILD_NUMBER} \
-q

install: true

jobs:
include:
- stage: test
name: Unit Tests
script:
- ./mvnw -pl :test clean test -T 1C -am -Dtest.travisBuild=true
- script:
- ./mvnw -pl :test clean verify -T 1C -am -Pit -DskipTests -Dtest.travisBuild=true
name: Integration Tests
- script:
- ./mvnw -pl :universe clean verify -T 1C -am -Pit
name: Testing Framework Tests
- stage: code_quality
name: Code Quality
script:
- |
./mvnw verify -Pit sonar:sonar \
-Dtest.travisBuild=true \
-Dsonar.host.url=https://sonarqube.com \
-Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \
-Dsonar.github.repository=$TRAVIS_REPO_SLUG \
-Dsonar.github.oauth=$SONAR_GITHUB_TOKEN \
-Dsonar.organization=corfudb \
-Dsonar.login=$SONAR_TOKEN \
-Dmaven.javadoc.skip=true
- bash <(curl -s https://codecov.io/bash)
- .travis_scripts/javadocs.sh

notifications:
email:
- corfudb-dev@googlegroups.com
Expand All @@ -26,9 +61,11 @@ notifications:
on_success: always
on_failure: always
on_start: true

addons:
apt:
packages: reprepro

env:
global:
- secure: WJZd15DtGSetu3HuaPE/Ap0EaPkR1D68ZUIFxyqUho8AY/rLGuANUrAY5U02jO1K1+iaYFMecRr2ZlOEK4N1XiBNz2gMnYmkHmUs9Gz+J3eA8SXdYOHsKyI5iRpyUgwzHIVLOKz03cvDlI04Rrm0Uhe/7hjNaXVge6I0YKPmiXI=
Expand Down
5 changes: 0 additions & 5 deletions .travis_scripts/generate_keys.sh

This file was deleted.

3 changes: 1 addition & 2 deletions .travis_scripts/javadocs.sh
Expand Up @@ -4,8 +4,7 @@ if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; th
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ]; then
echo -e "Publishing javadocs..."

mvn -N io.takari:maven:wrapper -Dmaven=3.3.9
mvn javadoc:javadoc -DskipTests=true
./mvnw javadoc:javadoc -DskipTests=true
cp -R target/site/apidocs $HOME/javadoc
cd $HOME
git config --global user.email "travis@travis-ci.org"
Expand Down
16 changes: 0 additions & 16 deletions .travis_scripts/setup_env.sh

This file was deleted.

23 changes: 0 additions & 23 deletions .travis_scripts/verify.sh

This file was deleted.