Skip to content

Commit

Permalink
updated worflow with sonar token and pom and settings file
Browse files Browse the repository at this point in the history
  • Loading branch information
kcs-bandihareesh committed Oct 3, 2024
1 parent 3ebcac3 commit 0a8d0de
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 121 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/vertx-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ jobs:
run: cp ./travis/new-settings.xml ~/.m2/settings.xml

- name: Build and test with Maven
run: mvn -e -Pcoverage verify
run: mvn -e -Pcoverage verify sonar:sonar
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Show Surefire test reports on failure
if: failure()
Expand Down Expand Up @@ -72,13 +74,11 @@ jobs:
env:
GCP_ACCESS_TOKEN: ${{ secrets.GCP_ACCESS_TOKEN }}

- name: Deploy Snapshots with Retry Logic
- name: Deploy Snapshots
run: |
for i in {1..3}; do
mvn -Dmaven.wagon.http.retryHandler.count=10 \
-Dmaven.wagon.httpconnectionManager.ttlSeconds=60 \
-Dmaven.wagon.http.timeout=3600000 \
--batch-mode -e -DskipTests=true deploy -X && break || sleep 30;
done
mvn -Dmaven.wagon.http.retryHandler.count=5 \
-Dmaven.wagon.httpconnectionManager.ttlSeconds=30 \
-Dmaven.wagon.http.timeout=1200000 \
--batch-mode -e -DskipTests=true deploy -X
env:
GCP_ACCESS_TOKEN: ${{ secrets.GCP_ACCESS_TOKEN }}
130 changes: 20 additions & 110 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.github.susom</groupId>
Expand All @@ -15,6 +17,9 @@
<vertx.version>3.9.13</vertx.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sonar.projectKey>susom_vertx-base</sonar.projectKey>
<sonar.organization>susom</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>

<dependencies>
Expand Down Expand Up @@ -165,6 +170,7 @@

<build>
<plugins>
<!-- Compiler Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand All @@ -174,6 +180,8 @@
<target>17</target>
</configuration>
</plugin>

<!-- Shade Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand Down Expand Up @@ -203,87 +211,32 @@
<shadedPattern>com.github.susom.vertx.base.shaded.org.apache.commons.lang3</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>*.astub</exclude>
<exclude>META-INF/**/*</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>default-jar</id>
<goals>
<goal>jar</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</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>
<configuration>
<includes>
<include>com/github/susom/**/*</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>

<!-- SonarCloud Maven Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.5.0</version>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.9.1.2184</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
<goal>sonar</goal>
</goals>
<configuration>
<doclint>none</doclint>
</configuration>
</execution>
</executions>
</plugin>
<!-- NOTE: We are using the maven release plugin to deploy to Maven Central, see:
https://central.sonatype.org/pages/apache-maven.html#performing-a-release-deployment-with-the-maven-release-plugin
for explanation as to why the useReleaseProfile is set to false. -->

<!-- Surefire Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -316,48 +269,5 @@
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.keyname>${env.GPG_KEY_NAME}</gpg.keyname>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
<distributionManagement>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.6</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
6 changes: 3 additions & 3 deletions travis/new-settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
</put>
</httpConfiguration>
</configuration>
<username>oauth2accesstoken</username>
<password>${env.GCP_ACCESS_TOKEN}</password>
<username>_json_key_base64</username>
<password>${env.ARTIFACT_REGISTRY_KEY}</password>
</server>
<server>
<id>ossrh</id>
Expand All @@ -37,4 +37,4 @@
<password>${env.GITHUB_TOKEN}</password>
</server>
</servers>
</settings>
</settings>

0 comments on commit 0a8d0de

Please sign in to comment.