Skip to content

Commit a13339f

Browse files
committed
fix(ci): use nohup for background mockd to survive step boundaries
GitHub Actions kills background processes between run steps. Use nohup + redirect to keep mockd alive for subsequent test steps.
1 parent 60e1776 commit a13339f

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ jobs:
3939
env:
4040
GH_TOKEN: ${{ github.token }}
4141

42+
- name: Start mockd
43+
run: |
44+
CONFIG_DIR=$(dirname ${{ matrix.sample.config }})
45+
cd "$CONFIG_DIR"
46+
nohup mockd start -c mockd.yaml --no-auth --log-level error > /tmp/mockd.log 2>&1 &
47+
echo $! > /tmp/mockd.pid
48+
for i in $(seq 1 30); do
49+
curl -sf http://localhost:4290/health > /dev/null 2>&1 && break
50+
sleep 1
51+
done
52+
curl -sf http://localhost:4290/health
53+
mockd list --json --admin-url http://localhost:4290 | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'Loaded {len(d)} mocks')"
54+
4255
- name: Run test script
4356
run: |
4457
CONFIG_DIR=$(dirname ${{ matrix.sample.config }})
@@ -47,7 +60,7 @@ jobs:
4760
4861
- name: Stop mockd
4962
if: always()
50-
run: mockd stop 2>/dev/null || true
63+
run: pkill -f mockd || true
5164

5265
validate-digital-twins:
5366
name: Validate Digital Twins
@@ -103,8 +116,8 @@ jobs:
103116
run: |
104117
CONFIG_DIR=$(dirname ${{ matrix.sample.config }})
105118
cd "$CONFIG_DIR"
106-
mockd start -c mockd.yaml --no-auth --log-level error &
107-
cd -
119+
nohup mockd start -c mockd.yaml --no-auth --log-level error > /tmp/mockd.log 2>&1 &
120+
echo $! > /tmp/mockd.pid
108121
for i in $(seq 1 60); do
109122
curl -sf http://localhost:4290/health > /dev/null 2>&1 && break
110123
sleep 1

0 commit comments

Comments
 (0)