Skip to content

Commit 66fb2bd

Browse files
committed
ci: cache datadog-ci
1 parent efe8044 commit 66fb2bd

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

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

+20-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,25 @@ inputs:
77
runs:
88
using: "composite"
99
steps:
10+
- name: Set work dir
11+
run: |
12+
WORK_DIR=${{ runner.temp }}/datadog-ci
13+
mkdir -p $WORK_DIR
14+
echo "WORK_DIR=$WORK_DIR" >> $GITHUB_ENV
15+
# The npm install was taking 30s to 1m, accounting for 20+% of the total
16+
# job time.
17+
- name: Cache datadog-ci
18+
uses: buildjet/cache@v3
19+
with:
20+
path: |
21+
${{ env.WORK_DIR }}
22+
key: datadog-ci-${{ runner.os }}
23+
restore-keys: |
24+
datadog-ci-${{ runner.os }}-
25+
datadog-ci-
1026
- shell: bash
1127
run: |
28+
cd ${{ env.WORK_DIR }}
1229
owner=${{ github.repository_owner }}
1330
echo "owner: $owner"
1431
if [[ $owner != "coder" ]]; then
@@ -20,8 +37,8 @@ runs:
2037
echo "No API key provided, skipping..."
2138
exit 0
2239
fi
23-
npm install -g @datadog/datadog-ci@2.10.0
24-
datadog-ci junit upload --service coder ./gotests.xml \
40+
npm install @datadog/datadog-ci@2.10.0
41+
npm x datadog-ci junit upload --service coder ./gotests.xml \
2542
--tags os:${{runner.os}} --tags runner_name:${{runner.name}}
2643
env:
2744
DATADOG_API_KEY: ${{ inputs.api-key }}

0 commit comments

Comments
 (0)