286 Task Add 20 Audio Quality Metrics #942
Workflow file for this run
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: tests | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled] | |
| jobs: | |
| macos-tests: | |
| if: github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'to-test') | |
| name: macOS-tests | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| include: | |
| - {os: macos-latest, architecture: arm64, python-version: '3.10'} | |
| # - {os: macos-latest, architecture: arm64, python-version: '3.11'} | |
| # - {os: macos-latest, architecture: arm64, python-version: '3.12'} | |
| # the reason why we commented out 3.11 and 3.12 is that it hits github rate limit for some modules (e.g., knn-vc, Camb-ai/mars5-tts) | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 # no need for the history | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install ffmpeg | |
| run: | | |
| brew install ffmpeg | |
| shell: bash | |
| - name: Verify ffmpeg | |
| run: | | |
| ffmpeg -version | |
| shell: bash | |
| - name: Install Poetry | |
| run: pip install poetry==2.1.3 | |
| shell: bash | |
| - name: Install dependencies with Poetry | |
| run: | | |
| poetry env use ${{ matrix.python-version }} | |
| poetry install --extras "audio text video" --with dev | |
| poetry env info | |
| shell: bash | |
| - name: check files | |
| run: | | |
| ls /Users/runner/work/senselab/senselab/src/tests/data_for_testing/ | |
| shell: bash | |
| - name: check pwd | |
| run: pwd | |
| shell: bash | |
| - name: Verify FFmpeg Installation | |
| run: | | |
| echo "PATH: $PATH" | |
| which ffmpeg | |
| ffmpeg -version | |
| shell: bash | |
| - name: Run unit tests | |
| id: run-tests | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| poetry run pytest -n auto \ | |
| --junitxml=pytest.xml \ | |
| --cov-report=term-missing:skip-covered \ | |
| --cov-report=xml:coverage.xml \ | |
| --cov=src src/tests \ | |
| --log-level=DEBUG \ | |
| --verbose | |
| shell: bash | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| pre-commit: | |
| if: github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'to-test') | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| python-version: ['3.10'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: # no need for the history | |
| fetch-depth: 1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Poetry | |
| run: pip install poetry==2.1.3 | |
| shell: bash | |
| - name: Install dependencies with Poetry | |
| run: | | |
| poetry env use ${{ matrix.python-version }} | |
| poetry install --extras "audio text video" --with dev | |
| poetry env info | |
| shell: bash | |
| - name: Install pre-commit | |
| run: pip install pre-commit | |
| shell: bash | |
| - name: Run pre-commit | |
| run: | | |
| poetry run pre-commit run --all-files | |
| shell: bash | |
| start-runner-310-core: | |
| if: github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'to-test-gpu') && success() | |
| needs: | |
| - pre-commit | |
| - macos-tests | |
| name: start-runner-310-core | |
| runs-on: ubuntu-latest | |
| outputs: | |
| label: ${{ steps.start-ec2-runner.outputs.label }} | |
| ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} | |
| job-ran: ${{ steps.set-ran.outputs.ran }} | |
| steps: | |
| - id: set-ran | |
| run: echo "::set-output name=ran::true" | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_KEY_SECRET }} | |
| aws-region: ${{ vars.AWS_REGION }} | |
| - name: Start EC2 runner | |
| id: start-ec2-runner | |
| uses: machulav/ec2-github-runner@v2 | |
| with: | |
| mode: start | |
| github-token: ${{ secrets.GH_TOKEN }} | |
| ec2-image-id: ${{ vars.AWS_IMAGE_ID }} | |
| ec2-instance-type: ${{ vars.AWS_INSTANCE_TYPE }} | |
| subnet-id: ${{ vars.AWS_SUBNET }} | |
| security-group-id: ${{ vars.AWS_SECURITY_GROUP }} | |
| ubuntu-tests-310-core: | |
| name: ubuntu-tests-310-core | |
| needs: start-runner-310-core | |
| runs-on: ${{ needs.start-runner-310-core.outputs.label }} | |
| defaults: | |
| run: | |
| shell: bash | |
| working-directory: ${{ vars.WORKING_DIR }} | |
| strategy: | |
| matrix: | |
| python-version: ['3.10'] | |
| env: | |
| WORKING_DIR: ${{ vars.WORKING_DIR }} | |
| TORCH_HOME: ${{ vars.WORKING_DIR }}/torch | |
| PIP_CACHE_DIR: ${{ vars.WORKING_DIR }}/pip | |
| POETRY_CACHE_DIR: ${{ vars.WORKING_DIR }}/poetry | |
| HF_HOME: ${{ vars.WORKING_DIR }}/huggingface | |
| TRANSFORMERS_CACHE: ${{ vars.WORKING_DIR }}/huggingface/transformers | |
| HF_DATASETS_CACHE: ${{ vars.WORKING_DIR }}/huggingface/datasets | |
| outputs: | |
| job-ran: ${{ steps.set-ran.outputs.ran }} | |
| steps: | |
| - id: set-ran | |
| run: echo "::set-output name=ran::true" | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 # no need for the history | |
| - name: Cleanup disk space | |
| run: | | |
| echo "Cleaning up disk space..." | |
| rm -rf ~/.cache | |
| rm -rf ~/.npm | |
| rm -rf ~/.poetry | |
| df -h | |
| shell: bash | |
| - name: Create cache directories | |
| run: | | |
| mkdir -p "$POETRY_CACHE_DIR" "$PIP_CACHE_DIR" "$TORCH_HOME" "$HF_HOME" "$TRANSFORMERS_CACHE" "$HF_DATASETS_CACHE" | |
| ls -lah ${{ vars.WORKING_DIR }} | |
| shell: bash | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install ffmpeg | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y ffmpeg | |
| ffmpeg -version | |
| shell: bash | |
| - name: Install Poetry | |
| run: | | |
| which python | |
| python --version | |
| pip install poetry==2.1.3 | |
| which poetry | |
| poetry --version | |
| shell: bash | |
| - name: Check available space | |
| run: | | |
| df -h | |
| shell: bash | |
| - name: Echo python info | |
| run: | | |
| python --version | |
| which python | |
| which poetry | |
| shell: bash | |
| - name: Copy senselab directory to current directory | |
| run: | | |
| cp -r /actions-runner/_work/senselab/senselab . | |
| - name: Install dependencies with Poetry (Core only) | |
| run: | | |
| cd senselab | |
| poetry env use ${{ matrix.python-version }} | |
| poetry install --with dev | |
| shell: bash | |
| - name: Check NVIDIA SMI details | |
| run: | | |
| cd senselab | |
| poetry run nvidia-smi | |
| poetry run nvidia-smi -L | |
| poetry run nvidia-smi -q -d Memory | |
| shell: bash | |
| - name: Prepare cache folder for pytest | |
| run: mkdir -p $WORKING_DIR/pytest/temp | |
| shell: bash | |
| - name: Run unit tests | |
| id: run-tests | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: > | |
| cd senselab && poetry run pytest \ | |
| --rootdir=$WORKING_DIR/pytest \ | |
| --basetemp=$WORKING_DIR/pytest/temp \ | |
| --junitxml=pytest.xml \ | |
| --cov-report=term-missing:skip-covered \ | |
| --cov-report=xml:coverage.xml \ | |
| --cov=src src/tests \ | |
| --log-level=DEBUG \ | |
| --verbose | |
| shell: bash | |
| stop-runner-310-core: | |
| name: stop-runner-310-core | |
| needs: | |
| - start-runner-310-core # waits for the EC2 instance to be created | |
| - ubuntu-tests-310-core # waits for the actual job to finish | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.start-runner-310-core.outputs.job-ran == 'true' && needs.ubuntu-tests-310-core.outputs.job-ran == 'true' || failure() }} # required to stop the runner even if an error occurred in previous jobs | |
| steps: | |
| - name: Check available space | |
| run: | | |
| df -h | |
| shell: bash | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_KEY_SECRET }} | |
| aws-region: ${{ vars.AWS_REGION }} | |
| - name: Stop EC2 runner | |
| uses: machulav/ec2-github-runner@v2 | |
| with: | |
| mode: stop | |
| github-token: ${{ secrets.GH_TOKEN }} | |
| label: ${{ needs.start-runner-310-core.outputs.label }} | |
| ec2-instance-id: ${{ needs.start-runner-310-core.outputs.ec2-instance-id }} | |
| start-runner-310: | |
| if: github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'to-test-gpu') && success() | |
| needs: | |
| - pre-commit | |
| - macos-tests | |
| name: start-runner-310 | |
| runs-on: ubuntu-latest | |
| outputs: | |
| label: ${{ steps.start-ec2-runner.outputs.label }} | |
| ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} | |
| job-ran: ${{ steps.set-ran.outputs.ran }} | |
| steps: | |
| - id: set-ran | |
| run: echo "::set-output name=ran::true" | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_KEY_SECRET }} | |
| aws-region: ${{ vars.AWS_REGION }} | |
| - name: Start EC2 runner | |
| id: start-ec2-runner | |
| uses: machulav/ec2-github-runner@v2 | |
| with: | |
| mode: start | |
| github-token: ${{ secrets.GH_TOKEN }} | |
| ec2-image-id: ${{ vars.AWS_IMAGE_ID }} | |
| ec2-instance-type: ${{ vars.AWS_INSTANCE_TYPE }} | |
| subnet-id: ${{ vars.AWS_SUBNET }} | |
| security-group-id: ${{ vars.AWS_SECURITY_GROUP }} | |
| ubuntu-tests-310: | |
| name: ubuntu-tests-310 | |
| needs: start-runner-310 | |
| runs-on: ${{ needs.start-runner-310.outputs.label }} | |
| defaults: | |
| run: | |
| shell: bash | |
| working-directory: ${{ vars.WORKING_DIR }} | |
| strategy: | |
| matrix: | |
| python-version: ['3.10'] | |
| env: | |
| WORKING_DIR: ${{ vars.WORKING_DIR }} | |
| TORCH_HOME: ${{ vars.WORKING_DIR }}/torch | |
| PIP_CACHE_DIR: ${{ vars.WORKING_DIR }}/pip | |
| POETRY_CACHE_DIR: ${{ vars.WORKING_DIR }}/poetry | |
| HF_HOME: ${{ vars.WORKING_DIR }}/huggingface | |
| TRANSFORMERS_CACHE: ${{ vars.WORKING_DIR }}/huggingface/transformers | |
| HF_DATASETS_CACHE: ${{ vars.WORKING_DIR }}/huggingface/datasets | |
| outputs: | |
| job-ran: ${{ steps.set-ran.outputs.ran }} | |
| steps: | |
| - id: set-ran | |
| run: echo "::set-output name=ran::true" | |
| - name: Check available space before execution | |
| run: df -h | |
| shell: bash | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 # no need for the history | |
| - name: Cleanup disk space | |
| run: | | |
| echo "Cleaning up disk space..." | |
| rm -rf ~/.cache | |
| rm -rf ~/.npm | |
| rm -rf ~/.poetry | |
| df -h | |
| shell: bash | |
| - name: Create cache directories | |
| run: | | |
| mkdir -p "$POETRY_CACHE_DIR" "$PIP_CACHE_DIR" "$TORCH_HOME" "$HF_HOME" "$TRANSFORMERS_CACHE" "$HF_DATASETS_CACHE" | |
| ls -lah ${{ vars.WORKING_DIR }} | |
| shell: bash | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install ffmpeg | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y ffmpeg | |
| ffmpeg -version | |
| shell: bash | |
| - name: Install Poetry | |
| run: | | |
| which python | |
| python --version | |
| pip install poetry==2.1.3 | |
| which poetry | |
| poetry --version | |
| shell: bash | |
| - name: Check available space | |
| run: | | |
| df -h | |
| shell: bash | |
| - name: Echo python info | |
| run: | | |
| python --version | |
| which python | |
| which poetry | |
| shell: bash | |
| - name: Copy senselab directory to current directory | |
| run: | | |
| cp -r /actions-runner/_work/senselab/senselab . | |
| - name: Install dependencies with Poetry | |
| run: | | |
| cd senselab | |
| poetry env use ${{ matrix.python-version }} | |
| poetry install --extras "audio text video" --with dev | |
| shell: bash | |
| - name: Check NVIDIA SMI details | |
| run: | | |
| cd senselab | |
| poetry run nvidia-smi | |
| poetry run nvidia-smi -L | |
| poetry run nvidia-smi -q -d Memory | |
| shell: bash | |
| - name: Prepare cache folder for pytest | |
| run: mkdir -p $WORKING_DIR/pytest/temp | |
| shell: bash | |
| - name: Run unit tests | |
| id: run-tests | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: > | |
| cd senselab && poetry run pytest \ | |
| --rootdir=$WORKING_DIR/pytest \ | |
| --basetemp=$WORKING_DIR/pytest/temp \ | |
| --junitxml=pytest.xml \ | |
| --cov-report=term-missing:skip-covered \ | |
| --cov-report=xml:coverage.xml \ | |
| --cov=src src/tests \ | |
| --log-level=DEBUG \ | |
| --verbose | |
| shell: bash | |
| stop-runner-310: | |
| name: stop-runner-310 | |
| needs: | |
| - start-runner-310 # waits for the EC2 instance to be created | |
| - ubuntu-tests-310 # waits for the actual job to finish | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.start-runner-310.outputs.job-ran == 'true' && needs.ubuntu-tests-310.outputs.job-ran == 'true' || failure() }} # required to stop the runner even if an error occurred in previous jobs | |
| steps: | |
| - name: Check available space | |
| run: | | |
| df -h | |
| shell: bash | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_KEY_SECRET }} | |
| aws-region: ${{ vars.AWS_REGION }} | |
| - name: Stop EC2 runner | |
| uses: machulav/ec2-github-runner@v2 | |
| with: | |
| mode: stop | |
| github-token: ${{ secrets.GH_TOKEN }} | |
| label: ${{ needs.start-runner-310.outputs.label }} | |
| ec2-instance-id: ${{ needs.start-runner-310.outputs.ec2-instance-id }} | |
| start-runner-311: | |
| if: github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'to-test-gpu') && success() | |
| needs: | |
| - pre-commit | |
| - macos-tests | |
| name: start-runner-311 | |
| runs-on: ubuntu-latest | |
| outputs: | |
| label: ${{ steps.start-ec2-runner.outputs.label }} | |
| ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} | |
| job-ran: ${{ steps.set-ran.outputs.ran }} | |
| steps: | |
| - id: set-ran | |
| run: echo "::set-output name=ran::true" | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_KEY_SECRET }} | |
| aws-region: ${{ vars.AWS_REGION }} | |
| - name: Start EC2 runner | |
| id: start-ec2-runner | |
| uses: machulav/ec2-github-runner@v2 | |
| with: | |
| mode: start | |
| github-token: ${{ secrets.GH_TOKEN }} | |
| ec2-image-id: ${{ vars.AWS_IMAGE_ID }} | |
| ec2-instance-type: ${{ vars.AWS_INSTANCE_TYPE }} | |
| subnet-id: ${{ vars.AWS_SUBNET }} | |
| security-group-id: ${{ vars.AWS_SECURITY_GROUP }} | |
| ubuntu-tests-311: | |
| name: ubuntu-tests-311 | |
| needs: start-runner-311 | |
| runs-on: ${{ needs.start-runner-311.outputs.label }} | |
| defaults: | |
| run: | |
| shell: bash | |
| working-directory: ${{ vars.WORKING_DIR }} | |
| strategy: | |
| matrix: | |
| python-version: ['3.11'] | |
| env: | |
| WORKING_DIR: ${{ vars.WORKING_DIR }} | |
| TORCH_HOME: ${{ vars.WORKING_DIR }}/torch | |
| PIP_CACHE_DIR: ${{ vars.WORKING_DIR }}/pip | |
| POETRY_CACHE_DIR: ${{ vars.WORKING_DIR }}/poetry | |
| HF_HOME: ${{ vars.WORKING_DIR }}/huggingface | |
| TRANSFORMERS_CACHE: ${{ vars.WORKING_DIR }}/huggingface/transformers | |
| HF_DATASETS_CACHE: ${{ vars.WORKING_DIR }}/huggingface/datasets | |
| outputs: | |
| job-ran: ${{ steps.set-ran.outputs.ran }} | |
| steps: | |
| - id: set-ran | |
| run: echo "::set-output name=ran::true" | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 # no need for the history | |
| - name: Cleanup disk space | |
| run: | | |
| echo "Cleaning up disk space..." | |
| rm -rf ~/.cache | |
| rm -rf ~/.npm | |
| rm -rf ~/.poetry | |
| df -h | |
| shell: bash | |
| - name: Create cache directories | |
| run: | | |
| mkdir -p "$POETRY_CACHE_DIR" "$PIP_CACHE_DIR" "$TORCH_HOME" "$HF_HOME" "$TRANSFORMERS_CACHE" "$HF_DATASETS_CACHE" | |
| ls -lah ${{ vars.WORKING_DIR }} | |
| shell: bash | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install ffmpeg | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y ffmpeg | |
| ffmpeg -version | |
| shell: bash | |
| - name: Install Poetry | |
| run: | | |
| which python | |
| python --version | |
| pip install poetry==2.1.3 | |
| which poetry | |
| poetry --version | |
| shell: bash | |
| - name: Check available space | |
| run: | | |
| df -h | |
| shell: bash | |
| - name: Copy senselab directory to current directory | |
| run: | | |
| cp -r /actions-runner/_work/senselab/senselab . | |
| - name: Install dependencies with Poetry | |
| run: | | |
| cd senselab | |
| poetry env use ${{ matrix.python-version }} | |
| poetry install --extras "audio text video" --with dev | |
| shell: bash | |
| - name: Check poetry info | |
| run: | | |
| cd senselab | |
| poetry env info | |
| poetry --version | |
| shell: bash | |
| - name: Check NVIDIA SMI details | |
| run: | | |
| cd senselab | |
| poetry run nvidia-smi | |
| poetry run nvidia-smi -L | |
| poetry run nvidia-smi -q -d Memory | |
| shell: bash | |
| - name: Prepare cache folder for pytest | |
| run: mkdir -p $WORKING_DIR/pytest/temp | |
| shell: bash | |
| - name: Run unit tests | |
| id: run-tests | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: > | |
| cd senselab && poetry run pytest \ | |
| --rootdir=$WORKING_DIR/pytest \ | |
| --basetemp=$WORKING_DIR/pytest/temp \ | |
| --junitxml=pytest.xml \ | |
| --cov-report=term-missing:skip-covered \ | |
| --cov-report=xml:coverage.xml \ | |
| --cov=src src/tests \ | |
| --log-level=DEBUG \ | |
| --verbose | |
| shell: bash | |
| stop-runner-311: | |
| name: stop-runner-311 | |
| needs: | |
| - start-runner-311 # waits for the EC2 instance to be created | |
| - ubuntu-tests-311 # waits for the actual job to finish | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.start-runner-311.outputs.job-ran == 'true' && needs.ubuntu-tests-311.outputs.job-ran == 'true' || failure() }} # required to stop the runner even if an error occurred in previous jobs | |
| steps: | |
| - name: Check available space | |
| run: | | |
| df -h | |
| shell: bash | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_KEY_SECRET }} | |
| aws-region: ${{ vars.AWS_REGION }} | |
| - name: Stop EC2 runner | |
| uses: machulav/ec2-github-runner@v2 | |
| with: | |
| mode: stop | |
| github-token: ${{ secrets.GH_TOKEN }} | |
| label: ${{ needs.start-runner-311.outputs.label }} | |
| ec2-instance-id: ${{ needs.start-runner-311.outputs.ec2-instance-id }} | |
| start-runner-312: | |
| if: github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'to-test-gpu') && success() | |
| needs: | |
| - pre-commit | |
| - macos-tests | |
| name: start-runner-312 | |
| runs-on: ubuntu-latest | |
| outputs: | |
| label: ${{ steps.start-ec2-runner.outputs.label }} | |
| ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} | |
| job-ran: ${{ steps.set-ran.outputs.ran }} | |
| steps: | |
| - id: set-ran | |
| run: echo "::set-output name=ran::true" | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_KEY_SECRET }} | |
| aws-region: ${{ vars.AWS_REGION }} | |
| - name: Start EC2 runner | |
| id: start-ec2-runner | |
| uses: machulav/ec2-github-runner@v2 | |
| with: | |
| mode: start | |
| github-token: ${{ secrets.GH_TOKEN }} | |
| ec2-image-id: ${{ vars.AWS_IMAGE_ID }} | |
| ec2-instance-type: ${{ vars.AWS_INSTANCE_TYPE }} | |
| subnet-id: ${{ vars.AWS_SUBNET }} | |
| security-group-id: ${{ vars.AWS_SECURITY_GROUP }} | |
| ubuntu-tests-312: | |
| name: ubuntu-tests-312 | |
| needs: start-runner-312 | |
| runs-on: ${{ needs.start-runner-312.outputs.label }} | |
| defaults: | |
| run: | |
| shell: bash | |
| working-directory: ${{ vars.WORKING_DIR }} | |
| strategy: | |
| matrix: | |
| python-version: ['3.12'] | |
| env: | |
| WORKING_DIR: ${{ vars.WORKING_DIR }} | |
| TORCH_HOME: ${{ vars.WORKING_DIR }}/torch | |
| PIP_CACHE_DIR: ${{ vars.WORKING_DIR }}/pip | |
| POETRY_CACHE_DIR: ${{ vars.WORKING_DIR }}/poetry | |
| HF_HOME: ${{ vars.WORKING_DIR }}/huggingface | |
| TRANSFORMERS_CACHE: ${{ vars.WORKING_DIR }}/huggingface/transformers | |
| HF_DATASETS_CACHE: ${{ vars.WORKING_DIR }}/huggingface/datasets | |
| outputs: | |
| job-ran: ${{ steps.set-ran.outputs.ran }} | |
| steps: | |
| - id: set-ran | |
| run: echo "::set-output name=ran::true" | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 # no need for the history | |
| - name: Cleanup disk space | |
| run: | | |
| echo "Cleaning up disk space..." | |
| rm -rf ~/.cache | |
| rm -rf ~/.npm | |
| rm -rf ~/.poetry | |
| df -h | |
| shell: bash | |
| - name: Create cache directories | |
| run: | | |
| mkdir -p "$POETRY_CACHE_DIR" "$PIP_CACHE_DIR" "$TORCH_HOME" "$HF_HOME" "$TRANSFORMERS_CACHE" "$HF_DATASETS_CACHE" | |
| ls -lah ${{ vars.WORKING_DIR }} | |
| shell: bash | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install ffmpeg | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y ffmpeg | |
| ffmpeg -version | |
| shell: bash | |
| - name: Install Poetry | |
| run: | | |
| which python | |
| python --version | |
| pip install poetry==2.1.3 | |
| which poetry | |
| poetry --version | |
| shell: bash | |
| - name: Check available space | |
| run: | | |
| df -h | |
| shell: bash | |
| - name: Copy senselab directory to current directory | |
| run: | | |
| cp -r /actions-runner/_work/senselab/senselab . | |
| - name: Install dependencies with Poetry | |
| run: | | |
| cd senselab | |
| poetry env use ${{ matrix.python-version }} | |
| poetry install --extras "audio text video" --with dev | |
| shell: bash | |
| - name: Check poetry info | |
| run: | | |
| cd senselab | |
| poetry env info | |
| poetry --version | |
| shell: bash | |
| - name: Check NVIDIA SMI details | |
| run: | | |
| cd senselab | |
| poetry run nvidia-smi | |
| poetry run nvidia-smi -L | |
| poetry run nvidia-smi -q -d Memory | |
| shell: bash | |
| - name: Prepare cache folder for pytest | |
| run: mkdir -p $WORKING_DIR/pytest/temp | |
| shell: bash | |
| - name: Run unit tests | |
| id: run-tests | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: > | |
| cd senselab && poetry run pytest \ | |
| --rootdir=$WORKING_DIR/pytest \ | |
| --basetemp=$WORKING_DIR/pytest/temp \ | |
| --junitxml=pytest.xml \ | |
| --cov-report=term-missing:skip-covered \ | |
| --cov-report=xml:coverage.xml \ | |
| --cov=src src/tests \ | |
| --log-level=DEBUG \ | |
| --verbose | |
| shell: bash | |
| stop-runner-312: | |
| name: stop-runner-312 | |
| needs: | |
| - start-runner-312 # waits for the EC2 instance to be created | |
| - ubuntu-tests-312 # waits for the actual job to finish | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.start-runner-312.outputs.job-ran == 'true' && needs.ubuntu-tests-312.outputs.job-ran == 'true' || failure() }} # required to stop the runner even if an error occurred in previous jobs | |
| steps: | |
| - name: Check available space | |
| run: | | |
| df -h | |
| shell: bash | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_KEY_SECRET }} | |
| aws-region: ${{ vars.AWS_REGION }} | |
| - name: Stop EC2 runner | |
| uses: machulav/ec2-github-runner@v2 | |
| with: | |
| mode: stop | |
| github-token: ${{ secrets.GH_TOKEN }} | |
| label: ${{ needs.start-runner-312.outputs.label }} | |
| ec2-instance-id: ${{ needs.start-runner-312.outputs.ec2-instance-id }} |