Skip to content

Commit

Permalink
Improve travis-ci test and deploy phases (#1)
Browse files Browse the repository at this point in the history
- Add OpenJDK 8 and 11 runtimes
- Make sure checkstyle runs during test phase
- Move deploy into a stage so it only runs once after tests pass
- Reduce log noise from maven downloads
- Cache maven repo
- Add badges to readme
- Add a release maven profile
  • Loading branch information
gschneider-r7 authored Nov 9, 2018
1 parent b2899c3 commit d89a28a
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 77 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ atlassian-ide-plugin.xml
# Maven
/.repostory/

# Visual Studio Code
/.vscode/

# PD Build Tools #
##################
Expand Down
49 changes: 31 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
language: java
jdk:
- oraclejdk8
install:
- mvn --settings .travis/settings.xml install -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -B -V
- openjdk8
- openjdk11
matrix:
allow_failures:
- jdk: openjdk11
install: true
before_install:
- if [ ! -z "$GPG_SECRET_KEYS" ]; then echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import; fi
- if [ ! -z "$GPG_OWNERTRUST" ]; then echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust; fi
deploy:
-
provider: script
script: .travis/deploy.sh
skip_cleanup: true
on:
repo: rapid7/docker-image-analyzer
branch: master
jdk: oraclejdk8
-
provider: script
script: .travis/deploy.sh
skip_cleanup: true
on:
repo: rapid7/docker-image-analyzer
tags: true
script:
- mvn test -Dgpg.skip -Dmaven.javadoc.skip=true -B -V -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
jobs:
include:
- stage: deploy
if: branch =~ /^(?:master|\d+\.\d+(\.\d+)?(-\S*)?)$/ AND type != pull_request AND fork = false
script: skip
jdk: oraclejdk8
deploy:
-
provider: script
script: .travis/deploy.sh
skip_cleanup: true
on:
repo: rapid7/docker-image-analyzer
branch: master
-
provider: script
script: .travis/deploy.sh
skip_cleanup: true
on:
repo: rapid7/docker-image-analyzer
tags: true
cache:
directories:
- $HOME/.m2
2 changes: 1 addition & 1 deletion .travis/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ else
echo "not on a tag -> keep snapshot version in pom.xml"
fi

mvn clean deploy --settings .travis/settings.xml -DskipTests=true -B -U
mvn clean deploy --settings .travis/settings.xml -DskipTests=true -Dmaven.antrun.skip=true -Prelease -B -V -U -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Docker Image Analyzer


[![Travis (.org)](https://img.shields.io/travis/rapid7/docker-image-analyzer.svg)](https://travis-ci.org/rapid7/docker-image-analyzer) [![Maven Central](https://img.shields.io/maven-central/v/com.rapid7.docker/docker-image-analyzer.svg)](https://search.maven.org/artifact/com.rapid7.docker/docker-image-analyzer)

Extracts, parses, and analyzes [Docker](https://www.docker.com) images into Java objects with JSON mappings.

## Getting Started
Expand Down
130 changes: 72 additions & 58 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</scm>

<properties>
<r7.recog.java.version>1.0.5</r7.recog.java.version>
<r7.recog.java.version>0.7.0</r7.recog.java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -26,7 +26,7 @@
<dependencies>
<!-- Rapid7 dependencies -->
<dependency>
<groupId>org.rapid7.recog</groupId>
<groupId>com.rapid7.recog</groupId>
<artifactId>recog-java</artifactId>
<version>${r7.recog.java.version}</version>
</dependency>
Expand Down Expand Up @@ -155,62 +155,6 @@
</dependencies>
</plugin>

<!-- TODO: uncomment when using travis-ci to publish to maven central
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand All @@ -222,6 +166,7 @@
<executions>
<execution>
<id>checkstyle</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
Expand All @@ -241,4 +186,73 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<activation>
<property>
<name>release</name>
</property>
</activation>

<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit d89a28a

Please sign in to comment.