diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 033ff0d..b722947 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -8,14 +8,15 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ '11' ] + java: [ '11', '17', '21' ] steps: - - uses: actions/checkout@v2 - - name: Set up JDK - uses: actions/setup-java@v2 - with: - java-version: ${{ matrix.java }} - distribution: 'temurin' - cache: maven - - name: Build with Maven - run: mvn clean install -U \ No newline at end of file + - uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Maven build + run: | + mvn clean install -U -Djava.version=${{ matrix.java }} diff --git a/.github/workflows/snyk.yml b/.github/workflows/snyk.yml new file mode 100644 index 0000000..da0d31d --- /dev/null +++ b/.github/workflows/snyk.yml @@ -0,0 +1,24 @@ +name: Snyk vulnerability scan + +on: [push] + +jobs: + snyk: + name: Run Snyk to check for vulnerabilities + permissions: + security-events: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Snyk vulnerability check + uses: snyk/actions/maven-3-jdk-11@master + continue-on-error: true + env: + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + with: + args: --sarif-file-output=snyk.sarif + --severity-threshold=high + - name: Upload Results to GitHub Code Scanning + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: snyk.sarif diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 0000000..c69d6ce --- /dev/null +++ b/.github/workflows/sonar.yml @@ -0,0 +1,25 @@ +name: SonarCloud analysis + +on: [push] + +jobs: + sonarcloud: + name: SonarCloud analysis + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Sonarcloud code analysis + run: | + mvn -B verify sonar:sonar \ + -Dsonar.host.url=https://sonarcloud.io \ + -Dsonar.organization=infobip \ + -Dsonar.projectKey=infobip_infobip-api-java-client \ + -Dsonar.login=${{ secrets.SONAR_TOKEN }} diff --git a/.gitignore b/.gitignore index a530464..972c9d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.class +.idea/ # Mobile Tools for Java (J2ME) .mtj.tmp/ diff --git a/CHANGELOG.md b/CHANGELOG.md index f03f6fc..c397370 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,23 @@ All notable changes to the library will be documented in this file. The format of the file is based on [Keep a Changelog](http://keepachangelog.com/) and this library adheres to [Semantic Versioning](http://semver.org/) as mentioned in [README.md][readme] file. -## [Unreleased] +## [ [4.3.2](https://github.com/infobip/infobip-api-java-client/releases/tag/4.3.2) ] - 2024-08-22 ### Added * Added mock tests to verify the correctness of request payloads and response handling. * Added `awaitility` and `wiremock` test dependencies. +* `snyk.yml` workflow, which serves the purpose of identifying and addressing dependency vulnerabilities in the project. +* `sonar.yml` workflow to analyze the source code, enhancing code quality and maintainability. +* `git-build-hook-maven-plugin` plugin into the project, providing support for Git hooks. +* `pre-commit.sh` hook, which automatically executes `mvn spotless:apply` prior to each commit, ensuring code formatting consistency. + +### Changed +* Bumped `jackson` version to `2.17.0` +* Bumped `slf4j-api` version to `2.0.16` +* Bumped `junit-jupiter` version to `5.11.0` +* Bumped `guava` version to `33.3.0-jre` +* Bumped `maven-gpg-plugin` version to `3.2.5` +* Bumped `spotless-maven-plugin` version to `2.43.0` ## [ [4.3.1](https://github.com/infobip/infobip-api-java-client/releases/tag/4.3.1) ] - 2024-06-05 diff --git a/README.md b/README.md index 8e7530c..38d337c 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Simply add the following in your project's POM file under `dependencies` tag: com.infobip infobip-api-java-client - 4.3.1 + 4.3.2 ``` diff --git a/hooks/pre-commit.sh b/hooks/pre-commit.sh new file mode 100755 index 0000000..b4b6ef4 --- /dev/null +++ b/hooks/pre-commit.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Part 1 +stagedFiles=$(git diff --staged --name-only) +# Part 2 +echo "Running spotlessApply. Formatting code..." +mvn spotless:apply +# Part 3 +for file in $stagedFiles; do + if test -f "$file"; then + git add $file + fi +done diff --git a/pom.xml b/pom.xml index 4cf027b..a2beae4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.infobip infobip-api-java-client - 4.3.1 + 4.3.2 jar infobip-api-java-client @@ -38,102 +38,102 @@ 11 UTF-8 UTF-8 - 2.15.2 + 2.17.0 4.12.0 - 2.0.9 - 5.9.2 + 2.0.16 + 5.11.0 3.24.2 - 32.1.2-jre - 2.27.2 - 4.2.0 + 33.3.0-jre + 3.0.1 + 4.2.2 - - org.apache.maven.plugins - maven-compiler-plugin - 3.10.1 - - ${java.version} - utf8 - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.0.0-M8 - - - org.apache.maven.plugins - maven-jar-plugin - 3.3.0 - - - - test-jar - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.4.1 - - - attach-javadocs - - jar - - - - - none - - - - org.apache.maven.plugins - maven-source-plugin - 3.2.1 - - - attach-sources - - jar-no-fork - test-jar-no-fork - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.13 - true - - ossrh - https://s01.oss.sonatype.org/ - true - - - - com.diffplug.spotless - spotless-maven-plugin - 2.32.0 - - - - - - - - - check - - - - + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + ${java.version} + utf8 + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M8 + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.4.1 + + + attach-javadocs + + jar + + + + + none + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar-no-fork + test-jar-no-fork + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.13 + true + + ossrh + https://s01.oss.sonatype.org/ + true + + + + com.diffplug.spotless + spotless-maven-plugin + 2.43.0 + + + + + + + + + check + + + + @@ -158,7 +158,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.0.1 + 3.2.5 sign-artifacts @@ -172,6 +172,32 @@ + + git-hook + + + + com.rudikershaw.gitbuildhook + git-build-hook-maven-plugin + 3.5.0 + + + + hooks/pre-commit.sh + + + + + + + install + + + + + + + diff --git a/src/main/java/com/infobip/RequestFactory.java b/src/main/java/com/infobip/RequestFactory.java index 79e6a98..c8914f7 100644 --- a/src/main/java/com/infobip/RequestFactory.java +++ b/src/main/java/com/infobip/RequestFactory.java @@ -26,7 +26,7 @@ */ final class RequestFactory { - private static final String USER_AGENT_HEADER_VALUE = "infobip-api-client-java/4.3.1"; + private static final String USER_AGENT_HEADER_VALUE = "infobip-api-client-java/4.3.2"; private final ApiKey apiKey; private final BaseUrl baseUrl; diff --git a/src/test/java/com/infobip/RequestFactoryTest.java b/src/test/java/com/infobip/RequestFactoryTest.java index ba3bb46..22e5a55 100644 --- a/src/test/java/com/infobip/RequestFactoryTest.java +++ b/src/test/java/com/infobip/RequestFactoryTest.java @@ -38,7 +38,7 @@ class RequestFactoryTest { private static final String GIVEN_API_KEY_VALUE = "apiKeyValue"; private static final ApiKey GIVEN_API_KEY = ApiKey.from(GIVEN_API_KEY_VALUE); - private static final String EXPECTED_USER_AGENT_HEADER_VALUE = "infobip-api-client-java/4.3.1"; + private static final String EXPECTED_USER_AGENT_HEADER_VALUE = "infobip-api-client-java/4.3.2"; private final OkHttpClient client = new OkHttpClient(); private final JSON json = new JSON();