Skip to content

Commit be84a60

Browse files
committed
fix matrix skipped and time test
1 parent 39b7f34 commit be84a60

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

.github/workflows/tests.yml

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -73,44 +73,44 @@ jobs:
7373
- name: Publish combined test summary table
7474
if: always()
7575
run: |
76-
echo '| Test Suite | ✓ Passed | ✗ Failed | ↻ Skipped | ∑ Total | ⏱ Elapsed |' >> $GITHUB_STEP_SUMMARY
77-
echo '|:---------- | -------: | -------: | --------: | ------: | --------: |' >> $GITHUB_STEP_SUMMARY
76+
echo '| Test Suite | ✓ Passed | ✗ Failed | ↻ Skipped | ∑ Total | ⏱ Elapsed |' >> "$GITHUB_STEP_SUMMARY"
77+
echo '|:---------- | -------: | -------: | --------: | ------: | --------: |' >> "$GITHUB_STEP_SUMMARY"
7878
7979
summarize () {
8080
local name="$1"; local expected="$2"
8181
local path="$expected"
8282
83-
if [ ! -f "$path" ]; then
84-
local base_dir; base_dir="$(dirname "$expected")"
85-
path=$(find "$base_dir" -maxdepth 3 -type f -name '*.trx' -print -quit 2>/dev/null || true)
86-
fi
83+
[ ! -f "$path" ] && \
84+
path=$(find "$(dirname "$expected")" -maxdepth 3 -name '*.trx' -print -quit)
8785
8886
if [ -f "$path" ]; then
89-
local passed failed skipped total duration
90-
passed=$(grep -oP 'passed="\K\d+' "$path" | head -1 || echo 0)
91-
failed=$(grep -oP 'failed="\K\d+' "$path" | head -1 || echo 0)
92-
skipped=$(grep -oP 'skipped="\K\d+' "$path" | head -1 || echo 0)
93-
total=$(grep -oP 'total="\K\d+' "$path" | head -1 || echo 0)
87+
local passed failed total executed skipped duration
88+
passed=$(grep -oP 'passed="\K\d+' "$path" | head -1 || echo 0)
89+
failed=$(grep -oP 'failed="\K\d+' "$path" | head -1 || echo 0)
90+
total=$(grep -oP 'total="\K\d+' "$path" | head -1 || echo 0)
91+
executed=$(grep -oP 'executed="\K\d+' "$path" | head -1 || echo 0)
92+
[ -z "$executed" ] && executed=$((passed+failed))
93+
skipped=$((total-executed))
94+
95+
duration=$(grep -oP 'duration="\K[0-9\.]+' "$path" | head -1)
9496
95-
duration=$(grep -oP 'duration="\K[0-9\.]+' "$path" | head -1 || true)
9697
if [ -z "$duration" ]; then
9798
local start finish
98-
start=$(grep -oP '<Times[^>]*start="\K[^"]+' "$path" | head -1 || true)
99-
finish=$(grep -oP '<Times[^>]*finish="\K[^"]+' "$path" | head -1 || true)
99+
start=$(grep -oP '<Times[^>]*start="\K[^"]+' "$path" | head -1)
100+
finish=$(grep -oP '<Times[^>]*finish="\K[^"]+' "$path" | head -1)
100101
if [ -n "$start" ] && [ -n "$finish" ]; then
102+
start=${start%%.*}; finish=${finish%%.*}
101103
local ds df
102104
ds=$(date -u -d "$start" +%s 2>/dev/null || true)
103105
df=$(date -u -d "$finish" +%s 2>/dev/null || true)
104-
if [ -n "$ds" ] && [ -n "$df" ]; then
105-
duration=$((df-ds))
106-
fi
106+
[ -n "$ds" ] && [ -n "$df" ] && duration=$((df-ds))
107107
fi
108108
fi
109109
[ -z "$duration" ] && duration='-'
110110
111-
echo "| $name | $passed | $failed | $skipped | $total | ${duration}s |" >> $GITHUB_STEP_SUMMARY
111+
echo "| $name | $passed | $failed | $skipped | $total | ${duration}s |" >> "$GITHUB_STEP_SUMMARY"
112112
else
113-
echo "| $name | N/A | N/A | N/A | N/A | N/A |" >> $GITHUB_STEP_SUMMARY
113+
echo "| $name | N/A | N/A | N/A | N/A | N/A |" >> "$GITHUB_STEP_SUMMARY"
114114
fi
115115
}
116116
@@ -129,17 +129,15 @@ jobs:
129129
services:
130130
ydb:
131131
image: ydbplatform/local-ydb:${{ matrix.ydb-version }}
132-
ports:
133-
- 2135:2135
134-
- 2136:2136
135-
- 8765:8765
132+
ports: [ "2135:2135", "2136:2136", "8765:8765" ]
136133
env:
137134
YDB_LOCAL_SURVIVE_RESTART: true
138135
YDB_USE_IN_MEMORY_PDISKS: true
139136
options: '--name ydb-local -h localhost'
140137
steps:
141138
- name: Checkout code
142139
uses: actions/checkout@v4
140+
143141
- name: Install Dotnet
144142
uses: actions/setup-dotnet@v4
145143
with:

0 commit comments

Comments
 (0)