diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..94f3051 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,37 @@ +name: SonarCloud +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'zulu' # Alternative distribution options are available + - name: Cache SonarCloud packages + uses: actions/cache@v3 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Gradle packages + uses: actions/cache@v3 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: ./gradlew build sonar --info \ No newline at end of file diff --git a/README.md b/README.md index 0a396dd..574cc6f 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,10 @@ Mistral-java-client is built against version 0.0.1 of the [Mistral AI API](https - [List Available Models](https://docs.mistral.ai/api/#operation/listModels) - "Create Embeddings" to be implemented later +# Requirements +- Java 17 or higher +- A Mistral AI API Key (see the [Mistral documentation](https://docs.mistral.ai/#api-access) for more details on API access) + # Installation ## Gradle diff --git a/build.gradle b/build.gradle index ca11266..58609d1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id 'java' id 'maven-publish' + id "org.sonarqube" version "4.4.1.3373" } group = 'nl.dannyj' @@ -27,7 +28,7 @@ dependencies { } java { - sourceCompatibility = '11' + sourceCompatibility = '17' } publishing { @@ -40,4 +41,12 @@ publishing { test { useJUnitPlatform() +} + +sonar { + properties { + property "sonar.projectKey", "Dannyj1_mistral-java-client" + property "sonar.organization", "danny1" + property "sonar.host.url", "https://sonarcloud.io" + } } \ No newline at end of file diff --git a/gradlew b/gradlew old mode 100644 new mode 100755