GitHub wf on self-hosted runner #38
This file contains 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: github-runner-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'} | |
# the reason why we commented out 3.11 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 (Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: sudo apt-get update && sudo apt-get install -y ffmpeg | |
shell: bash | |
- name: Install ffmpeg (macOS) | |
if: startsWith(matrix.os, 'macos') | |
run: brew install ffmpeg | |
shell: bash | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.7.1 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Install dependencies with Poetry | |
run: | | |
poetry run pip install iso-639 | |
poetry install --with dev | |
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@v4 | |
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 | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.7.1 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Install dependencies with Poetry | |
run: | | |
poetry run pip install iso-639 | |
poetry install --with dev | |
shell: bash | |
- name: Install pre-commit | |
run: pipx install pre-commit | |
shell: bash | |
- name: Run pre-commit | |
run: | | |
poetry run pre-commit run --all-files | |
shell: bash |