Skip to content

Commit fcd3c3f

Browse files
committed
ci: check server reachability before running integration tests
1 parent 6fad77b commit fcd3c3f

2 files changed

Lines changed: 31 additions & 8 deletions

File tree

.github/workflows/python-rc.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,33 @@ jobs:
3131
env:
3232
MUXI_SDK_E2E_SERVER_URL: ${{ secrets.MUXI_SDK_E2E_SERVER_URL }}
3333
steps:
34-
- name: Skip if no test server configured
35-
if: ${{ env.MUXI_SDK_E2E_SERVER_URL == '' }}
36-
run: echo "::notice::Integration tests skipped — MUXI_SDK_E2E_SERVER_URL not set"
34+
- name: Check test server reachability
35+
id: check
36+
run: |
37+
if [ -z "$MUXI_SDK_E2E_SERVER_URL" ]; then
38+
echo "skip=true" >> $GITHUB_OUTPUT
39+
echo "::notice::Integration tests skipped — no server URL configured"
40+
elif ! curl -sf --max-time 5 "${MUXI_SDK_E2E_SERVER_URL}/ping" >/dev/null 2>&1 && \
41+
! curl -sf --max-time 5 "${MUXI_SDK_E2E_SERVER_URL}" >/dev/null 2>&1; then
42+
echo "skip=true" >> $GITHUB_OUTPUT
43+
echo "::notice::Integration tests skipped — test server not reachable"
44+
else
45+
echo "skip=false" >> $GITHUB_OUTPUT
46+
fi
3747
3848
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
39-
if: ${{ env.MUXI_SDK_E2E_SERVER_URL != '' }}
49+
if: steps.check.outputs.skip != 'true'
4050
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5
41-
if: ${{ env.MUXI_SDK_E2E_SERVER_URL != '' }}
51+
if: steps.check.outputs.skip != 'true'
4252
with:
4353
python-version: '3.10'
4454
- name: Install
45-
if: ${{ env.MUXI_SDK_E2E_SERVER_URL != '' }}
55+
if: steps.check.outputs.skip != 'true'
4656
run: |
4757
python -m pip install --upgrade pip
4858
python -m pip install .
4959
- name: Integration tests
50-
if: ${{ env.MUXI_SDK_E2E_SERVER_URL != '' }}
60+
if: steps.check.outputs.skip != 'true'
5161
env:
5262
MUXI_SDK_E2E_KEY_ID: ${{ secrets.MUXI_SDK_E2E_KEY_ID }}
5363
MUXI_SDK_E2E_SECRET_KEY: ${{ secrets.MUXI_SDK_E2E_SECRET_KEY }}

.github/workflows/python-release.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,21 @@ jobs:
3636
- name: Unit tests
3737
run: python -m unittest discover tests -v
3838

39+
- name: Check test server reachability
40+
id: check
41+
run: |
42+
if [ -z "$MUXI_SDK_E2E_SERVER_URL" ]; then
43+
echo "skip=true" >> $GITHUB_OUTPUT
44+
elif ! curl -sf --max-time 5 "${MUXI_SDK_E2E_SERVER_URL}/ping" >/dev/null 2>&1 && \
45+
! curl -sf --max-time 5 "${MUXI_SDK_E2E_SERVER_URL}" >/dev/null 2>&1; then
46+
echo "skip=true" >> $GITHUB_OUTPUT
47+
echo "::notice::Integration tests skipped — test server not reachable"
48+
else
49+
echo "skip=false" >> $GITHUB_OUTPUT
50+
fi
51+
3952
- name: Integration tests
40-
if: ${{ env.MUXI_SDK_E2E_SERVER_URL != '' }}
53+
if: steps.check.outputs.skip != 'true'
4154
env:
4255
MUXI_SDK_E2E_KEY_ID: ${{ secrets.MUXI_SDK_E2E_KEY_ID }}
4356
MUXI_SDK_E2E_SECRET_KEY: ${{ secrets.MUXI_SDK_E2E_SECRET_KEY }}

0 commit comments

Comments
 (0)