Skip to content

Commit

Permalink
Merge pull request #36 from adobe/activate-ssonar
Browse files Browse the repository at this point in the history
Activated sonar on the deplyment build
  • Loading branch information
baubakg authored Dec 16, 2021
2 parents ea1c15e + ee3c423 commit d0ddd93
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 16 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/maven-publish-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ name: Deploy-Log-Parser
# Run workflow on commits to default branch
on:
pull_request:
branches: [ master ]
branches: [ main ]

workflow_dispatch :

Expand All @@ -29,12 +29,17 @@ jobs:
- uses: actions/checkout@v2

# Set up environment with Java and Maven
- name: Set up JDK
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 8

# Set up dependency cache
java-version: 11
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
# Set up dependency cache
- name: Cache local Maven repository
uses: actions/cache@v2
with:
Expand All @@ -50,7 +55,14 @@ jobs:
run: |
echo $GPG_SECRET_KEYS | base64 --decode | gpg --import --no-tty --batch --yes
echo $GPG_OWNERTRUST | base64 --decode | gpg --import-ownertrust --no-tty --batch --yes
- name: Build and analyze SONAR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_ARTIFACTORY_USER: ${{ secrets.OSSRH_ARTIFACTORY_USER }}
OSSRH_ARTIFACTORY_API_TOKEN: ${{ secrets.OSSRH_ARTIFACTORY_API_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=adobe_log-parser -Prelease,ossrh -s .github/workflows/settings.xml
- name: Configure git user for release commits
env:
X_GITHUB_USERNAME: ${{ secrets.ADOBE_BOT_GITHUB_USERNAME }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven-publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 8
java-version: 11

# Set up dependency cache
- name: Cache local Maven repository
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/onPushSimpleTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- name: Build with Maven
#run: mvn --batch-mode --update-snapshots verify --settings .mvn/settings.xml
run: mvn --batch-mode clean test
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# log-parser
[![unit-tests](https://github.com/adobe/log-parser/actions/workflows/onPushSimpleTest.yml/badge.svg)](https://github.com/adobe/log-parser/actions/workflows/onPushSimpleTest.yml)
[![codecov](https://codecov.io/gh/adobe/log-parser/branch/master/graph/badge.svg?token=T94S3VFEUU)](https://codecov.io/gh/adobe/log-parser)
[![javadoc](https://javadoc.io/badge2/com.adobe.campaign.tests/log-parser/javadoc.svg)](https://javadoc.io/doc/com.adobe.campaign.tests/log-parser)
[![codecov](https://codecov.io/gh/adobe/log-parser/branch/main/graph/badge.svg?token=T94S3VFEUU)](https://codecov.io/gh/adobe/log-parser)
[![javadoc](https://javadoc.io/badge2/com.adobe.campaign.tests/log-parser/javadoc.svg)](https://javadoc.io/doc/com.adobe.campaign.tests/log-parser)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=adobe_log-parser&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=adobe_log-parser)

This project was created to allow us to parse and analyze log files in order to gather relevant data. It can be used as is or as an SDK. Where you can define your own parsing.

Expand Down
15 changes: 11 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<scm>
<connection>scm:git::https://github.com/adobe/log-parser.git</connection>
<developerConnection>scm:git:https://github.com/adobe/log-parser.git</developerConnection>
<url>https://github.com/adobe/log-parser/tree/master</url>
<url>https://github.com/adobe/log-parser/tree/main</url>
<tag>HEAD</tag>
</scm>
<distributionManagement>
Expand All @@ -58,19 +58,24 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<version>2.22.0</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>
--illegal-access=permit
--add-opens java.xml/jdk.xml.internal=ALL-UNNAMED
${argLine}
</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<!-- License information -->
Expand Down Expand Up @@ -283,6 +288,8 @@
<license.dir>${basedir}</license.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sonar.organization>adobeinc</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<powermock.version>2.0.2</powermock.version>
</properties>
<reporting>
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/adobe/campaign/tests/logparser/LogData.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -147,6 +149,11 @@ public void put(String in_dataEntryKey, String in_valueKey, Object in_newValue)

}

@Override
public int hashCode() {
return Objects.hash(entries);
}

@Override
public boolean equals(Object obj) {
if (this == obj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -233,7 +234,6 @@ public boolean matches(Map<String, Object> in_filterMap) {
return true;
}


@Override
public boolean equals(Object obj) {
if (this == obj)
Expand Down Expand Up @@ -261,4 +261,9 @@ public boolean equals(Object obj) {
return true;
}

@Override
public int hashCode() {
return Objects.hash(frequence, parseDefinition, valuesMap);
}

}

0 comments on commit d0ddd93

Please sign in to comment.