From 3d3ae8c093e4d3e1fd19c9bb3a02c3c0c4797cb3 Mon Sep 17 00:00:00 2001 From: Kar Rui Lau Date: Wed, 4 Sep 2024 12:53:29 +0800 Subject: [PATCH] ci: add datadog instrumentation to test CI (#315) --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d38836b0..3885bc5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,8 +35,21 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup + - name: Configure Datadog Test Visibility + env: + DD_SERVICE_NAME: ${{ secrets.DD_SERVICE_NAME }} + DD_API_KEY: ${{ secrets.DD_API_KEY }} + if: env.DD_SERVICE_NAME != '' && env.DD_API_KEY != '' + uses: datadog/test-visibility-github-action@v1 + with: + languages: js + service-name: ${{ secrets.DD_SERVICE_NAME }} + api-key: ${{ secrets.DD_API_KEY }} - name: Test run: npm run test:vitest + env: + # Required to allow Datadog to trace Vitest tests + NODE_OPTIONS: -r ${{ env.DD_TRACE_PACKAGE }} --import ${{ env.DD_TRACE_ESM_IMPORT }} end-to-end-tests: name: End-to-end tests @@ -73,8 +86,21 @@ jobs: - name: Build app run: npm run build + - name: Configure Datadog Test Visibility + env: + DD_SERVICE_NAME: ${{ secrets.DD_SERVICE_NAME }} + DD_API_KEY: ${{ secrets.DD_API_KEY }} + if: env.DD_SERVICE_NAME != '' && env.DD_API_KEY != '' + uses: datadog/test-visibility-github-action@v1 + with: + languages: js + service-name: ${{ secrets.DD_SERVICE_NAME }} + api-key: ${{ secrets.DD_API_KEY }} - name: Run Playwright tests run: npm run test-ci:e2e + env: + # Required to allow Datadog to trace Playwright tests + NODE_OPTIONS: -r ${{ env.DD_TRACE_PACKAGE }} - name: Stop test containers run: npm run teardown