| # This workflow will build a Java project with Maven | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
| name: Sonar-Codecov | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - "rel/*" | |
| - "rc/*" | |
| paths-ignore: | |
| - "docs/**" | |
| - "site/**" | |
| - "iotdb-client/client-cpp/**" | |
| - ".github/workflows/client-cpp-package.yml" | |
| - ".github/scripts/package-client-cpp-*.sh" | |
| - ".github/workflows/multi-language-client.yml" | |
| pull_request: | |
| branches: | |
| - master | |
| - "rel/*" | |
| - "new_*" | |
| - "rc/*" | |
| - "force_ci/**" | |
| paths-ignore: | |
| - "docs/**" | |
| - "site/**" | |
| - "iotdb-client/client-cpp/**" | |
| - ".github/workflows/client-cpp-package.yml" | |
| - ".github/scripts/package-client-cpp-*.sh" | |
| - ".github/workflows/multi-language-client.yml" | |
| # allow manually run the action: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 | |
| MAVEN_ARGS: --batch-mode --no-transfer-progress | |
| PR_NUMBER: ${{ github.event.number }} | |
| DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} | |
| jobs: | |
| codecov: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'apache/iotdb' || github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Cache Maven packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2- | |
| - name: Test | |
| run: | | |
| mvn -B -P with-code-coverage clean package -pl distribution,iotdb-client/cli,iotdb-client/session,iotdb-client/jdbc -am -Dtest.port.closed=true -DforkCount=4 | |
| mvn -B -P with-code-coverage post-integration-test -pl code-coverage | |
| - name: Upload coverage reports to codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./code-coverage/target/jacoco-merged-reports/jacoco.xml | |
| sonar: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'apache/iotdb' || github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: corretto | |
| java-version: 21 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache Maven packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2- | |
| - name: SonarCloud Report | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} | |
| run: | | |
| mvn -B -P with-integration-tests,with-code-coverage verify sonar:sonar \ | |
| -Dsonar.organization=apache \ | |
| -Dsonar.projectKey=apache_iotdb \ | |
| -Dsonar.host.url=https://sonarcloud.io \ | |
| -Dsonar.token=${{ secrets.SONARCLOUD_TOKEN }} \ | |
| -DskipTests -pl '!distribution,!integration-test' -am |