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

Skip to content

ci: send test statistics to DataDog #7786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/actions/setup-go/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ runs:
with:
cache: true
go-version: "~1.20"
- name: Install gotestsum
uses: jaxxstorm/[email protected]
with:
repo: gotestyourself/gotestsum
tag: v1.9.0
16 changes: 16 additions & 0 deletions .github/actions/upload-datadog/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Upload tests to datadog
if: always()
inputs:
api-key:
description: "Datadog API key"
required: true
runs:
using: "composite"
steps:
- shell: bash
run: |
npm install -g @datadog/datadog-ci
datadog-ci junit upload --service coder ./gotests.xml \
--tags os:${{runner.os}} --tags runner_name:${{runner.name}}
env:
DATADOG_API_KEY: ${{ inputs.api-key }}
33 changes: 16 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,6 @@ jobs:

- uses: ./.github/actions/setup-go

- name: Install gotestsum
uses: jaxxstorm/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repo: gotestyourself/gotestsum
tag: v1.9.0

- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.1.9
Expand Down Expand Up @@ -243,6 +235,11 @@ jobs:
path: ./gotests.xml
retention-days: 30

- uses: ./.github/actions/upload-datadog
if: always()
with:
api-key: ${{ secrets.DATADOG_API_KEY }}

- uses: codecov/codecov-action@v3
# This action has a tendency to error out unexpectedly, it has
# the `fail_ci_if_error` option that defaults to `false`, but
Expand All @@ -267,14 +264,6 @@ jobs:

- uses: ./.github/actions/setup-go

- name: Install gotestsum
uses: jaxxstorm/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repo: gotestyourself/gotestsum
tag: v1.9.0

- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.1.9
Expand All @@ -299,6 +288,11 @@ jobs:
path: ./gotests.xml
retention-days: 30

- uses: ./.github/actions/upload-datadog
if: always()
with:
api-key: ${{ secrets.DATADOG_API_KEY }}

- uses: codecov/codecov-action@v3
# This action has a tendency to error out unexpectedly, it has
# the `fail_ci_if_error` option that defaults to `false`, but
Expand Down Expand Up @@ -326,7 +320,12 @@ jobs:

- name: Run Tests
run: |
go test -race ./...
gotestsum --junitfile="gotests.xml" -- -race ./...

- uses: ./.github/actions/upload-datadog
if: always()
with:
api-key: ${{ secrets.DATADOG_API_KEY }}

deploy:
name: "deploy"
Expand Down