diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml new file mode 100644 index 0000000..a7b51be --- /dev/null +++ b/.github/workflows/black.yml @@ -0,0 +1,15 @@ +name: Black Format + +on: + push: + branches: + - 'main' + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: psf/black@stable diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbc2aca..2c765bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: Python Test run-name: ${{ github.actor }} is running Riffusion CI on: @@ -9,7 +9,7 @@ on: types: [opened, synchronize, reopened, ready_for_review] jobs: - riffusion-ci: + run: runs-on: ubuntu-latest strategy: @@ -30,14 +30,13 @@ jobs: sudo apt-get update sudo apt-get install -y ffmpeg libsndfile1 - - name: Install pip packages from requirements.txt + - name: Upgrade pip run: | python -m pip install --upgrade pip - pip install -r requirements.txt - - name: Install pip packages from dev_requirements.txt + - name: Install pip packages run: | - pip install -r dev_requirements.txt + pip install -r requirements_all.txt - name: Test with unittest run: | diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 0000000..5a15149 --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,21 @@ +name: MyPy Type Check + +on: + push: + branches: + - 'main' + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - uses: jpetrucciani/mypy-check@master + with: + mypy_flags: '--config-file pyproject.toml' + requirements_file: 'requirements_all.txt' diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..ff0ab53 --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,15 @@ +name: Ruff Lint + +on: + push: + branches: + - 'main' + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: jpetrucciani/ruff-check@main diff --git a/pyproject.toml b/pyproject.toml index 88d8f05..55b0ffc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,6 +66,10 @@ ignore_missing_imports = true module = "diffusers.*" ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "huggingface_hub.*" +ignore_missing_imports = true + [[tool.mypy.overrides]] module = "numpy.*" ignore_missing_imports = true diff --git a/requirements_all.txt b/requirements_all.txt new file mode 100644 index 0000000..80394ad --- /dev/null +++ b/requirements_all.txt @@ -0,0 +1,2 @@ +-r requirements.txt +-r requirements_dev.txt diff --git a/dev_requirements.txt b/requirements_dev.txt similarity index 100% rename from dev_requirements.txt rename to requirements_dev.txt diff --git a/test/linter_test.py b/test/linter_test.py deleted file mode 100644 index 65456b9..0000000 --- a/test/linter_test.py +++ /dev/null @@ -1,24 +0,0 @@ -import subprocess -from pathlib import Path - -from .test_case import TestCase - - -class LinterTest(TestCase): - """ - Test that ruff, black, and mypy run cleanly. - """ - - HOME = Path(__file__).parent.parent - - def test_ruff(self) -> None: - code = subprocess.check_call(["ruff", str(self.HOME)]) - self.assertEqual(code, 0) - - def test_black(self) -> None: - code = subprocess.check_call(["black", "--check", str(self.HOME)]) - self.assertEqual(code, 0) - - def test_mypy(self) -> None: - code = subprocess.check_call(["mypy", str(self.HOME)]) - self.assertEqual(code, 0)