Skip to content

Commit de19749

Browse files
authored
feat: new gotip workflow (#4314)
1 parent 116f672 commit de19749

File tree

2 files changed

+67
-6
lines changed

2 files changed

+67
-6
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Gotip Testing
2+
3+
on:
4+
schedule: # nightly
5+
- cron: "0 0 * * *"
6+
workflow_dispatch: { } # manually
7+
8+
env:
9+
TEST_RESULTS: /tmp/tip-results # path to where test results will be saved
10+
11+
jobs:
12+
test-tip:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
17+
with:
18+
ref: ${{ github.ref }}
19+
repository: DataDog/dd-trace-go
20+
21+
- name: Get Gotip
22+
run: |-
23+
go install golang.org/dl/gotip@latest
24+
echo "$HOME/go/bin" >> "$GITHUB_PATH"
25+
echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
26+
27+
- name: Download dependencies
28+
env:
29+
GO_CMD: gotip
30+
run: |-
31+
./scripts/install_tools.sh --bin-dir ${{ github.workspace }}/bin
32+
gotip download
33+
gotip get -u -t github.com/DataDog/datadog-agent@main
34+
gotip mod tidy
35+
find . -iname go.mod -exec dirname {} \; | while read -r d; do pushd "$d" && gotip mod tidy && popd; done
36+
37+
- name: Run tests
38+
env:
39+
DD_APPSEC_WAF_TIMEOUT: 1h
40+
TEST_RESULTS: ${{ env.TEST_RESULTS }}
41+
GO_CMD: gotip
42+
run: ./scripts/ci_test_core.sh
43+
44+
- name: Upload the results to Datadog CI App
45+
if: always()
46+
continue-on-error: true
47+
uses: ./.github/actions/dd-ci-upload
48+
with:
49+
dd-api-key: ${{ secrets.DD_CI_API_KEY }}
50+
path: ${{ env.TEST_RESULTS }}
51+
tags: go:gotip,arch:${{ runner.arch }},os:${{ runner.os }}
52+
53+
- name: Upload Coverage
54+
if: always()
55+
shell: bash
56+
run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}

scripts/ci_test_core.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ BUILD_TAGS="${BUILD_TAGS:-}"
88
TEST_RESULTS="${TEST_RESULTS:-.}"
99
mkdir -p "$TEST_RESULTS"
1010

11+
GO_CMD="${GO_CMD:-go}"
12+
echo "Running tests with $GO_CMD"
13+
1114
# Packages that don't support -shuffle on yet
1215
NO_SHUFFLE_PATTERN="(github\.com/DataDog/dd-trace-go/v2/ddtrace/tracer|\
1316
github\.com/DataDog/dd-trace-go/v2/internal/civisibility/utils|\
1417
github\.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo|\
1518
github\.com/DataDog/dd-trace-go/v2/instrumentation/httptrace)$"
1619

17-
mapfile -t SHUFFLE_PACKAGES < <(go list ./... | grep -v /contrib/ | grep -Ev "$NO_SHUFFLE_PATTERN")
18-
mapfile -t NO_SHUFFLE_PACKAGES < <(go list ./... | grep -v /contrib/ | grep -E "$NO_SHUFFLE_PATTERN")
20+
mapfile -t SHUFFLE_PACKAGES < <($GO_CMD list ./... | grep -v /contrib/ | grep -Ev "$NO_SHUFFLE_PATTERN")
21+
mapfile -t NO_SHUFFLE_PACKAGES < <($GO_CMD list ./... | grep -v /contrib/ | grep -E "$NO_SHUFFLE_PATTERN")
1922

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

32-
export GOEXPERIMENT=synctest # TODO: remove once go1.25 is the minimum supported version
35+
if [[ "$GO_CMD" == "go" ]]; then
36+
export GOEXPERIMENT=synctest # TODO: remove once go1.25 is the minimum supported version
37+
fi
3338

3439
# Run tests with shuffle for packages that support it
35-
gotestsum --junitfile "${TEST_RESULTS}/gotestsum-report.xml" -- -v -race "$TAGS_ARG" -shuffle=on -coverprofile=coverage.txt -covermode=atomic "${SHUFFLE_PACKAGES[@]}"
40+
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[@]}"
3641
test_exit=$?
3742
[[ $test_exit -ne 0 ]] && report_error=1
3843

3944
# Run tests without shuffle for packages that don't support it yet
40-
gotestsum --junitfile "${TEST_RESULTS}/gotestsum-report-noshuffle.xml" -- -v -race "$TAGS_ARG" -coverprofile=coverage-noshuffle.txt -covermode=atomic "${NO_SHUFFLE_PACKAGES[@]}"
45+
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[@]}"
4146
test_exit=$?
4247
[[ $test_exit -ne 0 ]] && report_error=1
4348

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

0 commit comments

Comments
 (0)