perf: try with debug info #15937
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: Test | |
| on: [push] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_VERSION: 1.84.1 | |
| jobs: | |
| test: | |
| name: "cargo test --workspace #${{ matrix.platform }} ${{ matrix.rust_version }}" | |
| runs-on: ${{ matrix.platform }} | |
| permissions: | |
| checks: write | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 | |
| strategy: | |
| matrix: | |
| platform: [windows-latest, ubuntu-latest, macos-15] | |
| rust_version: [""] | |
| include: | |
| - platform: "ubuntu-latest" | |
| rust_version: "${RUST_VERSION}" | |
| fail-fast: false | |
| steps: | |
| - name: Free Disk Space (Ubuntu only) | |
| if: runner.os == 'Linux' && matrix.platform == 'ubuntu-latest' | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # 1.3.1 | |
| with: | |
| tool-cache: false | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: false | |
| swap-storage: true | |
| - name: Checkout sources | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 | |
| with: | |
| submodules: recursive | |
| - name: Install Rust ${{ matrix.rust_version }} | |
| if: matrix.rust_version != '' | |
| run: rustup install ${{ matrix.rust_version }} && rustup default ${{ matrix.rust_version }} | |
| - id: rust-version | |
| # On Windows run happens in a PowerShell, so start bash explicitly | |
| run: bash -c 'echo "version=$(rustc --version)" >> $GITHUB_OUTPUT' | |
| - name: Install cargo nextest | |
| uses: taiki-e/install-action@2c41309d51ede152b6f2ee6bf3b71e6dc9a8b7df # 2.49.27 | |
| with: | |
| tool: nextest@0.9.96 | |
| - name: Cache [rust] | |
| uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1 | |
| with: | |
| cache-targets: true # cache build artifacts | |
| cache-bin: true # cache the ~/.cargo/bin directory | |
| - name: "Remove nextest CI report" | |
| shell: bash | |
| run: rm -rf target/nextest/ci/junit.xml | |
| - name: "[${{ steps.rust-version.outputs.version}}] cargo build --workspace --exclude builder --verbose" | |
| shell: bash | |
| run: cargo build --workspace --exclude builder --verbose | |
| - name: "[${{ steps.rust-version.outputs.version}}] cargo nextest run --workspace --features libdd-crashtracker/generate-unit-test-files --exclude builder --profile ci --verbose -E '!test(tracing_integration_tests::)'" | |
| shell: bash | |
| # Run doc tests with cargo test and run tests with nextest and generate junit.xml | |
| run: cargo test --workspace --features libdd-crashtracker/generate-unit-test-files --exclude builder --doc --verbose && cargo nextest run --workspace --features libdd-crashtracker/generate-unit-test-files --exclude builder --profile ci --verbose -E '!test(tracing_integration_tests::)' | |
| env: | |
| RUST_BACKTRACE: full | |
| - name: "[${{ steps.rust-version.outputs.version}}] Tracing integration tests: cargo nextest run --workspace --features libdd-crashtracker/generate-unit-test-files --exclude builder --profile ci --test-threads=1 --verbose -E 'test(tracing_integration_tests::)'" | |
| if: runner.os == 'Linux' | |
| shell: bash | |
| run: cargo nextest run --workspace --features libdd-crashtracker/generate-unit-test-files --exclude builder --profile ci --test-threads=1 --verbose -E 'test(tracing_integration_tests::)' | |
| env: | |
| RUST_BACKTRACE: full | |
| - name: "[${{ steps.rust-version.outputs.version}}] RUSTFLAGS=\"-C prefer-dynamic\" cargo nextest run --package test_spawn_from_lib --features prefer-dynamic -E '!test(tracing_integration_tests::)'" | |
| shell: bash | |
| run: cargo nextest run --package test_spawn_from_lib --features prefer-dynamic -E '!test(tracing_integration_tests::)' | |
| env: | |
| RUSTFLAGS: "-C prefer-dynamic" | |
| RUST_BACKTRACE: full | |
| - name: Add file attributes to JUnit XML | |
| if: success() || failure() | |
| shell: bash | |
| run: cargo run --bin add_junit_file_attributes -- target/nextest/ci/junit.xml | |
| - name: Report Test Results | |
| if: success() || failure() | |
| uses: mikepenz/action-junit-report@db71d41eb79864e25ab0337e395c352e84523afe # 4.3.1 | |
| with: | |
| report_paths: "target/nextest/ci/junit.xml" | |
| check_name: "[${{ matrix.platform }}:${{ matrix.rust_version }}] test report" | |
| include_passed: true | |
| # We're using not-that-ideal XSLT here as this change, because it must be done over 17+ repos. | |
| # It's a workaround until this gets integrated into a better place, such as datadog-ci or the backend. | |
| # | |
| # * ticket: https://datadoghq.atlassian.net/browse/APMSP-2610 | |
| # * RFC: https://docs.google.com/document/d/1OaX_h09fCXWmK_1ADrwvilt8Yt5h4WjC7UUAdS3Y3uw/edit?pli=1&tab=t.0#heading=h.tfy5viz7rz2 | |
| - name: Add final_status property | |
| if: success() || failure() | |
| shell: bash | |
| run: | | |
| which xsltproc || sudo apt-get install -y xsltproc | |
| echo "Fixing target/nextest/ci/junit.xml" | |
| tmp_file="$(mktemp)" | |
| xsltproc --output "$tmp_file" ".github/workflows/add_final_status.xsl" "target/nextest/ci/junit.xml" | |
| mv "$tmp_file" "target/nextest/ci/junit.xml" | |
| - name: Upload test results to Datadog | |
| if: success() || failure() | |
| shell: bash | |
| run: | | |
| # Download datadog-ci binary | |
| if [ "${{ runner.os }}" == "Linux" ]; then | |
| URL="https://github.com/DataDog/datadog-ci/releases/download/v4.2.2/datadog-ci_linux-x64" | |
| OUTPUT="datadog-ci" | |
| CHECKSUM_CMD="sha256sum" | |
| EXPECTED_CHECKSUM="3e1e9649d15d3feacced89ec90de66151046a58c7844217e4112362ad8dbf8d1" | |
| elif [ "${{ runner.os }}" == "Windows" ]; then | |
| URL="https://github.com/DataDog/datadog-ci/releases/download/v4.2.2/datadog-ci_win-x64" | |
| OUTPUT="datadog-ci.exe" | |
| CHECKSUM_CMD="sha256sum" | |
| EXPECTED_CHECKSUM="13313279cb884fe098e2f80ca21d23e67b78a090a12e891e8e35be653ee2bbd0" | |
| elif [ "${{ runner.os }}" == "macOS" ]; then | |
| URL="https://github.com/DataDog/datadog-ci/releases/download/v4.2.2/datadog-ci_darwin-x64" | |
| OUTPUT="datadog-ci" | |
| CHECKSUM_CMD="shasum -a 256" | |
| EXPECTED_CHECKSUM="071a6140b17438b3f9dd6c65da48b48ea03fc310034fa624ce874fdb6c325da4" | |
| fi | |
| echo "Downloading datadog-ci from $URL" | |
| curl -L --fail --retry 3 -o "$OUTPUT" "$URL" | |
| chmod +x "$OUTPUT" | |
| # Verify checksum | |
| ACTUAL_CHECKSUM=$($CHECKSUM_CMD "$OUTPUT" | cut -d' ' -f1) | |
| echo "Expected checksum: $EXPECTED_CHECKSUM" | |
| echo "Actual checksum: $ACTUAL_CHECKSUM" | |
| if [ "$ACTUAL_CHECKSUM" != "$EXPECTED_CHECKSUM" ]; then | |
| echo "Checksum verification failed!" | |
| exit 1 | |
| fi | |
| echo "Checksum verification passed" | |
| # Upload test results | |
| ./"$OUTPUT" junit upload \ | |
| --service libdatadog \ | |
| --env ci \ | |
| --logs \ | |
| --tags rustc:${{ matrix.rust_version }},arch:${{ runner.arch }},os:${{ runner.os }},platform:${{ matrix.platform }} \ | |
| target/nextest/ci/junit.xml | |
| env: | |
| DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} | |
| ffi: | |
| name: "FFI #${{ matrix.platform }} ${{ matrix.rust_version }}" | |
| runs-on: ${{ matrix.platform }} | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 | |
| strategy: | |
| matrix: | |
| platform: [windows-latest, ubuntu-latest, macos-15] | |
| rust_version: [""] | |
| include: | |
| - platform: "ubuntu-latest" | |
| rust_version: "${RUST_VERSION}" | |
| - platform: "ubuntu-latest" | |
| flags: "-C relocation-model=pic" | |
| - platform: "macos-15" | |
| flags: "-C relocation-model=pic" | |
| - platform: "windows-latest" | |
| flags: "-C target-feature=+crt-static" | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 | |
| with: | |
| submodules: recursive | |
| - name: Setup output dir | |
| shell: bash | |
| run: | | |
| WORKSPACE_PATH=${{ github.workspace }} | |
| if [[ "${{ matrix.platform }}" == "windows-latest" ]]; then | |
| WORKSPACE_PATH=$(cygpath -ua '${{ github.workspace }}') | |
| fi | |
| echo "LIBDD_OUTPUT_FOLDER=$WORKSPACE_PATH/artifacts" >> $GITHUB_ENV | |
| - name: Free Disk Space (Ubuntu only) | |
| if: runner.os == 'Linux' && matrix.platform == 'ubuntu-latest' | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # 1.3.1 | |
| with: | |
| tool-cache: false | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: false | |
| docker-images: false | |
| swap-storage: true | |
| - name: Install Rust ${{ matrix.rust_version }} | |
| if: matrix.rust_version != '' | |
| run: rustup install ${{ matrix.rust_version }} && rustup default ${{ matrix.rust_version }} | |
| - id: rust-version | |
| # On Windows run happens in a PowerShell, so start bash explicitly | |
| run: bash -c 'echo "version=$(rustc --version)" >> $GITHUB_OUTPUT' | |
| - name: Cache [rust] | |
| uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1 | |
| env: | |
| RUSTFLAGS: "${{ matrix.flags }}" | |
| with: | |
| cache-targets: true # cache build artifacts | |
| cache-bin: true # cache the ~/.cargo/bin directory | |
| - name: "Generate profiling FFI" | |
| shell: bash | |
| env: | |
| RUSTFLAGS: "${{ matrix.flags }}" | |
| run: | | |
| cargo run --bin release --release -- --out $LIBDD_OUTPUT_FOLDER | |
| - name: 'Publish libdatadog' | |
| uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1 | |
| # Only upload the artifacts built with the default Rust version | |
| if: (success() || failure()) && matrix.rust_version == '' | |
| with: | |
| if-no-files-found: error | |
| name: libdatadog.${{ matrix.platform }} | |
| path: ${{ github.workspace }}/artifacts | |
| retention-days: 1 | |
| - name: "(Windows) Test building Profiling C bindings - dynamic link vc runtime" | |
| if: matrix.platform == 'windows-latest' | |
| shell: bash | |
| run: | | |
| set -e | |
| rm -rf examples/ffi/build_dll | |
| mkdir examples/ffi/build_dll | |
| cd examples/ffi/build_dll | |
| cmake -S .. -DDatadog_ROOT=$LIBDD_OUTPUT_FOLDER -DVCRUNTIME_LINK_TYPE=DLL | |
| cmake --build . | |
| - name: "(Windows) Test building Profiling C bindings - static link vc runtime" | |
| if: matrix.platform == 'windows-latest' | |
| shell: bash | |
| run: | | |
| set -e | |
| rm -rf examples/ffi/build_static | |
| mkdir examples/ffi/build_static | |
| cd examples/ffi/build_static | |
| cmake -S .. -DDatadog_ROOT=$LIBDD_OUTPUT_FOLDER -DVCRUNTIME_LINK_TYPE=STATIC | |
| cmake --build . | |
| - name: "Test building Profiling C bindings" | |
| shell: bash | |
| if: matrix.platform != 'windows-latest' | |
| run: | | |
| set -e | |
| mkdir examples/ffi/build | |
| cd examples/ffi/build | |
| # Add BUILD_SYMBOLIZER variable only for Linux platforms | |
| if [[ "${{ matrix.platform }}" == "ubuntu-latest" ]]; then | |
| cmake -S .. -DDatadog_ROOT=$LIBDD_OUTPUT_FOLDER -DBUILD_SYMBOLIZER=true | |
| else | |
| cmake -S .. -DDatadog_ROOT=$LIBDD_OUTPUT_FOLDER | |
| fi | |
| cmake --build . | |
| - name: "Run FFI examples" | |
| shell: bash | |
| if: matrix.platform != 'windows-latest' | |
| run: | | |
| cargo ffi-test --skip-build | |
| - name: "(Windows) Run FFI examples" | |
| shell: bash | |
| if: matrix.platform == 'windows-latest' | |
| run: | | |
| cargo ffi-test | |
| - name: "Test building CXX bindings - Crashinfo (Unix)" | |
| shell: bash | |
| if: matrix.platform != 'windows-latest' | |
| run: | | |
| set -e | |
| cd examples/cxx | |
| ./build-and-run-crashinfo.sh | |
| - name: "Test building CXX bindings - Profiling (Unix)" | |
| shell: bash | |
| if: matrix.platform != 'windows-latest' | |
| run: | | |
| set -e | |
| cd examples/cxx | |
| ./build-profiling.sh | |
| - name: "Setup MSVC (Windows)" | |
| if: matrix.platform == 'windows-latest' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: "Test building CXX bindings - Crashinfo (Windows)" | |
| shell: pwsh | |
| if: matrix.platform == 'windows-latest' | |
| run: | | |
| cd examples/cxx | |
| .\build-and-run-crashinfo.ps1 | |
| - name: "Test building CXX bindings - Profiling (Windows)" | |
| shell: pwsh | |
| if: matrix.platform == 'windows-latest' | |
| run: | | |
| cd examples/cxx | |
| .\build-profiling.ps1 | |
| cross-centos7: | |
| name: Test x86_64-unknown-linux-gnu on centOS7 docker image | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ci-${{ github.ref }}-cross-centos7 | |
| cancel-in-progress: true | |
| steps: | |
| - name: Free Disk Space | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # 1.3.1 | |
| with: | |
| tool-cache: true | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: true | |
| swap-storage: true | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 | |
| with: | |
| submodules: recursive | |
| - name: Cache [rust] | |
| uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1 | |
| with: | |
| cache-targets: true # cache build artifacts | |
| cache-bin: true # cache the ~/.cargo/bin directory | |
| - name: Build CentOS 7 Docker image | |
| run: docker build -t libdatadog-centos7 -f tools/docker/Dockerfile.centos . | |
| - name: "cargo nextest run (centos7)" | |
| # Run docker as a user, not the default root | |
| # Mount and use the runner's toolchain as it's the same arch | |
| # exclude tracing integration tests since they require docker in docker to run a test-agent | |
| run: >- | |
| docker run --rm | |
| --user "$(id -u):$(id -g)" | |
| -v "${{ github.workspace }}:/workspace" | |
| -v "${CARGO_HOME:-$HOME/.cargo}:/usr/local/cargo" | |
| -v "${RUSTUP_HOME:-$HOME/.rustup}:/usr/local/rustup" | |
| -e CARGO_HOME=/usr/local/cargo | |
| -e RUSTUP_HOME=/usr/local/rustup | |
| -e PATH=/usr/local/cargo/bin:/usr/local/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:/opt/rh/devtoolset-11/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
| -w /workspace | |
| libdatadog-centos7 | |
| cargo nextest run --workspace --features libdd-crashtracker/generate-unit-test-files | |
| --exclude builder --profile ci | |
| -E '!test(tracing_integration_tests::)' | |
| - name: Add file attributes to JUnit XML | |
| if: success() || failure() | |
| run: cargo run --bin add_junit_file_attributes -- target/nextest/ci/junit.xml | |
| - name: Report Test Results | |
| if: success() || failure() | |
| uses: mikepenz/action-junit-report@db71d41eb79864e25ab0337e395c352e84523afe # 4.3.1 | |
| with: | |
| report_paths: "target/nextest/ci/junit.xml" | |
| check_name: "[centos7] test report" | |
| include_passed: true | |
| - name: Upload test results to Datadog | |
| if: success() || failure() | |
| run: | | |
| URL="https://github.com/DataDog/datadog-ci/releases/download/v4.2.2/datadog-ci_linux-x64" | |
| OUTPUT="datadog-ci" | |
| EXPECTED_CHECKSUM="3e1e9649d15d3feacced89ec90de66151046a58c7844217e4112362ad8dbf8d1" | |
| echo "Downloading datadog-ci from $URL" | |
| curl -L --fail --retry 3 -o "$OUTPUT" "$URL" | |
| chmod +x "$OUTPUT" | |
| ACTUAL_CHECKSUM=$(sha256sum "$OUTPUT" | cut -d' ' -f1) | |
| echo "Expected checksum: $EXPECTED_CHECKSUM" | |
| echo "Actual checksum: $ACTUAL_CHECKSUM" | |
| if [ "$ACTUAL_CHECKSUM" != "$EXPECTED_CHECKSUM" ]; then | |
| echo "Checksum verification failed!" | |
| exit 1 | |
| fi | |
| echo "Checksum verification passed" | |
| ./"$OUTPUT" junit upload \ | |
| --service libdatadog \ | |
| --env ci \ | |
| --logs \ | |
| --tags arch:${{ runner.arch }},os:Linux,platform:centos7 \ | |
| target/nextest/ci/junit.xml | |
| env: | |
| DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} | |
| ffi_bake: | |
| strategy: | |
| matrix: | |
| target: [alpine-build] # debian-build-aarch64 is oom killed at the moment | |
| name: "FFI ${{ matrix.target }} via docker bake" | |
| concurrency: | |
| group: ci-${{ github.ref }}-${{ matrix.target }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| runs-on: | |
| labels: ubuntu-latest-16-cores | |
| group: APM Larger Runners | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 | |
| with: | |
| submodules: recursive | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # 3.10.0 | |
| with: | |
| buildkitd-config: .github/buildkitd-16-cores.toml | |
| - name: Build and Generate FFI | |
| uses: docker/bake-action@4ba453fbc2db7735392b93edf935aaf9b1e8f747 # 6.5.0 | |
| with: | |
| targets: ${{ matrix.target }} | |
| # Caching is useful, when it works. We are routinely hanging, maybe this: | |
| # https://github.com/docker/buildx/issues/537 | |
| #set: | | |
| # *.cache-from=type=gha,scope=${{ matrix.target }} | |
| # *.cache-to=type=gha,mode=max,scope=${{ matrix.target }} |