Skip to content

Commit 2935822

Browse files
author
sajidurrahman
committed
chore: simplified CI with lightweight clamav image
1 parent f8473fc commit 2935822

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,18 @@ jobs:
1616

1717
services:
1818
clamav:
19-
image: clamav/clamav:latest
19+
image: clamav/clamav:stable
2020
ports:
2121
- 3310:3310
22+
env:
23+
CLAMAV_NO_FRESHCLAMD: "true"
24+
CLAMAV_NO_MILTERD: "true"
2225
options: >-
23-
--health-cmd="clamdscan --ping"
26+
--health-cmd="echo PING | nc localhost 3310 | grep -q PONG"
2427
--health-interval=30s
25-
--health-timeout=10s
26-
--health-retries=10
27-
--health-start-period=120s
28+
--health-timeout=30s
29+
--health-retries=30
30+
--health-start-period=300s
2831
2932
steps:
3033
- uses: actions/checkout@v4
@@ -43,14 +46,21 @@ jobs:
4346
- name: Wait for ClamAV to be ready
4447
run: |
4548
echo "Waiting for ClamAV service..."
46-
for i in {1..30}; do
47-
if nc -z localhost 3310; then
48-
echo "ClamAV is ready!"
49-
break
49+
timeout=600
50+
elapsed=0
51+
while [ $elapsed -lt $timeout ]; do
52+
if echo PING | nc -w 5 localhost 3310 2>/dev/null | grep -q PONG; then
53+
echo "ClamAV is ready after ${elapsed}s!"
54+
exit 0
5055
fi
51-
echo "Attempt $i: ClamAV not ready yet..."
52-
sleep 5
56+
echo "Waiting... (${elapsed}s elapsed)"
57+
sleep 15
58+
elapsed=$((elapsed + 15))
5359
done
60+
echo "ClamAV failed to start within ${timeout}s"
61+
docker ps -a
62+
docker logs $(docker ps -aq --filter "ancestor=clamav/clamav:stable") || true
63+
exit 1
5464
5565
- name: Run tests
5666
run: |

0 commit comments

Comments
 (0)