Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/gotip-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Gotip Testing

on:
schedule: # nightly
- cron: "0 0 * * *"
workflow_dispatch: { } # manually

env:
TEST_RESULTS: /tmp/tip-results # path to where test results will be saved

jobs:
test-tip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
ref: ${{ github.ref }}
repository: DataDog/dd-trace-go

- name: Get Gotip
run: |-
go install golang.org/dl/gotip@latest
echo "$HOME/go/bin" >> "$GITHUB_PATH"
echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"

- name: Download dependencies
env:
GO_CMD: gotip
run: |-
./scripts/install_tools.sh --bin-dir ${{ github.workspace }}/bin
gotip download
gotip get -u -t github.com/DataDog/datadog-agent@main
gotip mod tidy
find . -iname go.mod -exec dirname {} \; | while read -r d; do pushd "$d" && gotip mod tidy && popd; done

- name: Run tests
env:
DD_APPSEC_WAF_TIMEOUT: 1h
TEST_RESULTS: ${{ env.TEST_RESULTS }}
GO_CMD: gotip
run: ./scripts/ci_test_core.sh

- name: Upload the results to Datadog CI App
if: always()
continue-on-error: true
uses: ./.github/actions/dd-ci-upload
with:
dd-api-key: ${{ secrets.DD_CI_API_KEY }}
path: ${{ env.TEST_RESULTS }}
tags: go:gotip,arch:${{ runner.arch }},os:${{ runner.os }}

- name: Upload Coverage
if: always()
shell: bash
run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}
17 changes: 11 additions & 6 deletions scripts/ci_test_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ BUILD_TAGS="${BUILD_TAGS:-}"
TEST_RESULTS="${TEST_RESULTS:-.}"
mkdir -p "$TEST_RESULTS"

GO_CMD="${GO_CMD:-go}"
echo "Running tests with $GO_CMD"

# Packages that don't support -shuffle on yet
NO_SHUFFLE_PATTERN="(github\.com/DataDog/dd-trace-go/v2/ddtrace/tracer|\
github\.com/DataDog/dd-trace-go/v2/internal/civisibility/utils|\
github\.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo|\
github\.com/DataDog/dd-trace-go/v2/instrumentation/httptrace)$"

mapfile -t SHUFFLE_PACKAGES < <(go list ./... | grep -v /contrib/ | grep -Ev "$NO_SHUFFLE_PATTERN")
mapfile -t NO_SHUFFLE_PACKAGES < <(go list ./... | grep -v /contrib/ | grep -E "$NO_SHUFFLE_PATTERN")
mapfile -t SHUFFLE_PACKAGES < <($GO_CMD list ./... | grep -v /contrib/ | grep -Ev "$NO_SHUFFLE_PATTERN")
mapfile -t NO_SHUFFLE_PACKAGES < <($GO_CMD list ./... | grep -v /contrib/ | grep -E "$NO_SHUFFLE_PATTERN")

# Set +e so that we run all test commands even if one fails
set +e
Expand All @@ -29,20 +32,22 @@ else
echo "Running standard tests for core packages"
fi

export GOEXPERIMENT=synctest # TODO: remove once go1.25 is the minimum supported version
if [[ "$GO_CMD" == "go" ]]; then
export GOEXPERIMENT=synctest # TODO: remove once go1.25 is the minimum supported version
fi

# Run tests with shuffle for packages that support it
gotestsum --junitfile "${TEST_RESULTS}/gotestsum-report.xml" -- -v -race "$TAGS_ARG" -shuffle=on -coverprofile=coverage.txt -covermode=atomic "${SHUFFLE_PACKAGES[@]}"
gotestsum --raw-command --junitfile "${TEST_RESULTS}/gotestsum-report.xml" -- $GO_CMD test -json -v -race "$TAGS_ARG" -shuffle=on -coverprofile=coverage.txt -covermode=atomic "${SHUFFLE_PACKAGES[@]}"
test_exit=$?
[[ $test_exit -ne 0 ]] && report_error=1

# Run tests without shuffle for packages that don't support it yet
gotestsum --junitfile "${TEST_RESULTS}/gotestsum-report-noshuffle.xml" -- -v -race "$TAGS_ARG" -coverprofile=coverage-noshuffle.txt -covermode=atomic "${NO_SHUFFLE_PACKAGES[@]}"
gotestsum --raw-command --junitfile "${TEST_RESULTS}/gotestsum-report-noshuffle.xml" -- $GO_CMD test -json -v -race "$TAGS_ARG" -coverprofile=coverage-noshuffle.txt -covermode=atomic "${NO_SHUFFLE_PACKAGES[@]}"
test_exit=$?
[[ $test_exit -ne 0 ]] && report_error=1

cd ./internal/exectracetest
gotestsum --junitfile "${TEST_RESULTS}/gotestsum-report-exectrace.xml" -- -v -race "$TAGS_ARG" -coverprofile=coverage.txt -covermode=atomic ./...
gotestsum --raw-command --junitfile "${TEST_RESULTS}/gotestsum-report-exectrace.xml" -- $GO_CMD test -json -v -race "$TAGS_ARG" -coverprofile=coverage.txt -covermode=atomic ./...
test_exit=$?
[[ $test_exit -ne 0 ]] && report_error=1

Expand Down
Loading