diff --git a/.github/actions/ci-test-result.cjs b/.github/actions/ci-test-result.cjs index 0c66ece5848..6626578e959 100644 --- a/.github/actions/ci-test-result.cjs +++ b/.github/actions/ci-test-result.cjs @@ -3,7 +3,8 @@ const fs = require('node:fs'); const process = require('node:process'); const { sendMetricsToGCP, makeTimeSeries } = require('./gcp-monitoring.cjs'); -const resultFiles = process.argv.slice(2); +const resultFiles = process.argv.slice(3); +const branchName = process.argv[2]; const tapResultRegex = new RegExp( `(^(?not )?ok (?[0-9]+) - (?.+?)(?: %ava-dur=(?[0-9]+)ms)?(?:# (?.+?))?$(?(\n^#.+?$)*)(?(\n^(?:(?!(?:not|ok) ))[^\n\r]+?$)*))`, @@ -39,6 +40,8 @@ function processTAP(packageName, tapbody) { labels: { test_name: testCaseName, package: packageName, + branch: branchName, + duration: m.groups.duration ? parseInt(m.groups.duration, 10) : null, test_status: succeeded && !(todo || skipped) ? 'succeeded' diff --git a/.github/actions/gcp-monitoring.cjs b/.github/actions/gcp-monitoring.cjs index d6bea4ea25a..c2c8d2ef246 100644 --- a/.github/actions/gcp-monitoring.cjs +++ b/.github/actions/gcp-monitoring.cjs @@ -34,7 +34,7 @@ async function sendMetricsToGCP(timeSeries) { function makeTimeSeries(testData) { const timeSeries = testData.map(({ labels, value }) => ({ metric: { - type: `custom.googleapis.com/github/test-results`, + type: `custom.googleapis.com/github-test/test-results`, labels, }, resource: { diff --git a/.github/actions/post-test/action.yml b/.github/actions/post-test/action.yml index 6515ff3ef53..f8eef7e0318 100644 --- a/.github/actions/post-test/action.yml +++ b/.github/actions/post-test/action.yml @@ -63,4 +63,4 @@ runs: env: GCP_CREDENTIALS: ${{ inputs.gcp-credentials }} run: | - node .github/actions/ci-test-result.cjs ./packages/*/_testoutput.txt + node .github/actions/ci-test-result.cjs ${{ github.ref_name }} ./packages/*/_testoutput.txt