Skip to content

Commit be09982

Browse files
ci(gha): upload test report
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 <tiagolobocastro@gmail.com>
1 parent 59b1d88 commit be09982

File tree

4 files changed

+46
-6
lines changed

4 files changed

+46
-6
lines changed

.github/workflows/bdd.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: |
4242
echo "TEST_START_DATE=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
4343
nix-shell --run "./scripts/pytest-tests.sh"
44-
- name: Test Report
44+
- name: Pytest BDD Report
4545
if: always()
4646
uses: pmeier/pytest-results-action@main
4747
with:
@@ -50,6 +50,18 @@ jobs:
5050
display-options: a
5151
fail-on-empty: true
5252
title: Test results
53+
- run: |
54+
if [ -d test/python/reports ]; then
55+
mkdir -p ci-report
56+
mv test/python/reports ci-report/python
57+
fi
58+
nix-shell --run "./scripts/ci-report.sh"
59+
if: failure()
60+
- uses: actions/upload-artifact@v4
61+
if: failure()
62+
with:
63+
name: ci-report-bdd
64+
path: ./ci-report/ci-report.tar.gz
5365
- name: Cleanup
5466
if: always()
5567
run: nix-shell --run "./scripts/pytest-tests.sh --clean-all-exit"

.github/workflows/unit-int.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,28 @@ jobs:
4949
run: |
5050
echo "TEST_START_DATE=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
5151
nix-shell --run "./scripts/grpc-test.sh"
52-
mkdir js-reports
52+
mkdir -p ci-report/js
5353
for file in *-xunit-report.xml; do
54-
echo "<testsuites>" > "js-reports/$file"
55-
cat $file >> "js-reports/$file"
56-
echo "</testsuites>" >> "js-reports/$file"
54+
echo "<testsuites>" > "ci-report/js/$file"
55+
cat $file >> "ci-report/js/$file"
56+
echo "</testsuites>" >> "ci-report/js/$file"
5757
done
5858
- name: Test Report
5959
if: always()
6060
uses: pmeier/pytest-results-action@main
6161
with:
62-
path: 'js-reports/*-xunit-report.xml'
62+
path: 'ci-report/js/*-xunit-report.xml'
6363
summary: true
6464
display-options: a
6565
fail-on-empty: true
6666
title: Test results
67+
- run: nix-shell --run "./scripts/ci-report.sh"
68+
if: failure()
69+
- uses: actions/upload-artifact@v4
70+
if: failure()
71+
with:
72+
name: ci-report-int
73+
path: ./ci-report/ci-report.tar.gz
6774
- name: Cleanup
6875
if: always()
6976
run: nix-shell --run "./scripts/clean-cargo-tests.sh"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ ansible-hosts
4343
/package.json
4444
/rust-toolchain.toml
4545
/test/python/reports
46+
/ci-report/

scripts/ci-report.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
SCRIPT_DIR="$(dirname "$0")"
4+
export ROOT_DIR="$SCRIPT_DIR/.."
5+
SUDO=$(which sudo)
6+
CI_REPORT_START_DATE=${CI_REPORT_START_DATE:--3h}
7+
8+
set -eu
9+
10+
mkdir -p "$ROOT_DIR/ci-report"
11+
cd "$ROOT_DIR/ci-report"
12+
13+
journalctl --since="$CI_REPORT_START_DATE" -o short-precise > journalctl.txt
14+
journalctl -k -b0 -o short-precise > dmesg.txt
15+
lsblk -tfa > lsblk.txt
16+
$SUDO nvme list -v > nvme.txt
17+
$SUDO nvme list-subsys -v >> nvme.txt
18+
cat /proc/meminfo > meminfo.txt
19+
20+
find . -type f \( -name "*.txt" -o -name "*.xml" \) -print0 | xargs -0 tar -czvf ci-report.tar.gz

0 commit comments

Comments
 (0)