diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..ee995b88 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,43 @@ +name: Java CI + SonarCloud + +on: + push: + branches: + - main + - master + - develop + pull_request: + types: [synchronize, opened, reopened] + +jobs: + sonar-cloud: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'temurin' + + - name: Cache SonarCloud packages + uses: actions/cache@v3 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + + - name: Build with Maven + run: mvn clean install -P no-gpg --no-transfer-progress + + - name: Run SonarCloud Analysis + uses: SonarSource/sonarqube-scan-action@master + with: + projectBaseDir: . + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 4e07c8dc..00000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: "Code scanning - action" -on: - push: - pull_request: - schedule: - - cron: '0 10 1,15 * *' - -jobs: - CodeQL-Build: - - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 - - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - # Override language selection by uncommenting this and choosing your languages - # with: - # languages: go, javascript, csharp, python, cpp, java - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/pom.xml b/pom.xml index 12889f15..d087179c 100644 --- a/pom.xml +++ b/pom.xml @@ -221,52 +221,55 @@ - + org.jacoco jacoco-maven-plugin - 0.8.2 + 0.8.11 + prepare-agent prepare-agent jacoco-report - test + verify report - - - jacoco-check - - check - - - - - PACKAGE - - - LINE - COVEREDRATIO - 0.0 - - - - - - - + + + no-gpg + + + skipGpg + true + + + + + + org.apache.maven.plugins + maven-gpg-plugin + + + sign-artifacts + none + + + + + + release diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..e07d882d --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,10 @@ +sonar.organization=transbankdevelopers +sonar.projectKey=TransbankDevelopers_transbank-sdk-java +sonar.language=java +sonar.projectVersion=1.0.0 +sonar.sourceEncoding=UTF-8 +sonar.sources=src/main/java +sonar.tests=src/test/java +sonar.java.binaries=target/classes +sonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml +sonar.exclusions=**/model/**,**/requests/**,**/responses/**