Skip to content

Commit 1c3cec2

Browse files
committed
ci(test): use preflight/guard pattern to show skipped steps as grey
Replace the exit-77 + set+e wrapper with a preflight step that writes can_run and skip_reason to GITHUB_OUTPUT. The test step is guarded by if: steps.<id>.outputs.can_run == 'true', so it shows as grey Skipped (not green Success) when prerequisites are missing. The Store preflight distinguishes 'missing tool: <name>' from 'ulimit -n is <N> (store requires >= 1024)' with separate skip_reason values as requested in review. Addresses blocking review feedback from imbajin on #3055. Related to: #3043
1 parent 2920816 commit 1c3cec2

2 files changed

Lines changed: 61 additions & 25 deletions

File tree

.github/workflows/pd-store-ci.yml

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,29 @@ jobs:
107107
run: |
108108
mvn clean package -U -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -ntp --fail-at-end
109109
110+
- name: Check startup test prerequisites (PD)
111+
id: pd-preflight
112+
run: |
113+
for tool in lsof curl java; do
114+
if ! command -v "$tool" >/dev/null 2>&1; then
115+
echo "can_run=false" >> "$GITHUB_OUTPUT"
116+
echo "skip_reason=missing tool: $tool" >> "$GITHUB_OUTPUT"
117+
exit 0
118+
fi
119+
done
120+
echo "can_run=true" >> "$GITHUB_OUTPUT"
121+
110122
- name: Run start-hugegraph-pd.sh foreground mode tests
123+
if: steps.pd-preflight.outputs.can_run == 'true'
111124
run: |
112125
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
113126
PD_DIR=hugegraph-pd/apache-hugegraph-pd-$VERSION/
114-
set +e
115127
$TRAVIS_DIR/test-start-hugegraph-pd.sh $PD_DIR
116-
EXIT=$?
117-
set -e
118-
if [ $EXIT -eq 77 ]; then
119-
echo "::notice::PD startup tests skipped — required tools not available"
120-
exit 0
121-
fi
122-
exit $EXIT
128+
129+
- name: Startup tests skipped (missing prerequisites)
130+
if: steps.pd-preflight.outputs.can_run == 'false'
131+
run: |
132+
echo "::notice::PD startup tests skipped — ${{ steps.pd-preflight.outputs.skip_reason }}"
123133
124134
- name: Prepare env and service
125135
run: |
@@ -177,19 +187,35 @@ jobs:
177187
run: |
178188
mvn clean package -U -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -ntp --fail-at-end
179189
190+
- name: Check startup test prerequisites (Store)
191+
id: store-preflight
192+
run: |
193+
for tool in lsof curl java; do
194+
if ! command -v "$tool" >/dev/null 2>&1; then
195+
echo "can_run=false" >> "$GITHUB_OUTPUT"
196+
echo "skip_reason=missing tool: $tool" >> "$GITHUB_OUTPUT"
197+
exit 0
198+
fi
199+
done
200+
LIMIT_N=$(ulimit -n)
201+
if [[ "$LIMIT_N" != "unlimited" ]] && (( LIMIT_N < 1024 )); then
202+
echo "can_run=false" >> "$GITHUB_OUTPUT"
203+
echo "skip_reason=ulimit -n is $LIMIT_N (store requires >= 1024)" >> "$GITHUB_OUTPUT"
204+
exit 0
205+
fi
206+
echo "can_run=true" >> "$GITHUB_OUTPUT"
207+
180208
- name: Run start-hugegraph-store.sh foreground mode tests
209+
if: steps.store-preflight.outputs.can_run == 'true'
181210
run: |
182211
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
183212
STORE_DIR=hugegraph-store/apache-hugegraph-store-$VERSION/
184-
set +e
185213
$TRAVIS_DIR/test-start-hugegraph-store.sh $STORE_DIR
186-
EXIT=$?
187-
set -e
188-
if [ $EXIT -eq 77 ]; then
189-
echo "::notice::Store startup tests skipped — required tools not available"
190-
exit 0
191-
fi
192-
exit $EXIT
214+
215+
- name: Startup tests skipped (missing prerequisites)
216+
if: steps.store-preflight.outputs.can_run == 'false'
217+
run: |
218+
echo "::notice::Store startup tests skipped — ${{ steps.store-preflight.outputs.skip_reason }}"
193219
194220
- name: Prepare env and service
195221
run: |

.github/workflows/server-ci.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,31 @@ jobs:
7070
run: |
7171
mvn clean compile -U -Dmaven.javadoc.skip=true -ntp
7272
73-
- name: Run start-hugegraph.sh foreground mode tests
73+
- name: Check startup test prerequisites
74+
id: server-preflight
7475
if: ${{ env.BACKEND == 'rocksdb' }}
76+
run: |
77+
for tool in lsof crontab curl java; do
78+
if ! command -v "$tool" >/dev/null 2>&1; then
79+
echo "can_run=false" >> "$GITHUB_OUTPUT"
80+
echo "skip_reason=missing tool: $tool" >> "$GITHUB_OUTPUT"
81+
exit 0
82+
fi
83+
done
84+
echo "can_run=true" >> "$GITHUB_OUTPUT"
85+
86+
- name: Run start-hugegraph.sh foreground mode tests
87+
if: ${{ env.BACKEND == 'rocksdb' && steps.server-preflight.outputs.can_run == 'true' }}
7588
run: |
7689
mvn package -Dmaven.test.skip=true -pl hugegraph-server/hugegraph-dist -am -ntp
7790
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
7891
SERVER_DIR=hugegraph-server/apache-hugegraph-server-$VERSION/
79-
set +e
8092
$TRAVIS_DIR/test-start-hugegraph.sh $SERVER_DIR
81-
EXIT=$?
82-
set -e
83-
if [ $EXIT -eq 77 ]; then
84-
echo "::notice::Startup tests skipped — required tools not available"
85-
exit 0
86-
fi
87-
exit $EXIT
93+
94+
- name: Startup tests skipped (missing prerequisites)
95+
if: ${{ env.BACKEND == 'rocksdb' && steps.server-preflight.outputs.can_run == 'false' }}
96+
run: |
97+
echo "::notice::Server startup tests skipped — ${{ steps.server-preflight.outputs.skip_reason }}"
8898
8999
- name: Run unit test
90100
run: |

0 commit comments

Comments
 (0)