Skip to content

Commit f8473fc

Browse files
author
sajidurrahman
committed
chore: on-push CI
1 parent b93304b commit f8473fc

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: ["3.10", "3.11", "3.12"]
16+
17+
services:
18+
clamav:
19+
image: clamav/clamav:latest
20+
ports:
21+
- 3310:3310
22+
options: >-
23+
--health-cmd="clamdscan --ping"
24+
--health-interval=30s
25+
--health-timeout=10s
26+
--health-retries=10
27+
--health-start-period=120s
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Set up Python ${{ matrix.python-version }}
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
37+
- name: Install dependencies
38+
run: |
39+
python -m pip install --upgrade pip
40+
pip install pytest
41+
pip install -e .
42+
43+
- name: Wait for ClamAV to be ready
44+
run: |
45+
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
50+
fi
51+
echo "Attempt $i: ClamAV not ready yet..."
52+
sleep 5
53+
done
54+
55+
- name: Run tests
56+
run: |
57+
pytest src/tests/ -v
58+
59+
lint:
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v4
63+
64+
- name: Set up Python
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version: "3.12"
68+
69+
- name: Install linting tools
70+
run: |
71+
python -m pip install --upgrade pip
72+
pip install ruff
73+
74+
- name: Run linter
75+
run: |
76+
ruff check src/
77+

0 commit comments

Comments
 (0)