Add wallclock TaskBlock profiler support #15407
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run system tests | |
| on: | |
| merge_group: | |
| pull_request: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: 0 4 * * * | |
| push: | |
| branches: | |
| - master | |
| # Cancel long-running jobs when a new commit is pushed | |
| concurrency: | |
| # this ensures that only one workflow runs at a time for a given branch on pull requests | |
| # as the group key is the workflow name and the branch name | |
| # for scheduled runs and pushes to master, we use the run id to ensure that all runs are executed | |
| group: ${{ (github.event_name == 'pull_request' && format('{0}-{1}', github.workflow, github.ref)) || format('{0}-{1}', github.workflow, github.run_id) }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: | |
| group: APM Larger Runners | |
| # Keep in sync with the JAVA_PROFILER_REF default in .gitlab-ci.yml. When non-empty, | |
| # we clone DataDog/java-profiler at this ref, build :ddprof-lib:assembleReleaseJar | |
| # and inject it via -Pddprof.jar=<path> instead of the published Maven artifact. | |
| env: | |
| JAVA_PROFILER_REF: "paul.fournillon/wallclock-taskblock" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # 7.0.0 | |
| with: | |
| submodules: 'recursive' | |
| fetch-depth: 0 | |
| - name: Cache Gradle dependencies | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| # Mirrors the `build_java_profiler_ddprof` GitLab job: clone java-profiler at | |
| # JAVA_PROFILER_REF, build :ddprof-lib:assembleReleaseJar with JDK 21 (Gradle 9.x), | |
| # and stage the resulting jar under custom-ddprof/ddprof.jar. | |
| # assembleRelease is the native link/assemble task only; the packaged jar is assembleReleaseJar. | |
| - name: Build custom ddprof.jar from java-profiler | |
| if: ${{ env.JAVA_PROFILER_REF != '' }} | |
| run: | | |
| set -euo pipefail | |
| mkdir -p custom-ddprof | |
| SRCDIR="${RUNNER_TEMP}/java-profiler-src" | |
| rm -rf "$SRCDIR" | |
| git clone --depth 1 --branch "$JAVA_PROFILER_REF" https://github.com/DataDog/java-profiler.git "$SRCDIR" | |
| ( | |
| cd "$SRCDIR" | |
| chmod +x ./gradlew | |
| JAVA_HOME="$JAVA_HOME_21_X64" PATH="$JAVA_HOME_21_X64/bin:$PATH" ./gradlew --version | |
| JAVA_HOME="$JAVA_HOME_21_X64" PATH="$JAVA_HOME_21_X64/bin:$PATH" \ | |
| ./gradlew :ddprof-lib:assembleReleaseJar -Pskip-tests -Pskip-gtest --no-daemon | |
| ) | |
| JAR=$(find "$SRCDIR/ddprof-lib/build/libs" -maxdepth 1 -type f -name 'ddprof-*.jar' ! -name '*-sources*' ! -name '*-javadoc*' | head -1) | |
| if [ -z "$JAR" ] || [ ! -f "$JAR" ]; then | |
| echo "No ddprof jar found under $SRCDIR/ddprof-lib/build/libs" >&2 | |
| ls -laR "$SRCDIR/ddprof-lib/build" 2>/dev/null || true | |
| exit 1 | |
| fi | |
| cp "$JAR" "$GITHUB_WORKSPACE/custom-ddprof/ddprof.jar" | |
| echo "DDPROF_JAR=$GITHUB_WORKSPACE/custom-ddprof/ddprof.jar" >> "$GITHUB_ENV" | |
| ls -la "$GITHUB_WORKSPACE/custom-ddprof/" | |
| - name: Build dd-trace-java | |
| env: | |
| ORG_GRADLE_PROJECT_akkaRepositoryToken: ${{ secrets.AKKA_REPO_TOKEN }} | |
| run: | | |
| DDPROF_ARG="" | |
| if [ -n "${DDPROF_JAR:-}" ] && [ -f "$DDPROF_JAR" ]; then | |
| echo "Injecting custom ddprof.jar: $DDPROF_JAR" | |
| DDPROF_ARG="-Pddprof.jar=$DDPROF_JAR" | |
| fi | |
| GRADLE_OPTS="-Xms2g -Xmx4g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC" \ | |
| JAVA_HOME=$JAVA_HOME_8_X64 \ | |
| JAVA_8_HOME=$JAVA_HOME_8_X64 \ | |
| JAVA_11_HOME=$JAVA_HOME_11_X64 \ | |
| JAVA_17_HOME=$JAVA_HOME_17_X64 \ | |
| JAVA_21_HOME=$JAVA_HOME_21_X64 \ | |
| ./gradlew clean :dd-java-agent:shadowJar $DDPROF_ARG \ | |
| --build-cache --parallel --stacktrace --no-daemon --max-workers=4 | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a | |
| with: | |
| name: binaries | |
| path: workspace/dd-java-agent/build/libs/ | |
| main: | |
| needs: | |
| - build | |
| # If you change the following comment, update the pattern in the update_system_test_reference.sh script to match. | |
| uses: DataDog/system-tests/.github/workflows/system-tests.yml@main # system tests are pinned on release branches only | |
| permissions: | |
| contents: read | |
| id-token: write | |
| packages: write | |
| with: | |
| library: java | |
| # If you change the following comment, update the pattern in the update_system_test_reference.sh script to match. | |
| ref: "main" # system tests are pinned on release branches only | |
| binaries_artifact: binaries | |
| desired_execution_time: 900 # 15 minutes | |
| scenarios_groups: tracer-release | |
| excluded_scenarios: APM_TRACING_E2E_OTEL,APM_TRACING_E2E_SINGLE_SPAN,PROFILING # exclude flaky scenarios | |
| skip_empty_scenarios: ${{ github.event_name != 'push' && github.event_name != 'schedule' }} | |
| push_to_test_optimization: true | |
| secrets: | |
| DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
| DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
| # Ensure the main job is run to completion | |
| check: | |
| name: Check system tests success | |
| runs-on: ubuntu-latest | |
| if: ${{ always() }} | |
| needs: [build, main] | |
| steps: | |
| - name: Fail if build failed | |
| if: ${{ needs.build.result != 'success' }} | |
| run: | | |
| echo "❌ Build job did not succeed: ${{ needs.build.result }}" | |
| exit 1 | |
| - name: Fail if main failed or is skipped | |
| if: ${{ needs.main.result != 'success' }} | |
| run: | | |
| echo "❌ Main job did not succeed: ${{ needs.main.result }}" | |
| exit 1 | |
| - name: Success | |
| run: echo "✅ All required jobs succeeded." |