Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 39 additions & 3 deletions .github/workflows/run-integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,25 @@ on:
pull_request:

jobs:
integration-test:
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
Expand All @@ -26,12 +44,12 @@ jobs:

- 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:
Expand Down Expand Up @@ -76,3 +94,21 @@ jobs:
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"
42 changes: 42 additions & 0 deletions .github/workflows/run-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,25 @@ 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'

test-ubuntu:
needs: changes
if: needs.changes.outputs.should_run == 'true'
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -42,6 +60,8 @@ jobs:
run: poetry run pytest tests/unit

test-macos:
needs: changes
if: needs.changes.outputs.should_run == 'true'
runs-on: macos-latest

strategy:
Expand Down Expand Up @@ -69,6 +89,8 @@ jobs:
poetry run pytest tests/unit

test-windows:
needs: changes
if: needs.changes.outputs.should_run == 'true'
runs-on: windows-latest

strategy:
Expand All @@ -93,3 +115,23 @@ jobs:

- name: Run unit tests with coverage
run: poetry run pytest tests/unit

# Gate job for branch protection - always reports a status
unit-tests:
needs: [changes, test-ubuntu, test-macos, test-windows]
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.test-ubuntu.result }}" == "failure" ]] || \
[[ "${{ needs.test-macos.result }}" == "failure" ]] || \
[[ "${{ needs.test-windows.result }}" == "failure" ]]; then
echo "Some tests failed"
exit 1
fi
echo "All tests passed"