Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6b4d3f8

Browse files
authored
chore: reduce "Upload tests to datadog" times in CI (#17668)
This PR speeds up the "Upload tests to datadog" step by downloading the `datadog-ci` binary directly from GitHub releases. Most of the time used to be spent in `npm install`, which consistently timed out on Windows after a minute. [Now it takes 3 seconds](https://github.com/coder/coder/actions/runs/14834976784/job/41644230049?pr=17668#step:10:1). I updated it to version v2.48.0 because v2.21.0 didn't have the artifacts for arm64 macOS.
1 parent 4369765 commit 6b4d3f8

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

.github/actions/upload-datadog/action.yaml

+41-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ runs:
1010
steps:
1111
- shell: bash
1212
run: |
13+
set -e
14+
1315
owner=${{ github.repository_owner }}
1416
echo "owner: $owner"
1517
if [[ $owner != "coder" ]]; then
@@ -21,8 +23,45 @@ runs:
2123
echo "No API key provided, skipping..."
2224
exit 0
2325
fi
24-
npm install -g @datadog/[email protected]
25-
datadog-ci junit upload --service coder ./gotests.xml \
26+
27+
BINARY_VERSION="v2.48.0"
28+
BINARY_HASH_WINDOWS="b7bebb8212403fddb1563bae84ce5e69a70dac11e35eb07a00c9ef7ac9ed65ea"
29+
BINARY_HASH_MACOS="e87c808638fddb21a87a5c4584b68ba802965eb0a593d43959c81f67246bd9eb"
30+
BINARY_HASH_LINUX="5e700c465728fff8313e77c2d5ba1ce19a736168735137e1ddc7c6346ed48208"
31+
32+
TMP_DIR=$(mktemp -d)
33+
34+
if [[ "${{ runner.os }}" == "Windows" ]]; then
35+
BINARY_PATH="${TMP_DIR}/datadog-ci.exe"
36+
BINARY_URL="https://github.com/DataDog/datadog-ci/releases/download/${BINARY_VERSION}/datadog-ci_win-x64"
37+
elif [[ "${{ runner.os }}" == "macOS" ]]; then
38+
BINARY_PATH="${TMP_DIR}/datadog-ci"
39+
BINARY_URL="https://github.com/DataDog/datadog-ci/releases/download/${BINARY_VERSION}/datadog-ci_darwin-arm64"
40+
elif [[ "${{ runner.os }}" == "Linux" ]]; then
41+
BINARY_PATH="${TMP_DIR}/datadog-ci"
42+
BINARY_URL="https://github.com/DataDog/datadog-ci/releases/download/${BINARY_VERSION}/datadog-ci_linux-x64"
43+
else
44+
echo "Unsupported OS: ${{ runner.os }}"
45+
exit 1
46+
fi
47+
48+
echo "Downloading DataDog CI binary version ${BINARY_VERSION} for ${{ runner.os }}..."
49+
curl -sSL "$BINARY_URL" -o "$BINARY_PATH"
50+
51+
if [[ "${{ runner.os }}" == "Windows" ]]; then
52+
echo "$BINARY_HASH_WINDOWS $BINARY_PATH" | sha256sum --check
53+
elif [[ "${{ runner.os }}" == "macOS" ]]; then
54+
echo "$BINARY_HASH_MACOS $BINARY_PATH" | shasum -a 256 --check
55+
elif [[ "${{ runner.os }}" == "Linux" ]]; then
56+
echo "$BINARY_HASH_LINUX $BINARY_PATH" | sha256sum --check
57+
fi
58+
59+
# Make binary executable (not needed for Windows)
60+
if [[ "${{ runner.os }}" != "Windows" ]]; then
61+
chmod +x "$BINARY_PATH"
62+
fi
63+
64+
"$BINARY_PATH" junit upload --service coder ./gotests.xml \
2665
--tags os:${{runner.os}} --tags runner_name:${{runner.name}}
2766
env:
2867
DATADOG_API_KEY: ${{ inputs.api-key }}

0 commit comments

Comments
 (0)