Skip to content

Commit b104e0e

Browse files
authored
ci: cache datadog-ci (#9702)
1 parent 9e053ce commit b104e0e

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

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

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Upload tests to datadog
1+
name: Upload tests to Datadog
22
if: always()
33
inputs:
44
api-key:
@@ -7,8 +7,26 @@ inputs:
77
runs:
88
using: "composite"
99
steps:
10+
- name: Set work dir
11+
shell: bash
12+
run: |
13+
WORK_DIR=${{ runner.temp }}/datadog-ci
14+
mkdir -p $WORK_DIR
15+
echo "WORK_DIR=$WORK_DIR" >> $GITHUB_ENV
16+
# The npm install was taking 30s to 1m, accounting for 20+% of the total
17+
# job time.
18+
- name: Cache datadog-ci
19+
uses: buildjet/cache@v3
20+
with:
21+
path: |
22+
${{ env.WORK_DIR }}
23+
key: datadog-ci-${{ runner.os }}
24+
restore-keys: |
25+
datadog-ci-${{ runner.os }}-
26+
datadog-ci-
1027
- shell: bash
1128
run: |
29+
cd ${{ env.WORK_DIR }}
1230
owner=${{ github.repository_owner }}
1331
echo "owner: $owner"
1432
if [[ $owner != "coder" ]]; then
@@ -20,8 +38,8 @@ runs:
2038
echo "No API key provided, skipping..."
2139
exit 0
2240
fi
23-
npm install -g @datadog/datadog-ci@2.10.0
24-
datadog-ci junit upload --service coder ./gotests.xml \
41+
npm install @datadog/datadog-ci@2.10.0
42+
npm x -- datadog-ci junit upload --service coder ./gotests.xml \
2543
--tags os:${{runner.os}} --tags runner_name:${{runner.name}}
2644
env:
2745
DATADOG_API_KEY: ${{ inputs.api-key }}

0 commit comments

Comments
 (0)