Skip to content

Commit 45f39b2

Browse files
committed
Update ci.yml
1 parent 5b9dbbd commit 45f39b2

File tree

5 files changed

+84
-3
lines changed

5 files changed

+84
-3
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,16 @@ jobs:
1515
test:
1616
runs-on: ${{ matrix.os }}
1717
strategy:
18+
fail-fast: false
1819
matrix:
1920
os: [ubuntu-latest, windows-latest, macos-latest]
2021
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
22+
exclude:
23+
# Reduce Windows matrix to prevent timeouts
24+
- os: windows-latest
25+
python-version: '3.8'
26+
- os: windows-latest
27+
python-version: '3.9'
2128

2229
steps:
2330
- uses: actions/checkout@v4
@@ -74,9 +81,15 @@ jobs:
7481
print(f'\\nAll Python files passed syntax check')
7582
"
7683
77-
- name: Run unit tests with pytest
84+
- name: Run unit tests with pytest (Windows)
85+
if: runner.os == 'Windows'
7886
run: |
79-
pytest tests/ -v --tb=short --cov=src/analyzeMFT --cov-report=xml --cov-report=term-missing --timeout=60 -m "not slow"
87+
pytest tests/test_constants.py tests/test_config.py tests/test_validators.py tests/test_cli.py tests/test_file_writers.py -v --tb=short --timeout=30 --maxfail=3
88+
89+
- name: Run unit tests with pytest (Linux/macOS)
90+
if: runner.os != 'Windows'
91+
run: |
92+
pytest tests/ -v --tb=short --cov=src/analyzeMFT --cov-report=xml --cov-report=term-missing --timeout=30 -m "not slow and not integration" --maxfail=5
8093
8194
- name: Upload coverage reports to Codecov
8295
uses: codecov/codecov-action@v3

.github/workflows/slow-tests.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Slow Tests
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# Run slow tests daily at 2 AM UTC
7+
- cron: '0 2 * * *'
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
slow-tests:
14+
name: Slow Tests - ${{ matrix.os }} Python ${{ matrix.python-version }}
15+
runs-on: ${{ matrix.os }}
16+
timeout-minutes: 30
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest, windows-latest, macos-latest]
21+
python-version: ['3.11']
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install -r requirements.txt
35+
pip install pytest pytest-timeout
36+
pip install -e .
37+
38+
- name: Run slow integration tests
39+
run: |
40+
pytest tests/ -v --tb=short \
41+
--timeout=300 \
42+
-m "slow" \
43+
--maxfail=3
44+
45+
- name: Test large record processing
46+
run: |
47+
# Test with a larger synthetic MFT
48+
python -c "
49+
from src.analyzeMFT.test_generator import create_test_mft
50+
create_test_mft('large_test.mft', 5000)
51+
"
52+
python analyzeMFT.py -f large_test.mft -o large_output.csv --csv
53+
54+
# Verify output
55+
python -c "
56+
import csv
57+
with open('large_output.csv') as f:
58+
reader = csv.reader(f)
59+
rows = list(reader)
60+
print(f'Processed {len(rows)-1} records') # -1 for header
61+
assert len(rows) > 5000, f'Expected >5000 rows, got {len(rows)}'
62+
"
63+
64+
echo "Large test completed successfully"

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ jobs:
5252
--cov-report=term-missing \
5353
--timeout=30 \
5454
-m "not slow and not integration" \
55-
--maxfail=10
55+
--maxfail=10 \
56+
-x
5657
5758
- name: Upload coverage to Codecov
5859
if: matrix.python-version == '3.11'

tests/test_integration.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ def test_synthetic_mft_analysis(analyzed_output):
9696
# assert any(record['Filename'] == 'Windows' and record['File Type'] == 'Directory' for record in records), "Windows directory not found"
9797
print("Synthetic MFT analysis test passed successfully!")
9898

99+
@pytest.mark.slow
100+
@pytest.mark.integration
99101
def test_synthetic_mft_statistics(synthetic_mft):
100102
analyzer = MftAnalyzer(synthetic_mft, "temp_output.csv", debug=False, compute_hashes=True, export_format="csv")
101103
asyncio.run(analyzer.analyze())

tests/test_mft_analyzer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ async def test_write_csv_block(analyzer, mock_mft_record):
195195
assert len(analyzer.mft_records) == 0
196196

197197
@pytest.mark.asyncio
198+
@pytest.mark.slow
198199
async def test_analyze_large_number_of_records(analyzer, mock_mft_file, mock_mft_record):
199200
large_mft_file = mock_mft_file * 10000
200201
with patch("builtins.open", mock_open(read_data=large_mft_file)), \

0 commit comments

Comments
 (0)