Skip to content

Test Action

Test Action #313

Workflow file for this run

name: 'Test Action'
on:
pull_request:
push:
branches:
- main
- 'release/*'
schedule:
- cron: '0 0 * * *' # Runs at midnight UTC every day
jobs:
test:
strategy:
matrix:
version: [14, 16, 18, 20, 22, 24, 25]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Upload reports using a glob pattern
uses: ./
with:
api_key: ${{secrets.DD_API_KEY_CI_VISIBILITY}}
logs: "true"
files: '**/fixtures/**'
service: junit-upload-github-action-tests
env: ci
tags: "foo:bar,alpha:bravo,test.node.version:${{ matrix.version}}"
node-version: ${{ matrix.version}}
- name: Check that test data can be queried
run: |
npm install @datadog/datadog-api-client
node ./check-junit-upload.js
env:
EXTRA_TAGS: "@foo:bar @alpha:bravo @test.node.version:${{ matrix.version}}"
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
DD_SERVICE: junit-upload-github-action-tests
test-older-datadog-ci-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Grab second latest version of @datadog/datadog-ci
run: |
SECOND_LATEST_VERSION=$(curl -s "https://api.github.com/repos/datadog/datadog-ci/releases" | jq '[.[] | {tag_name: .tag_name, published_at: .published_at}] | sort_by(.published_at) | reverse | .[:2] | .[1] | .tag_name')
echo "SECOND_LATEST_VERSION=$SECOND_LATEST_VERSION" >> $GITHUB_ENV
- name: Upload reports using a glob pattern
uses: ./
with:
api_key: ${{secrets.DD_API_KEY_CI_VISIBILITY}}
logs: "true"
files: '**/fixtures/**'
service: junit-upload-github-action-tests
env: ci
tags: "foo:previous,alpha:previous"
datadog-ci-version: ${{ env.SECOND_LATEST_VERSION }}
- name: Check that test data can be queried
run: |
npm install @datadog/datadog-api-client
node ./check-junit-upload.js
env:
EXTRA_TAGS: "@foo:previous @alpha:previous"
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
DD_SERVICE: junit-upload-github-action-tests
test-should-complain-about-missing-api-key:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Upload reports using a glob pattern
uses: ./
id: test_step
with:
logs: "true"
files: '**/fixtures/**'
service: junit-upload-github-action-tests
env: ci
tags: "foo:bar,alpha:bravo"
continue-on-error: true
- name: Check that previous step failed
if: steps.test_step.outcome == 'success'
run: |
echo "The previous step did not fail as expected"
exit 1