diff --git a/.github/workflows/build_deploy.yml b/.github/workflows/build_deploy.yml index efbcc8a..607a0ca 100644 --- a/.github/workflows/build_deploy.yml +++ b/.github/workflows/build_deploy.yml @@ -8,6 +8,9 @@ on: - '*' # Trigger on all tags pull_request: { } +env: + SONARQUBE_PROJECT: patrickfav_bytes-java + jobs: build: runs-on: ubuntu-latest @@ -15,16 +18,33 @@ jobs: steps: - name: Checkout Code uses: actions/checkout@v3 - - name: Set up JDK 8 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Cache SonarCloud packages + uses: actions/cache@v3 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven + id: cache-primes + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Set up JDK 11 uses: actions/setup-java@v3 with: - java-version: '8' - distribution: 'adopt' - cache: 'maven' + java-version: '11' + distribution: 'temurin' - name: Build with Maven - run: ./mvnw -B clean package checkstyle:checkstyle jacoco:report -DcommonConfig.jarSign.skip=true - - name: Upload coverage reports to CodeCov - uses: codecov/codecov-action@v3 + run: ./mvnw -B clean verify checkstyle:checkstyle jacoco:report -DcommonConfig.jarSign.skip=true + - name: Analyze with SonaQube + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=$SONARQUBE_PROJECT deploy: needs: build @@ -38,12 +58,18 @@ jobs: KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} run: | echo $KEYSTORE_BASE64 | base64 --decode > keystore.jks + - name: Cache Maven + id: cache-primes + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 - name: Set up Maven Central Repository uses: actions/setup-java@v3 with: - java-version: '8' - distribution: 'adopt' - cache: 'maven' + java-version: '11' + distribution: 'temurin' server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml server-username: MAVEN_USERNAME # env variable for username in deploy server-password: MAVEN_PASSWORD # env variable for token in deploy diff --git a/.mvn/maven.config b/.mvn/maven.config index b9d8785..f1099e4 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -1 +1 @@ --DcommonConfig.compiler.profile=jdk7_w_errorprone +-DcommonConfig.compiler.profile=jdk7 diff --git a/README.md b/README.md index 8171298..03720ad 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,11 @@ to blindly paste code snippets from [![Maven Central](https://img.shields.io/maven-central/v/at.favre.lib/bytes)](https://mvnrepository.com/artifact/at.favre.lib/bytes) [![Github Actions](https://github.com/patrickfav/bytes-java/actions/workflows/build_deploy.yml/badge.svg)](https://github.com/patrickfav/bytes-java/actions) [![Javadocs](https://www.javadoc.io/badge/at.favre.lib/bytes.svg)](https://www.javadoc.io/doc/at.favre.lib/bytes) -[![codecov](https://codecov.io/gh/patrickfav/bytes-java/branch/master/graph/badge.svg?token=YiSRwBApvz)](https://codecov.io/gh/patrickfav/bytes-java) -[![Maintainability](https://api.codeclimate.com/v1/badges/43b7770f0ee00b85f92a/maintainability)](https://codeclimate.com/github/patrickfav/bytes-java/maintainability) +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=patrickfav_bytes-java&metric=coverage)](https://sonarcloud.io/summary/new_code?id=patrickfav_bytes-java) +[![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) +[![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) -It's main features include: +Its main features include: * **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, ... * **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 ## Tech Stack -* Java 7 (+ [errorprone](https://github.com/google/error-prone) static analyzer) -* Maven +* Java 7 Source, JDK 11 required to build (not yet JDK17 compatible) +* Maven 3 # Credits diff --git a/pom.xml b/pom.xml index 1c665e9..5803bb5 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ at.favre.lib common-parent - 18 + 18.1 bytes @@ -24,6 +24,12 @@ false + + patrickfav + https://sonarcloud.io + jacoco + reuseReports + java @@ -35,7 +41,7 @@ org.apache.felix maven-bundle-plugin - 4.2.0 + 5.1.8 true @@ -65,10 +71,6 @@ org.jacoco jacoco-maven-plugin - - com.github.wvengen - proguard-maven-plugin - org.apache.maven.plugins maven-jarsigner-plugin