ci: add path filters to skip tests on docs-only changes

Add path-based triggers to workflow to run tests only when relevant files
change. This saves CI resources on documentation-only or README changes
while maintaining broad coverage for code and configuration changes.

Tests now run when these files change:
- install.sh (installer script)
- src/** (all source code)
- tests/** (test files)
- .github/workflows/** (CI configuration)
- *.txt, *.toml, *.cfg (dependency/config files)
- *.py (Python files in root)

Tests skip when only these change:
- README.md, docs, examples
- Other markdown or documentation files

This is especially beneficial for ARM tests which take 5-10 minutes due
to QEMU emulation overhead.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
torlando-tech 2025-10-29 12:00:41 -04:00
commit 9c0b656c40

View file

@ -3,13 +3,57 @@ name: Tests
on:
push:
branches: [ "*" ]
paths:
- 'install.sh'
- 'src/**'
- 'tests/**'
- '.github/workflows/**'
- '*.txt' # requirements files
- '*.toml' # pyproject.toml
- '*.cfg' # setup.cfg
- '*.py' # any Python file in root
pull_request:
branches: [ "*" ]
paths:
- 'install.sh'
- 'src/**'
- 'tests/**'
- '.github/workflows/**'
- '*.txt' # requirements files
- '*.toml' # pyproject.toml
- '*.cfg' # setup.cfg
- '*.py' # any Python file in root
jobs:
# Detect which files changed to run only relevant tests
detect-changes:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
python: ${{ steps.filter.outputs.python }}
installer: ${{ steps.filter.outputs.installer }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
python:
- 'src/**/*.py'
- 'tests/test_*.py'
- '*.txt'
- '*.toml'
- '*.cfg'
installer:
- 'install.sh'
- 'tests/test_installer.sh'
- '.github/workflows/test.yml'
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.python == 'true'
strategy:
matrix: