Skip to content

feat(lambda): add invocation wrapper, public API, and root span creation #1324

feat(lambda): add invocation wrapper, public API, and root span creation

feat(lambda): add invocation wrapper, public API, and root span creation #1324

Workflow file for this run

name: Test
permissions:
contents: read
on:
push:
workflow_dispatch:
schedule:
- cron: '00 03 * * 1-5'
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 }}
strategy:
matrix:
platform: [windows-latest, ubuntu-latest, macos-14]
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 # v1.3.1
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: true
- name: Checkout sources
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Cache
uses: ./.github/actions/cache
with:
rust_version: ${{ matrix.rust_version }}
- 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@955a6ff1416eae278c9f833008a9beb4b7f9afe3 # v2.49.15,
with:
tool: nextest@0.9.81
- name: "Remove nextest CI report"
shell: bash
run: rm -rf target/nextest/ci/junit.xml
- name: "[${{ steps.rust-version.outputs.version}}] cargo build --workspace --verbose --locked"
shell: bash
run: cargo build --workspace --verbose --locked
- name: "[${{ steps.rust-version.outputs.version}}] test agent integration tests"
if: runner.os == 'Linux'
shell: bash
run: cargo nextest run --workspace --profile ci --locked -E 'test(integration_tests::)'
env:
RUST_BACKTRACE: 1
- name: "[${{ steps.rust-version.outputs.version}}] cargo nextest run --workspace --profile ci --locked"
shell: bash
# Run doc tests with cargo test and run tests with nextest and generate junit.xml
run: cargo test --workspace --doc --verbose --locked && cargo nextest run --workspace --profile ci --locked -E '!test(integration_tests::)'
env:
RUST_BACKTRACE: 1
- name: Report Test Results
if: success() || failure()
uses: mikepenz/action-junit-report@db71d41eb79864e25ab0337e395c352e84523afe # v4.3.1
with:
report_paths: "target/nextest/ci/junit.xml"
check_name: "[${{ matrix.platform }}:${{ matrix.rust_version }}] test report"
include_passed: true
- name: Add final_status property
if: success() || failure()
shell: bash
run: |
which xsltproc || sudo apt-get install -y xsltproc
xml_file="target/nextest/ci/junit.xml"
echo "Fixing $xml_file"
tmp_file="$(mktemp)"
xsltproc --output "$tmp_file" ".github/workflows/add_final_status.xsl" "$xml_file"
mv "$tmp_file" "$xml_file"
- 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 dd-trace-rs \
--env ci \
--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 }}
cross-centos7:
name: build and test using cross - on centos7
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 # v1.3.1
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: true
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Cache
uses: ./.github/actions/cache
with:
rust_version: cross-centos7
- run: cargo install cross || true
- run: cross build --locked --workspace --target x86_64-unknown-linux-gnu
- run: cross test --locked --workspace --target x86_64-unknown-linux-gnu -- --skip "integration_tests::"
# TODO: check if we can avoid build-artifacts step indicating the target branch with _system_tests_library_target_branch of run-parametric.yml
build-artifacts:
runs-on: ubuntu-latest
steps:
- name: Checkout dd-trace-rs
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Pack dd-trace-rs
run: mkdir -p ./binaries/dd-trace-rs && cp -r datadog-opentelemetry Cargo.toml ./binaries/dd-trace-rs/
- name: Upload artifact
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: system_tests_binaries
path: ./binaries/**/*
parametric:
needs:
- build-artifacts
uses: DataDog/system-tests/.github/workflows/run-parametric.yml@93283b322c59ecf7267c28c06648d341be75eded # main
secrets:
TEST_OPTIMIZATION_API_KEY: ${{ secrets.DATADOG_API_KEY }}
with:
library: rust
binaries_artifact: system_tests_binaries
job_count: 2
job_matrix: '[1,2]'
ref: 93283b322c59ecf7267c28c06648d341be75eded # main
push_to_test_optimization: true