Skip to content

Commit

Permalink
Merge pull request #294 from powerunit/project/0.2.0/#293
Browse files Browse the repository at this point in the history
Create real integration test with dedicated maven run and isolate plugin from hamcrest version
  • Loading branch information
boretti committed May 22, 2020
2 parents 8445191 + 7c1bea3 commit 31d9e80
Show file tree
Hide file tree
Showing 319 changed files with 17,892 additions and 3,069 deletions.
2 changes: 2 additions & 0 deletions .bettercodehub.yml
@@ -1,3 +1,5 @@
component_depth: 8
languages:
- java
exclude:
- /src/it/.*
1 change: 1 addition & 0 deletions .codebeatignore
@@ -0,0 +1 @@
src/it/**
25 changes: 19 additions & 6 deletions .travis.yml
Expand Up @@ -15,19 +15,32 @@ addons:
before_install:
- cp .travis.settings.xml $HOME/.m2/settings.xml
- if [[ "$TRAVIS_OS_NAME" = linux ]]; then sudo apt-get install jshon ; fi
- mkdir -p $HOME/.script
- curl -s https://report.ci/annotate.py > $HOME/.script/annotate.py
- curl -s https://report.ci/upload.py > $HOME/.script/upload.py
- curl -s https://codecov.io/bash > $HOME/.script/codecov.bash
- chmod +x $HOME/.script/codecov.bash
- chmod +x .travisci/*.sh
install:
- "mvn dependency:resolve dependency:resolve-plugins"
- .travisci/getcodacy.sh
script:
- "mvn -e clean install"
- set -o pipefail
- "mvn -e clean install 2>&1 | tee maven.log"
after_failure:
- set +o pipefail
- rm -rf target/local-repo
- .travisci/reportci.sh
after_success:
- set +o pipefail
- rm -rf target/local-repo
- .travisci/reportci.sh
- "mvn jacoco:report coveralls:report -DrepoToken=${repoToken}"
- "bash <(curl -s https://codecov.io/bash) -c -Funit$TRAVIS_OS_NAME$TRAVIS_JDK_VERSION"
- "mvn jacoco:report-integration"
- "bash <(curl -s https://codecov.io/bash) -c -Fcompiler$TRAVIS_OS_NAME$TRAVIS_JDK_VERSION"
- "mvn org.apache.maven.plugins:maven-dependency-plugin:copy -Dartifact=com.codacy:codacy-coverage-reporter:5.0.310:jar:assembly -Dtransitive"
- .travisci/codecov.sh
- "mvn jacoco:merge -Djacoco.destFile=target/jacoco-aggregate.exe"
- "mvn jacoco:report -Djacoco.dataFile=target/jacoco-aggregate.exe"
- "(cd target/dependency && java -jar codacy-coverage-reporter-5.0.310-assembly.jar report -l Java -r ../site/jacoco/jacoco.xml)"
- "(java -jar $HOME/.script/codacy-coverage-reporter.jar report -l Java -r target/site/jacoco/jacoco.xml)"
- "$HOME/.script/codecov.bash -Ffull$TRAVIS_OS_NAME$TRAVIS_JDK_VERSION"
- "mvn site"
before_deploy:
- git config --local user.name "powerunitci"
Expand Down
18 changes: 18 additions & 0 deletions .travisci/codecov.sh
@@ -0,0 +1,18 @@
#!/bin/sh

mvn jacoco:report
"$HOME/.script/codecov.bash" -F"unit$TRAVIS_OS_NAME$TRAVIS_JDK_VERSION"
mvn jacoco:report-integration
"$HOME/.script/codecov.bash" -F"compiler$TRAVIS_OS_NAME$TRAVIS_JDK_VERSION"

(cd target/it &&
for name in * ; do
(cd "$name" && test -e "build.log" &&
(
mvn jacoco:report &&
"$HOME/.script/codecov.bash" -s . -F"unit$(echo "$name" | sed 's/[+-]//g')$TRAVIS_OS_NAME$TRAVIS_JDK_VERSION" || echo 'NOT POSSIBLE';
mvn jacoco:report-integration &&
"$HOME/.script/codecov.bash" -s . -F"compiler$(echo "$name" | sed 's/[+-]//g')$TRAVIS_OS_NAME$TRAVIS_JDK_VERSION" || echo 'NOT POSSIBLE';
)
);
done;)
9 changes: 9 additions & 0 deletions .travisci/getcodacy.sh
@@ -0,0 +1,9 @@
#!/bin/sh

if test "$TRAVIS_JDK_VERSION" = openjdk8 ; then
mvn org.apache.maven.plugins:maven-dependency-plugin:copy -Dartifact=com.codacy:codacy-coverage-reporter:5.0.310:jar:assembly -Dmdep.stripVersion=true -Dmdep.stripClassifier=true -Dtransitive;
else
mvn org.apache.maven.plugins:maven-dependency-plugin:copy -Dartifact=com.codacy:codacy-coverage-reporter:6.0.0:jar:assembly -Dmdep.stripVersion=true -Dmdep.stripClassifier=true -Dtransitive;
fi;

cp target/dependency/codacy-coverage-reporter.jar "$HOME/.script"
11 changes: 11 additions & 0 deletions .travisci/reportci.sh
@@ -0,0 +1,11 @@
#!/bin/sh

python - --name "annotate$TRAVIS_OS_NAME$TRAVIS_JDK_VERSION" --tool java --input maven.log < "$HOME/.script/annotate.py"

python - --name "upload$TRAVIS_OS_NAME$TRAVIS_JDK_VERSION" --include='*.xml' --framework=junit < "$HOME/.script/upload.py"

(cd target/it &&
for name in * ; do
python - --name "$name-$TRAVIS_OS_NAME$TRAVIS_JDK_VERSION" --tool java --input "$name/build.log" < "$HOME/.script/annotate.py" || echo 'NOT FOUND';
done;)

166 changes: 55 additions & 111 deletions pom.xml
Expand Up @@ -57,7 +57,6 @@
<java.source.version>1.8</java.source.version>
<java.target.version>1.8</java.target.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hamcrest.version>1.3</hamcrest.version>
<surefire.version>2.22.2</surefire.version>
<deploy.url>https://oss.sonatype.org/content/repositories/snapshots</deploy.url>
<deploy.id>oss-snapshots</deploy.id>
Expand Down Expand Up @@ -294,6 +293,7 @@
<directory>${project.build.directory}</directory>
<includes>
<include>*.exec</include>
<include>it/**/*.exec</include>
</includes>
</fileSet>
</fileSets>
Expand All @@ -318,6 +318,43 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<preBuildHookScript>prepare.bsh</preBuildHookScript>
<postBuildHookScript>verify.bsh</postBuildHookScript>
<settingsFile>src/it/settings.xml</settingsFile>
<invokerPropertiesFile>params.properties</invokerPropertiesFile>
<streamLogs>true</streamLogs>
<parallelThreads>3</parallelThreads>
<extraArtifacts>
<extraArtifact>org.hamcrest:hamcrest:2.2:jar</extraArtifact>
<extraArtifact>org.hamcrest:hamcrest:2.1:jar</extraArtifact>
</extraArtifacts>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>install</goal>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-archetype-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>update-local-catalog</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand All @@ -333,9 +370,6 @@
<excludePackageNames>ch.powerunit.extensions.matchers.factoryprocessor*:ch.powerunit.extensions.matchers.provideprocessor*:ch.powerunit.extensions.matchers.common*</excludePackageNames>
<docfilessubdirs>true</docfilessubdirs>
<linksource>false</linksource>
<links>
<link>http://hamcrest.org/JavaHamcrest/javadoc/1.3/</link>
</links>
<detectLinks />
<footer><![CDATA[<img src="http://www.powerunit.ch/powerunit/logo.png" width="80%" height="80%"/>]]></footer>
</configuration>
Expand Down Expand Up @@ -379,7 +413,6 @@
<fork>true</fork>
<compilerArgs>
<compilerArg>-J${testcompileargs}</compilerArg>
<compilerArg>-Ach.powerunit.extensions.matchers.factoryprocessor.FactoryAnnotationsProcessor.targets=.*:ch.powerunit.extensions.matchers.samples.AllMatchers</compilerArg>
<compilerArg>-Ach.powerunit.extensions.matchers.provideprocessor.ProvidesMatchersAnnotationsProcessor.factory=ch.powerunit.extensions.matchers.samples.AllMatchersAlternate</compilerArg>
</compilerArgs>
</configuration>
Expand Down Expand Up @@ -426,36 +459,6 @@
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${basedir}</dir>
<outputDir>${project.build.directory}</outputDir>
<includes>
<include>pom.xml</include>
</includes>
<stylesheet>src/main/xslt/only-providematchers.xsl</stylesheet>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.RegExpFileMapper">
<pattern>.xml$</pattern>
<replacement>-only-providematchers.xml</replacement>
</fileMapper>
</fileMappers>
</transformationSet>
<transformationSet>
<dir>${basedir}</dir>
<outputDir>${project.build.directory}</outputDir>
<includes>
<include>pom.xml</include>
</includes>
<stylesheet>src/main/xslt/only-factory.xsl</stylesheet>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.RegExpFileMapper">
<pattern>.xml$</pattern>
<replacement>-only-factory.xml</replacement>
</fileMapper>
</fileMappers>
</transformationSet>
<transformationSet>
<dir>${basedir}</dir>
<outputDir>${project.build.directory}</outputDir>
Expand All @@ -474,38 +477,11 @@
</transformationSets>
</configuration>
</execution>

</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>only-providematchers</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assemble/only-providematchers.xml</descriptor>
</descriptors>
<attach>false</attach>
</configuration>
</execution>
<execution>
<id>only-factory</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assemble/only-factory.xml</descriptor>
</descriptors>
<attach>false</attach>
</configuration>
</execution>
<execution>
<id>archetype</id>
<phase>package</phase>
Expand Down Expand Up @@ -538,16 +514,19 @@
<pomFile>${project.build.directory}/pom-archetype.xml</pomFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-archetype-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<id>install archetype for test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>update-local-catalog</goal>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.build.directory}/${project.artifactId}-${project.version}-archetype.jar</file>
<artifactId>${project.artifactId}-archetype</artifactId>
<groupId>${project.groupId}</groupId>
<pomFile>${project.build.directory}/pom-archetype.xml</pomFile>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
</configuration>
</execution>
</executions>
</plugin>
Expand All @@ -557,6 +536,13 @@
<version>4.3.0</version>
<configuration>
</configuration>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
</plugin>

</plugins>
Expand Down Expand Up @@ -619,40 +605,6 @@
<goal>sign</goal>
</goals>
</execution>
<execution>
<id>sign-and-deploy-provide</id>
<phase>deploy</phase>
<goals>
<goal>sign-and-deploy-file</goal>
</goals>
<configuration>
<url>${deploy.url}</url>
<file>${project.build.directory}/${project.artifactId}-${project.version}-only-providematchers.jar</file>
<artifactId>${project.artifactId}-providematchers</artifactId>
<groupId>${project.groupId}</groupId>
<pomFile>${project.build.directory}/pom-only-providematchers.xml</pomFile>
<repositoryId>${deploy.id}</repositoryId>
<javadoc>${project.build.directory}/${project.artifactId}-${project.version}-javadoc.jar</javadoc>
<sources>${project.build.directory}/${project.artifactId}-${project.version}-sources.jar</sources>
</configuration>
</execution>
<execution>
<id>sign-and-deploy-factory</id>
<phase>deploy</phase>
<goals>
<goal>sign-and-deploy-file</goal>
</goals>
<configuration>
<url>${deploy.url}</url>
<file>${project.build.directory}/${project.artifactId}-${project.version}-only-factory.jar</file>
<artifactId>${project.artifactId}-factory</artifactId>
<groupId>${project.groupId}</groupId>
<pomFile>${project.build.directory}/pom-only-factory.xml</pomFile>
<repositoryId>${deploy.id}</repositoryId>
<javadoc>${project.build.directory}/${project.artifactId}-${project.version}-javadoc.jar</javadoc>
<sources>${project.build.directory}/${project.artifactId}-${project.version}-sources.jar</sources>
</configuration>
</execution>
<execution>
<id>sign-and-deploy-archetype</id>
<phase>deploy</phase>
Expand Down Expand Up @@ -687,9 +639,6 @@
<excludePackageNames>ch.powerunit.extensions.matchers.factoryprocessor*:ch.powerunit.extensions.matchers.provideprocessor*:ch.powerunit.extensions.matchers.common*</excludePackageNames>
<docfilessubdirs>true</docfilessubdirs>
<linksource>true</linksource>
<links>
<link>http://hamcrest.org/JavaHamcrest/javadoc/1.3/</link>
</links>
<detectLinks />
<footer><![CDATA[<img src="http://www.powerunit.ch/powerunit/logo.png" width="80%" height="80%"/>]]></footer>
</configuration>
Expand Down Expand Up @@ -743,11 +692,6 @@
</reporting>

<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>${hamcrest.version}</version>
</dependency>
<dependency>
<groupId>ch.powerunit</groupId>
<artifactId>powerunit</artifactId>
Expand Down
43 changes: 0 additions & 43 deletions src/assemble/only-factory.xml

This file was deleted.

0 comments on commit 31d9e80

Please sign in to comment.