Skip to content

Commit 8985a4a

Browse files
authored
Merge pull request #52 from patrickfav/feature/sonar
2 parents 63eecac + 528413b commit 8985a4a

File tree

4 files changed

+51
-22
lines changed

4 files changed

+51
-22
lines changed

.github/workflows/build_deploy.yml

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,43 @@ on:
88
- '*' # Trigger on all tags
99
pull_request: { }
1010

11+
env:
12+
SONARQUBE_PROJECT: patrickfav_bytes-java
13+
1114
jobs:
1215
build:
1316
runs-on: ubuntu-latest
1417

1518
steps:
1619
- name: Checkout Code
1720
uses: actions/checkout@v3
18-
- name: Set up JDK 8
21+
with:
22+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
23+
- name: Cache SonarCloud packages
24+
uses: actions/cache@v3
25+
with:
26+
path: ~/.sonar/cache
27+
key: ${{ runner.os }}-sonar
28+
restore-keys: ${{ runner.os }}-sonar
29+
- name: Cache Maven
30+
id: cache-primes
31+
uses: actions/cache@v3
32+
with:
33+
path: ~/.m2
34+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
35+
restore-keys: ${{ runner.os }}-m2
36+
- name: Set up JDK 11
1937
uses: actions/setup-java@v3
2038
with:
21-
java-version: '8'
22-
distribution: 'adopt'
23-
cache: 'maven'
39+
java-version: '11'
40+
distribution: 'temurin'
2441
- name: Build with Maven
25-
run: ./mvnw -B clean package checkstyle:checkstyle jacoco:report -DcommonConfig.jarSign.skip=true
26-
- name: Upload coverage reports to CodeCov
27-
uses: codecov/codecov-action@v3
42+
run: ./mvnw -B clean verify checkstyle:checkstyle jacoco:report -DcommonConfig.jarSign.skip=true
43+
- name: Analyze with SonaQube
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
46+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
47+
run: mvn -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=$SONARQUBE_PROJECT
2848

2949
deploy:
3050
needs: build
@@ -38,12 +58,18 @@ jobs:
3858
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
3959
run: |
4060
echo $KEYSTORE_BASE64 | base64 --decode > keystore.jks
61+
- name: Cache Maven
62+
id: cache-primes
63+
uses: actions/cache@v3
64+
with:
65+
path: ~/.m2
66+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
67+
restore-keys: ${{ runner.os }}-m2
4168
- name: Set up Maven Central Repository
4269
uses: actions/setup-java@v3
4370
with:
44-
java-version: '8'
45-
distribution: 'adopt'
46-
cache: 'maven'
71+
java-version: '11'
72+
distribution: 'temurin'
4773
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
4874
server-username: MAVEN_USERNAME # env variable for username in deploy
4975
server-password: MAVEN_PASSWORD # env variable for token in deploy

.mvn/maven.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-DcommonConfig.compiler.profile=jdk7_w_errorprone
1+
-DcommonConfig.compiler.profile=jdk7

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ to blindly paste code snippets from
3030
[![Maven Central](https://img.shields.io/maven-central/v/at.favre.lib/bytes)](https://mvnrepository.com/artifact/at.favre.lib/bytes)
3131
[![Github Actions](https://github.com/patrickfav/bytes-java/actions/workflows/build_deploy.yml/badge.svg)](https://github.com/patrickfav/bytes-java/actions)
3232
[![Javadocs](https://www.javadoc.io/badge/at.favre.lib/bytes.svg)](https://www.javadoc.io/doc/at.favre.lib/bytes)
33-
[![codecov](https://codecov.io/gh/patrickfav/bytes-java/branch/master/graph/badge.svg?token=YiSRwBApvz)](https://codecov.io/gh/patrickfav/bytes-java)
34-
[![Maintainability](https://api.codeclimate.com/v1/badges/43b7770f0ee00b85f92a/maintainability)](https://codeclimate.com/github/patrickfav/bytes-java/maintainability)
33+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=patrickfav_bytes-java&metric=coverage)](https://sonarcloud.io/summary/new_code?id=patrickfav_bytes-java)
34+
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=patrickfav_bytes-java&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=patrickfav_bytes-java)
35+
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=patrickfav_bytes-java&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=patrickfav_bytes-java)
3536

36-
It's main features include:
37+
Its main features include:
3738

3839
* **Creation** from a wide variety of sources: multiple arrays, integers, [streams](https://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html), random, strings, files, uuid, ...
3940
* **Transformation** with many built-in: append, [xor](https://en.wikipedia.org/wiki/Exclusive_or), [and](https://en.wikipedia.org/wiki/Logical_conjunction), [hash](https://en.wikipedia.org/wiki/Cryptographic_hash_function), [shifts](https://en.wikipedia.org/wiki/Bitwise_operation#Bit_shifts), shuffle, reverse, [checksum](https://en.wikipedia.org/wiki/Checksum), ...
@@ -699,8 +700,8 @@ the plugin versions as well as providing the checkstyle config rules. Specifical
699700

700701
## Tech Stack
701702

702-
* Java 7 (+ [errorprone](https://github.com/google/error-prone) static analyzer)
703-
* Maven
703+
* Java 7 Source, JDK 11 required to build (not yet JDK17 compatible)
704+
* Maven 3
704705

705706
# Credits
706707

pom.xml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>at.favre.lib</groupId>
99
<artifactId>common-parent</artifactId>
10-
<version>18</version>
10+
<version>18.1</version>
1111
</parent>
1212

1313
<artifactId>bytes</artifactId>
@@ -24,6 +24,12 @@
2424

2525
<properties>
2626
<commonConfig.jarSign.skip>false</commonConfig.jarSign.skip>
27+
<!-- SonarQube Config -->
28+
<sonar.organization>patrickfav</sonar.organization>
29+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
30+
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
31+
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
32+
<sonar.language>java</sonar.language>
2733
</properties>
2834

2935
<build>
@@ -35,7 +41,7 @@
3541
<plugin>
3642
<groupId>org.apache.felix</groupId>
3743
<artifactId>maven-bundle-plugin</artifactId>
38-
<version>4.2.0</version>
44+
<version>5.1.8</version>
3945
<extensions>true</extensions>
4046
</plugin>
4147
<plugin>
@@ -65,10 +71,6 @@
6571
<groupId>org.jacoco</groupId>
6672
<artifactId>jacoco-maven-plugin</artifactId>
6773
</plugin>
68-
<plugin>
69-
<groupId>com.github.wvengen</groupId>
70-
<artifactId>proguard-maven-plugin</artifactId>
71-
</plugin>
7274
<plugin>
7375
<groupId>org.apache.maven.plugins</groupId>
7476
<artifactId>maven-jarsigner-plugin</artifactId>

0 commit comments

Comments
 (0)