Skip to content

Commit

Permalink
ci(gha): upload test report
Browse files Browse the repository at this point in the history
Add test script which generates a report tar with useful
information such as journalctl logs and nvme devices.
Upload this tar on github actions.

Signed-off-by: Tiago Castro <[email protected]>
  • Loading branch information
tiagolobocastro committed Jan 31, 2025
1 parent 59b1d88 commit ce32acd
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 7 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/bdd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,27 @@ jobs:
run: |
echo "TEST_START_DATE=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
nix-shell --run "./scripts/pytest-tests.sh"
- name: Test Report
- name: Pytest BDD Report
if: always()
uses: pmeier/pytest-results-action@main
with:
path: test/python/reports/**/xunit-report.xml
path: ci-report/python/**/xunit-report.xml
summary: true
display-options: a
fail-on-empty: true
title: Test results
- run: |
if [ -d test/python/reports ]; then
mkdir -p ci-report
mv test/python/reports ci-report/python
fi
nix-shell --run "./scripts/ci-report.sh"
if: failure()
- uses: actions/upload-artifact@v4
if: failure()
with:
name: ci-report-bdd
path: ./ci-report/ci-report.tar.gz
- name: Cleanup
if: always()
run: nix-shell --run "./scripts/pytest-tests.sh --clean-all-exit"
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/unit-int.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,28 @@ jobs:
run: |
echo "TEST_START_DATE=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
nix-shell --run "./scripts/grpc-test.sh"
mkdir js-reports
mkdir -p ci-report/js
for file in *-xunit-report.xml; do
echo "<testsuites>" > "js-reports/$file"
cat $file >> "js-reports/$file"
echo "</testsuites>" >> "js-reports/$file"
echo "<testsuites>" > "ci-report/js/$file"
cat $file >> "ci-report/js/$file"
echo "</testsuites>" >> "ci-report/js/$file"
done
- name: Test Report
if: always()
uses: pmeier/pytest-results-action@main
with:
path: 'js-reports/*-xunit-report.xml'
path: 'ci-report/js/*-xunit-report.xml'
summary: true
display-options: a
fail-on-empty: true
title: Test results
- run: nix-shell --run "./scripts/ci-report.sh"
if: failure()
- uses: actions/upload-artifact@v4
if: failure()
with:
name: ci-report-int
path: ./ci-report/ci-report.tar.gz
- name: Cleanup
if: always()
run: nix-shell --run "./scripts/clean-cargo-tests.sh"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ ansible-hosts
/package.json
/rust-toolchain.toml
/test/python/reports
/ci-report/
20 changes: 20 additions & 0 deletions scripts/ci-report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

SCRIPT_DIR="$(dirname "$0")"
export ROOT_DIR="$SCRIPT_DIR/.."
SUDO=$(which sudo)
CI_REPORT_START_DATE=${CI_REPORT_START_DATE:--3h}

set -eu

mkdir -p "$ROOT_DIR/ci-report"
cd "$ROOT_DIR/ci-report"

journalctl --since="$CI_REPORT_START_DATE" -o short-precise > journalctl.txt
journalctl -k -b0 -o short-precise > dmesg.txt
lsblk -tfa > lsblk.txt
$SUDO nvme list -v > nvme.txt
$SUDO nvme list-subsys -v >> nvme.txt
cat /proc/meminfo > meminfo.txt

find . -type f \( -name "*.txt" -o -name "*.xml" \) -print0 | xargs -0 tar -czvf ci-report.tar.gz

0 comments on commit ce32acd

Please sign in to comment.