yaalsn commented on code in PR #3735: URL: https://github.com/apache/bookkeeper/pull/3735#discussion_r1071663092
########## .github/workflows/bk-ci.yml: ########## @@ -0,0 +1,419 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +name: BookKeeper CI + +on: + pull_request: + branches: + - master + - branch-* + workflow_dispatch: + +env: + MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-and-license-check: + name: PR Validation + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Tune Runner VM + uses: ./.github/actions/tune-runner-vm + + - name: Detect changed files + id: changes + uses: apache/pulsar-test-infra/paths-filter@master + with: + filters: .github/changes-filter.yaml + list-files: csv + + - name: Check changed files + id: check_changes + run: | + echo "docs_only=${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.docs_count) && fromJSON(steps.changes.outputs.docs_count) > 0 }}" >> $GITHUB_OUTPUT + + - name: Cache local Maven repository + if: steps.check_changes.outputs.docs_only != 'true' + id: cache + uses: actions/cache@v3 + with: + path: | + ~/.m2/repository/*/*/* + !~/.m2/repository/org/apache/bookkeeper + !~/.m2/repository/org/apache/distributedlog + key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }} + + - name: Set up JDK 11 + if: steps.check_changes.outputs.docs_only != 'true' + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: 11 + + - name: Validate pull request + if: steps.check_changes.outputs.docs_only != 'true' + run: mvn clean -T 1C -B -nsu apache-rat:check checkstyle:check spotbugs:check package -Ddistributedlog -DskipTests -Dorg.slf4j.simpleLogger.defaultLogLevel=INFO + + - name: Check license files + if: steps.check_changes.outputs.docs_only != 'true' + run: dev/check-all-licenses + + - name: Generate Javadoc + if: steps.check_changes.outputs.docs_only != 'true' + run: mvn -B -nsu -am -pl bookkeeper-common,bookkeeper-server,:bookkeeper-stats-api,:bookkeeper-stats-providers,:codahale-metrics-provider,:prometheus-metrics-provider javadoc:aggregate -DskipTests -Pdelombok -Dchesktyle.skip -Dspotbugs.skip + + unit-tests: + name: ${{ matrix.step_name }} + runs-on: ubuntu-latest + timeout-minutes: ${{ matrix.timeout || 60 }} + needs: [ 'build-and-license-check' ] + if: ${{ needs.build-and-license-check.outputs.docs_only != 'true' }} + strategy: + fail-fast: false + matrix: + include: + - step_name: Bookie Tests + module: bookkeeper-server + test_args: "-Dtest='org.apache.bookkeeper.bookie.**'" + - step_name: Client Tests + module: bookkeeper-server + test_args: "-Dtest='org.apache.bookkeeper.client.**'" + - step_name: Remaining Tests + module: bookkeeper-server + test_args: "-Dtest='org.apache.bookkeeper.replication.**'" + - step_name: Replication Tests + module: bookkeeper-server + test_args: "-Dtest='!org.apache.bookkeeper.client.**,!org.apache.bookkeeper.bookie.**,!org.apache.bookkeeper.replication.**,!org.apache.bookkeeper.tls.**'" + - step_name: TLS Tests + module: bookkeeper-server + test_args: "-Dtest='org.apache.bookkeeper.tls.**'" + - step_name: StreamStorage Tests + test_args: "-f stream/pom.xml -DstreamTests" + - step_name: Shell tests + module: tests/scripts + + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: Tune Runner VM + uses: ./.github/actions/tune-runner-vm + + - name: Cache local Maven repository + id: cache + uses: actions/cache@v3 + with: + path: | + ~/.m2/repository/*/*/* + !~/.m2/repository/org/apache/bookkeeper + !~/.m2/repository/org/apache/distributedlog + key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }} + + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: 11 + + - name: Build + run: | + projects_list= + if [[ ! -z "${{ matrix.module }}" ]]; then + projects_list="-pl ${{ matrix.module }}" + fi + mvn -q -T 1C -B -nsu $projects_list install -am -DskipTests -Dcheckstyle.skip -Dspotbugs.skip -Drat.skip -Dmaven.javadoc.skip + + - name: Test - ${{ matrix.step_name }} + run: | + projects_list= + if [[ ! -z "${{ matrix.module }}" ]]; then + projects_list="-pl ${{ matrix.module }}" + fi + mvn -B -nsu $projects_list verify ${{ matrix.test_args }} + + - name: Aggregates all test reports to ./test-reports and ./surefire-reports directories + if: ${{ always() }} + uses: ./.github/actions/copy-test-reports + + - name: Publish Test Report + uses: apache/pulsar-test-infra/action-junit-report@master + if: ${{ always() }} + with: + report_paths: 'surefire-reports/TEST-*.xml' + annotate_only: 'true' + + - name: Upload Surefire reports + uses: actions/upload-artifact@v3 + if: failure() + continue-on-error: true + with: + name: bookie-tests-reports + path: surefire-reports + retention-days: 7 + + integration-tests: + name: Integration Tests + runs-on: ubuntu-latest + timeout-minutes: 60 + needs: [ 'build-and-license-check' ] + if: ${{ needs.build-and-license-check.outputs.docs_only != 'true' }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Tune Runner VM + uses: ./.github/actions/tune-runner-vm + + - name: Cache local Maven repository + id: cache + uses: actions/cache@v2 + with: + path: | + ~/.m2/repository/*/*/* + !~/.m2/repository/org/apache/bookkeeper + !~/.m2/repository/org/apache/distributedlog + key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }} + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: 11 + + - name: Build with Maven + run: mvn -B -nsu clean install -Pdocker -DskipTests -Dorg.slf4j.simpleLogger.defaultLogLevel=INFO + + - name: Run metadata driver tests + run: mvn -B -nsu -f metadata-drivers/pom.xml test -DintegrationTests -Dorg.slf4j.simpleLogger.defaultLogLevel=INFO + + - name: Run all integration tests + run: mvn -B -nsu -f tests/pom.xml test -DintegrationTests -Dorg.slf4j.simpleLogger.defaultLogLevel=INFO + + - name: print JVM thread dumps when cancelled + if: cancelled() + run: ./dev/ci-tool print_thread_dumps + + backward-compatibility-tests: + name: Backward compatibility tests + runs-on: ubuntu-latest + timeout-minutes: 60 + needs: [ 'build-and-license-check' ] + if: ${{ needs.build-and-license-check.outputs.docs_only != 'true' }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Tune Runner VM + uses: ./.github/actions/tune-runner-vm + + - name: Cache local Maven repository + id: cache + uses: actions/cache@v2 + with: + path: | + ~/.m2/repository/*/*/* + !~/.m2/repository/org/apache/bookkeeper + !~/.m2/repository/org/apache/distributedlog + key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }} + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: 8 + + - name: Build with Maven + run: mvn -B -nsu clean install -DskipTests -Dorg.slf4j.simpleLogger.defaultLogLevel=INFO + + - name: Test current server with old clients + run: mvn -B -nsu -DintegrationTests -pl :backward-compat-current-server-old-clients test + + - name: Test progressive upgrade + run: mvn -B -nsu -DintegrationTests -pl :upgrade test + + - name: Other tests + run: | + mvn -B -nsu -DintegrationTests -pl :bc-non-fips,:hierarchical-ledger-manager,:hostname-bookieid,:old-cookie-new-cluster,:recovery-no-password,:upgrade-direct,:yahoo-custom-version test + + windows-build: + name: Build with windows on JDK 11 + runs-on: windows-latest + timeout-minutes: 30 + needs: [ 'build-and-license-check' ] + if: ${{ needs.build-and-license-check.outputs.docs_only != 'true' }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Tune Runner VM + uses: ./.github/actions/tune-runner-vm + + - name: Install mingw + run: choco install mingw + + - name: Cache local Maven repository + id: cache + uses: actions/cache@v2 + with: + path: | + ~/.m2/repository/*/*/* + !~/.m2/repository/org/apache/bookkeeper + !~/.m2/repository/org/apache/distributedlog + key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }} + + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 11 + + - name: mvn package + run: mvn -B -nsu clean package -DskipTests + + macos-build: + name: Build with macos on JDK 11 + runs-on: macos-latest + timeout-minutes: 30 + needs: [ 'build-and-license-check' ] + if: ${{ needs.build-and-license-check.outputs.docs_only != 'true' }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Tune Runner VM + uses: ./.github/actions/tune-runner-vm + + - name: Cache local Maven repository + id: cache + uses: actions/cache@v2 + with: + path: | + ~/.m2/repository/*/*/* + !~/.m2/repository/org/apache/bookkeeper + !~/.m2/repository/org/apache/distributedlog + key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }} + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 11 + + - name: mvn package + run: mvn -B -nsu clean package -DskipTests + + jdk-compatibility-checks: + name: ${{ matrix.step_name }} + runs-on: ubuntu-latest + timeout-minutes: ${{ matrix.timeout || 60 }} + needs: [ 'build-and-license-check' ] + if: ${{ needs.build-and-license-check.outputs.docs_only != 'true' }} + strategy: + fail-fast: false + matrix: + include: + - step_name: Compatibility Check Java8 + jdk_version: 8 + - step_name: Compatibility Check Java11 + jdk_version: 11 + - step_name: Compatibility Check Java17 + jdk_version: 17 + + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: Tune Runner VM + uses: ./.github/actions/tune-runner-vm + + - name: Cache local Maven repository + id: cache + uses: actions/cache@v3 + with: + path: | + ~/.m2/repository/*/*/* + !~/.m2/repository/org/apache/bookkeeper + !~/.m2/repository/org/apache/distributedlog + key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }} + + + - name: Set up JDK ${{ matrix.jdk_version }} + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: ${{ matrix.jdk_version }} + + - name: Build with Maven + run: mvn clean package -B -nsu -DskipBookKeeperServerTests -Dorg.slf4j.simpleLogger.defaultLogLevel=INFO + + - name: print JVM thread dumps when cancelled + if: cancelled() + run: ./dev/ci-tool print_thread_dumps + + owasp-dependency-check: + name: OWASP Dependency Check + runs-on: ubuntu-latest + timeout-minutes: 60 + needs: [ 'build-and-license-check' ] + if: ${{ needs.build-and-license-check.outputs.need_owasp == 'true' }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Tune Runner VM + uses: ./.github/actions/tune-runner-vm + + - name: Cache local Maven repository + id: cache + uses: actions/cache@v2 + with: + path: | + ~/.m2/repository/*/*/* + !~/.m2/repository/org/apache/bookkeeper + !~/.m2/repository/org/apache/distributedlog + key: ${{ runner.os }}-bookkeeper-all-${{ hashFiles('**/pom.xml') }} + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: 11 + + - name: run "clean install verify" to trigger dependency check + # excluding dlfs because it includes hadoop lib with + # CVEs that we cannot patch up anyways + run: mvn -q -B -ntp clean install verify -Powasp-dependency-check -DskipTests -pl '!stream/distributedlog/io/dlfs' + + - name: Upload report + uses: actions/upload-artifact@v3 + if: ${{ cancelled() || failure() }} + continue-on-error: true + with: + name: dependency report + path: target/dependency-check-report.html Review Comment: Do we need to add `retention-days: 7` for this job? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
