Skip to content

Commit

Permalink
Merge pull request #18 from scalecube/Enable_codacy_on_projects#15
Browse files Browse the repository at this point in the history
Enable codacy on projects (fix for #15)
  • Loading branch information
aharonha authored Aug 7, 2018
2 parents 4c7c9d8 + d8aef4c commit d0efc91
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 5 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ language: generic
sudo: required

env:
- SLUG=scalecube/scalecube-cluster
- SLUG=scalecube/scalecube-parent
- SLUG=scalecube/scalecube-security
- SLUG=scalecube/scalecube-app-utils
- SLUG=scalecube/config
- SLUG=scalecube/scalecube-benchmarks
- SLUG=scalecube/scalecube-parent
- SLUG=scalecube/scalecube-gateway

services:
- docker

Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ RUN apt-get install -qy jq maven
RUN ruby -v
RUN mvn -version
RUN gem install travis

ADD entrypoint.sh /opt
ADD travis-settings.xml /opt
ADD append.to.travis.yml /opt
ADD prepend.to.travis.yml /opt

Expand Down
5 changes: 3 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ mkdir -p ~/repo/src/main/scripts/ci/
cp ~/src/main/scripts/ci/*.sh $TRAVIS_BUILD_DIR/src/main/scripts/ci/
chmod u+x $TRAVIS_BUILD_DIR/src/main/scripts/ci/*.sh

cp ~/opt/travis-settings.xml $TRAVIS_BUILD_DIR/

git add --all
git commit -am "+ script files" | true

Expand All @@ -43,7 +45,7 @@ if [ ! -f '.travis.yml' ]; then
travis init java --jdk openjdk8 \
--before-install "./src/main/scripts/ci/before-install.sh" \
--before-install "./src/main/scripts/cd/before-deploy.sh" \
--after-success "java -jar ~/codacy-coverage-reporter-assembly.jar -l Java -r ./target/site/jacoco/jacoco.xml"
--after-success "./src/main/scripts/ci/after-success.sh"

cat /opt/prepend.to.travis.yml .travis.yml /opt/append.to.travis.yml >> tmp.travis.yml
mv tmp.travis.yml .travis.yml
Expand Down Expand Up @@ -106,7 +108,6 @@ fi

mvn -B -q -f $TRAVIS_BUILD_DIR/pom.xml -s $TRAVIS_BUILD_DIR/travis-settings.xml -P release \
help:evaluate -Dexpression=gpg.passphrase -Doutput=/tmp/gpg.passphrase
// TODO

mvn -B -q -f $TRAVIS_BUILD_DIR/pom.xml -s $TRAVIS_BUILD_DIR/travis-settings.xml -P release \
fr.jcgay.maven.plugins:buildplan-maven-plugin:list-plugin -Dbuildplan.plugin=nexus-staging-maven-plugin -Dbuildplan.outputFile=/tmp/nexus-staging-maven-plugin
Expand Down
8 changes: 8 additions & 0 deletions src/main/scripts/ci/after-success.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

if [ -z "$CODACY_PROJECT_TOKEN" ]; then
echo [WARNING] Please go to https://app.codacy.com/app/$TRAVIS_REPO_SLUG/settings/coverage and add CODACY_PROJECT_TOKEN to travis settings
else
find -name jacoco.xml -exec java -jar ~/codacy-coverage-reporter-assembly.jar report -l Java -r {} --partial\;
java -jar ~/codacy-coverage-reporter-assembly.jar final
fi;
41 changes: 41 additions & 0 deletions travis-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<settings
xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
xmlns='http://maven.apache.org/SETTINGS/1.0.0'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<profiles>
<profile>
<id>bintray</id>
<repositories>
<repository>
<id>central</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.passphrase>${env.GPG_KEY}</gpg.passphrase>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>bintray</activeProfile>
</activeProfiles>

<servers>
<server>
<id>ossrh</id>
<username>${env.SONATYPE_USERNAME}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
</servers>
</settings>

0 comments on commit d0efc91

Please sign in to comment.