diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 56d671102..266e8bcc3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,63 +1,70 @@ name: Test Volatility3 on: [push, pull_request] jobs: - build: runs-on: ubuntu-22.04 strategy: matrix: python-version: ["3.8"] steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip Cmake build - pip install .[test] + - name: Install dependencies + run: | + python -m pip install --upgrade pip Cmake build + pip install .[test] - - name: Build PyPi packages - run: | - python -m build + - name: Build PyPi packages + run: | + python -m build - - name: Download images - run: | - mkdir test_images - cd test_images - curl -sLO "https://downloads.volatilityfoundation.org/volatility3/images/linux-sample-1.bin.gz" - gunzip linux-sample-1.bin.gz - curl -sLO "https://downloads.volatilityfoundation.org/volatility3/images/win-xp-laptop-2005-06-25.img.gz" - gunzip win-xp-laptop-2005-06-25.img.gz - curl -sLO "https://downloads.volatilityfoundation.org/volatility3/images/win-10_19041-2025_03.dmp.gz" - gunzip win-10_19041-2025_03.dmp.gz - cd - + - name: Download images + run: | + mkdir test_images + cd test_images + curl -sLO "https://downloads.volatilityfoundation.org/volatility3/images/linux-sample-1.bin.gz" + gunzip linux-sample-1.bin.gz + curl -sLO "https://downloads.volatilityfoundation.org/volatility3/images/win-xp-laptop-2005-06-25.img.gz" + gunzip win-xp-laptop-2005-06-25.img.gz + curl -sLO "https://downloads.volatilityfoundation.org/volatility3/images/win-10_19041-2025_03.dmp.gz" + gunzip win-10_19041-2025_03.dmp.gz + cd - - - name: Download and Extract symbols - run: | - cd ./volatility3/symbols - curl -sLO https://downloads.volatilityfoundation.org/volatility3/symbols/linux.zip - curl -sLO https://downloads.volatilityfoundation.org/volatility3/symbols/symbols_win-10_19041-2025_03.zip - unzip linux.zip - unzip symbols_win-10_19041-2025_03.zip - cd - + - name: Download and Extract symbols + run: | + cd ./volatility3/symbols + curl -sLO https://downloads.volatilityfoundation.org/volatility3/symbols/linux.zip + curl -sLO https://downloads.volatilityfoundation.org/volatility3/symbols/symbols_win-10_19041-2025_03.zip + unzip linux.zip + unzip symbols_win-10_19041-2025_03.zip + cd - - - name: Testing... - run: | - # VolShell - pytest ./test/plugins/windows/windows.py --volatility=volshell.py --image-dir=./test_images -k test_windows_volshell -v - pytest ./test/plugins/linux/linux.py --volatility=volshell.py --image-dir=./test_images -k test_linux_volshell -v + - name: Testing... + run: | + # VolShell + pytest --cov-append --cov-report=html --cov= ./test/plugins/windows/windows.py --volatility=volshell.py --image-dir=./test_images -k test_windows_volshell -v + pytest --cov-append --cov-report=html --cov= ./test/plugins/linux/linux.py --volatility=volshell.py --image-dir=./test_images -k test_linux_volshell -v - # Volatility - pytest ./test/plugins/windows/windows.py --volatility=vol.py --image=./test_images/win-10_19041-2025_03.dmp -k "test_windows and not test_windows_volshell" -v --durations=0 - pytest ./test/plugins/linux/linux.py --volatility=vol.py --image-dir=./test_images -k "test_linux and not test_linux_volshell" -v --durations=0 + # Volatility + pytest --cov-append --cov-report=html --cov= ./test/plugins/windows/windows.py --volatility=vol.py --image=./test_images/win-10_19041-2025_03.dmp -k "test_windows and not test_windows_volshell" -v --durations=0 + pytest --cov-append --cov-report=html --cov= ./test/plugins/linux/linux.py --volatility=vol.py --image-dir=./test_images -k "test_linux and not test_linux_volshell" -v --durations=0 - - name: Clean up post-test - run: | - rm -rf test_images - cd volatility3/symbols - rm -rf linux - rm -rf linux.zip - cd - + - name: Create coverage artifacts + uses: actions/upload-artifact@v4 + with: + name: code-coverage-report + path: htmlcov + overwrite: true + retention-days: 7 + + - name: Clean up post-test + run: | + rm -rf test_images + cd volatility3/symbols + rm -rf linux + rm -rf linux.zip + cd - diff --git a/.gitignore b/.gitignore index c132736a9..c550db705 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,6 @@ ENV/ # PyTest cache files .pytest_cache/ + +# Coverage cache +.coverage diff --git a/pyproject.toml b/pyproject.toml index abd2e79f7..a70f2c633 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,7 @@ dev = [ test = [ "volatility3[dev]", "pytest>=8.3.3,<9", + "pytest-cov>=6.1.1,<7", "yara-x>=0.10.0,<1", ]