add ensembler #76
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: run-unit-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' | |
| test-ubuntu: | |
| needs: changes | |
| if: needs.changes.outputs.should_run == 'true' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - name: Free disk space | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| tool-cache: false | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: false | |
| docker-images: true | |
| swap-storage: true | |
| - name: Checkout project | |
| uses: actions/checkout@v4 | |
| - name: Install poetry | |
| run: pipx install poetry | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: poetry # caching dependencies from poetry.lock | |
| - name: Install Poetry dependencies (CPU) | |
| run: poetry install -E cpu | |
| - name: Run unit tests with coverage | |
| run: poetry run pytest tests/unit | |
| test-macos: | |
| needs: changes | |
| if: needs.changes.outputs.should_run == 'true' | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - name: Checkout project | |
| uses: actions/checkout@v4 | |
| - name: Install poetry | |
| run: pipx install poetry | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: poetry # caching dependencies from poetry.lock | |
| - name: Install Poetry dependencies (CPU) | |
| run: poetry install -E cpu | |
| - name: Run unit tests with coverage | |
| run: | | |
| poetry run pytest tests/unit | |
| test-windows: | |
| needs: changes | |
| if: needs.changes.outputs.should_run == 'true' | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - name: Checkout project | |
| uses: actions/checkout@v4 | |
| - name: Install poetry | |
| run: pipx install poetry | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: poetry # caching dependencies from poetry.lock | |
| - name: Install Poetry dependencies (CPU) | |
| run: poetry install -E cpu | |
| - 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" |