Skip to content

Commit 7c9a1bf

Browse files
fix: improve workflow logging and test diagnostics
Signed-off-by: sudhanshu shukla <[email protected]>
1 parent 073b3d9 commit 7c9a1bf

File tree

1 file changed

+44
-6
lines changed

1 file changed

+44
-6
lines changed

.github/workflows/test.yml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,22 @@ jobs:
4444
CXX: ${{ matrix.cxx }}
4545
run: |
4646
docker build -t bm --build-arg IMAGE_TYPE=test --build-arg CC=$CC --build-arg CXX=$CXX --build-arg GCOV=$GCOV .
47-
- name: Run tests
47+
- name: Run tests with verbose output
4848
run: |
4949
ci_env=`bash <(curl -s https://codecov.io/env)`
50-
docker run --rm $ci_env --env GCOV -w /behavioral-model bm /bin/bash -c "make check -j$(nproc) && ./ci/codecov.sh"
50+
docker run --rm $ci_env --env GCOV -w /behavioral-model bm /bin/bash -c "make check -j$(nproc) VERBOSE=1 && ./ci/codecov.sh"
51+
- name: Upload test logs on failure
52+
if: failure()
53+
run: |
54+
mkdir -p logs
55+
docker run --rm -v $(pwd)/logs:/logs bm /bin/bash -c "cp -r tests/test-suite.log /logs/ && cp -r tests/p4objects.log /logs/ && cp -r tests/table_apply.log /logs/"
56+
zip -r logs.zip logs/
57+
- name: Upload test logs artifact
58+
if: failure()
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: test-logs
62+
path: logs.zip
5163
- name: Check style
5264
run: |
5365
./tools/check_style.sh
@@ -62,8 +74,20 @@ jobs:
6274
submodules: 'recursive'
6375
- name: Build Dockerfile.noPI image
6476
run: docker build -t bm-no-pi --build-arg IMAGE_TYPE=test -f Dockerfile.noPI .
65-
- name: Run tests
66-
run: docker run --rm -w /behavioral-model bm-no-pi /bin/bash -c "make check -j$(nproc)"
77+
- name: Run tests with verbose output
78+
run: docker run --rm -w /behavioral-model bm-no-pi /bin/bash -c "make check -j$(nproc) VERBOSE=1"
79+
- name: Upload test logs on failure
80+
if: failure()
81+
run: |
82+
mkdir -p logs
83+
docker run --rm -v $(pwd)/logs:/logs bm-no-pi /bin/bash -c "cp -r tests/test-suite.log /logs/ && cp -r tests/p4objects.log /logs/ && cp -r tests/table_apply.log /logs/"
84+
zip -r logs.zip logs/
85+
- name: Upload test logs artifact
86+
if: failure()
87+
uses: actions/upload-artifact@v3
88+
with:
89+
name: test-logs-no-pi
90+
path: logs.zip
6791

6892
test-ubuntu22:
6993
needs: check-changes
@@ -80,5 +104,19 @@ jobs:
80104
./autogen.sh
81105
./configure --with-pdfixed --with-pi --with-stress-tests --enable-debugger --enable-Werror
82106
make -j$(nproc)
83-
- name: Run tests
84-
run: make check -j$(nproc)
107+
- name: Run tests with verbose output
108+
run: make check -j$(nproc) VERBOSE=1
109+
- name: Upload test logs on failure
110+
if: failure()
111+
run: |
112+
mkdir -p logs
113+
cp tests/test-suite.log logs/
114+
cp tests/p4objects.log logs/
115+
cp tests/table_apply.log logs/
116+
zip -r logs.zip logs/
117+
- name: Upload test logs artifact
118+
if: failure()
119+
uses: actions/upload-artifact@v3
120+
with:
121+
name: test-logs-ubuntu22
122+
path: logs.zip

0 commit comments

Comments
 (0)