diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index fb2c3f4..92969f3 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -39,13 +39,10 @@ jobs: - name: Check style run: ./gradlew checkstyleMain checkstyleTest - - name: Build and analyze + - name: Build id: build_jar - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | - ./gradlew build jacocoTestReport sonar --info + ./gradlew build --info echo current_version=$(echo $(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')) >> $GITHUB_OUTPUT - name: Publish test report @@ -60,6 +57,13 @@ jobs: name: kafkactl-jar path: ${{ github.workspace }}/build/libs/kafkactl-${{ steps.build_jar.outputs.current_version }}.jar + - name: Sonar + if: github.event.pull_request.head.repo.fork == false + run: ./gradlew jacocoTestReport sonar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Docker run: ./gradlew dockerBuild @@ -153,4 +157,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: kafkactl-windows-amd64 - path: ${{ github.workspace }}/build/native/nativeCompile/kafkactl-${{ steps.build_native_windows.outputs.current_version }}-windows-amd64.exe \ No newline at end of file + path: ${{ github.workspace }}/build/native/nativeCompile/kafkactl-${{ steps.build_native_windows.outputs.current_version }}-windows-amd64.exe diff --git a/.github/workflows/push_main.yml b/.github/workflows/push_main.yml index e18aa3f..853f8a6 100644 --- a/.github/workflows/push_main.yml +++ b/.github/workflows/push_main.yml @@ -44,13 +44,10 @@ jobs: - name: Check style run: ./gradlew checkstyleMain checkstyleTest - - name: Build and analyze + - name: Build id: build_jar - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | - ./gradlew build jacocoTestReport sonar --info + ./gradlew build --info echo current_version=$(echo $(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')) >> $GITHUB_OUTPUT - name: Publish test report @@ -65,6 +62,12 @@ jobs: name: kafkactl-jar path: ${{ github.workspace }}/build/libs/kafkactl-${{ steps.build_jar.outputs.current_version }}.jar + - name: Sonar + run: ./gradlew jacocoTestReport sonar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Docker run: ./gradlew dockerBuild dockerPush