Skip to content

Skip CI tests for docs-only and config-only PRs #65

Skip CI tests for docs-only and config-only PRs

Skip CI tests for docs-only and config-only PRs #65

name: run-integration-tests
on:
pull_request:
jobs:
changes:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
code:
- 'audio_separator/**'
- 'tests/**'
- 'pyproject.toml'
- 'poetry.lock'
run-integration-test:
needs: changes
if: needs.changes.outputs.should_run == 'true'
runs-on: self-hosted
env:
AUDIO_SEPARATOR_MODEL_DIR: ${{ github.workspace }}/models
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install pipx
run: python -m pip install --user pipx && python -m pipx ensurepath
- name: Install poetry
run: python -m pipx install poetry
- name: Setup PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg libsamplerate0 libsamplerate-dev
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
cache: poetry
- name: Create models directory
run: mkdir -p $AUDIO_SEPARATOR_MODEL_DIR
- name: Cache models directory
uses: actions/cache@v3
id: model-cache
with:
path: ${{ env.AUDIO_SEPARATOR_MODEL_DIR }}
key: model-cache-${{ hashFiles('tests/integration/test_cli_integration.py') }}
restore-keys: model-cache-
- name: Install Poetry dependencies
run: poetry install -E cpu
- name: Display model cache status
run: |
echo "Model cache hit: ${{ steps.model-cache.outputs.cache-hit == 'true' }}"
echo "Models directory contents:"
ls -la $AUDIO_SEPARATOR_MODEL_DIR || echo "Directory empty or doesn't exist"
- name: Run integration tests
run: poetry run pytest -sv --cov=audio_separator --cov-report=xml tests/integration
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: integration-test-results
path: |
*.flac
tests/*.flac
**/temp_images/**/*.png
tests/**/temp_images/**/*.png
# Gate job for branch protection - always reports a status
integration-test:
needs: [changes, run-integration-test]
if: always()
runs-on: ubuntu-latest
steps:
- name: Check test results
run: |
if [[ "${{ needs.changes.outputs.should_run }}" != "true" ]]; then
echo "Tests skipped - no code changes detected"
exit 0
fi
if [[ "${{ needs.run-integration-test.result }}" == "failure" ]]; then
echo "Integration tests failed"
exit 1
fi
echo "Integration tests passed"