Pull out black, ruff, mypy to individual CI actions
This allows them to run in parallel. Topic: ci_parallel_actions_linter
This commit is contained in:
parent
0e6d7436f4
commit
9e785d651f
|
@ -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
|
|
@ -1,4 +1,4 @@
|
||||||
name: CI
|
name: Python Test
|
||||||
run-name: ${{ github.actor }} is running Riffusion CI
|
run-name: ${{ github.actor }} is running Riffusion CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
@ -9,7 +9,7 @@ on:
|
||||||
types: [opened, synchronize, reopened, ready_for_review]
|
types: [opened, synchronize, reopened, ready_for_review]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
riffusion-ci:
|
run:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -30,14 +30,13 @@ jobs:
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y ffmpeg libsndfile1
|
sudo apt-get install -y ffmpeg libsndfile1
|
||||||
|
|
||||||
- name: Install pip packages from requirements.txt
|
- name: Upgrade pip
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -r requirements.txt
|
|
||||||
|
|
||||||
- name: Install pip packages from dev_requirements.txt
|
- name: Install pip packages
|
||||||
run: |
|
run: |
|
||||||
pip install -r dev_requirements.txt
|
pip install -r requirements_all.txt
|
||||||
|
|
||||||
- name: Test with unittest
|
- name: Test with unittest
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -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'
|
|
@ -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
|
|
@ -66,6 +66,10 @@ ignore_missing_imports = true
|
||||||
module = "diffusers.*"
|
module = "diffusers.*"
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
|
|
||||||
|
[[tool.mypy.overrides]]
|
||||||
|
module = "huggingface_hub.*"
|
||||||
|
ignore_missing_imports = true
|
||||||
|
|
||||||
[[tool.mypy.overrides]]
|
[[tool.mypy.overrides]]
|
||||||
module = "numpy.*"
|
module = "numpy.*"
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
-r requirements.txt
|
||||||
|
-r requirements_dev.txt
|
|
@ -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)
|
|
Loading…
Reference in New Issue