Skip to content

Commit

Permalink
Update uploader with new folder structure (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
oxve authored Jul 15, 2023
1 parent 8eba504 commit fc78aef
Show file tree
Hide file tree
Showing 58 changed files with 38,239 additions and 93 deletions.
4 changes: 2 additions & 2 deletions .github/actions/on_host_test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ runs:
echo "PYTHONPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "TEST_RESULTS_DIR=${GITHUB_WORKSPACE}/unit-test-results" >> $GITHUB_ENV
echo "COVERAGE_DIR=${GITHUB_WORKSPACE}/coverage" >> $GITHUB_ENV
- name: Archive unit test report
- name: Archive unit test results
uses: actions/upload-artifact@v3
# TODO: Should only run for unit-tests
if: always()
with:
name: unit-test-reports
name: unit-test-results
path: ${{env.TEST_RESULTS_DIR}}/
- name: Archive coverage html report
if: success() && matrix.shard == 'coverage'
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/unit_test_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Upload Unit Test Results

on:
workflow_run:
workflows:
- linux
# TODO: Download xml files from GCS
# - android
# - raspi
# TODO: Generate xml files
# - win32
# TODO: Get xml files from platforms
# - atv
# - ps
# - switch
# - xbox
types:
- completed

jobs:
# Gets unit test report from artifact storage and uploads them to DataDog.
unit-test-report:
permissions: {}
if: always()
runs-on: ubuntu-latest
name: Upload Unit Test Reports
env:
DATADOG_API_KEY: ${{ secrets.DD_API_KEY }}
DATADOG_SITE: us5.datadoghq.com
steps:
# TODO: Check if artifact exists, or
# TODO: Always upload a report, empty -> no upload
- name: Collect Unit Test Reports
uses: actions/[email protected]
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var results = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "unit-test-results"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: results.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/unit-test-results.zip', Buffer.from(download.data));
- run: unzip unit-test-results.zip -d unit-test-results
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Get Datadog CLI
shell: bash
# TODO: pin version (with checksum?)
run: npm install -g @datadog/datadog-ci
- name: Upload the JUnit files
shell: bash
run: |
# Loop over platform folders in archive
for dir in unit-test-results/*/; do
echo "Uploading $dir test report"
service="${{ github.event.repository.name }}"
tags=`cat ${dir}TAGS`
datadog-ci junit upload \
--service $service \
--env ci \
--tags $tags \
$dir
done
45 changes: 0 additions & 45 deletions .github/workflows/unit_test_results_reporter.yaml

This file was deleted.

Loading

0 comments on commit fc78aef

Please sign in to comment.