diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index b435a4e..4e7a52f 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -7,6 +7,11 @@ on: - dev workflow_dispatch: +env: + NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + NEXUS_REPOSITORY: '' + jobs: publish: runs-on: ubuntu-latest @@ -22,6 +27,13 @@ jobs: - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b + - name: Cache SonarQube packages + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Extract branch name shell: bash run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" @@ -35,11 +47,13 @@ jobs: echo "NEXUS_REPOSITORY=${{ secrets.NEXUS_DEV_REPOSITORY }}" >> $GITHUB_ENV fi + - name: Build and analyze + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + run: ./gradlew build sonar --info + - name: Publish package uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 with: arguments: publish - env: - NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} - NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} - NEXUS_REPOSITORY: ${{ env.NEXUS_REPOSITORY }} diff --git a/build.gradle b/build.gradle index c062bb6..e447660 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 = 'fr.efreicraft' @@ -111,4 +112,11 @@ publishing { mavenLocal() } } +} + +sonar { + properties { + property "sonar.projectKey", "efrei-craft_ECATUP_AYxT1h2h0r1VQ1KDYPJ7" + property "sonar.projectName", "ECATUP" + } } \ No newline at end of file