diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f891f711..a8246986 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,28 +2,58 @@ name: tests on: push: - branches: [ "main" ] + branches: + - main + paths: + - "**.py" + - "requirements.txt" + - ".github/workflows/*.yml" pull_request: - branches: [ "main" ] + branches: + - main + paths: + - "**.py" + - "requirements.txt" + - ".github/workflows/*.yml" jobs: check_code_quality: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 - - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.8" - + cache: "pip" + cache-dependency-path: "setup.py" - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install ruff - + python -m pip install .[torch,metrics,quality] - name: Check quality run: | make style && make quality + + pytest: + needs: check_code_quality + strategy: + matrix: + python-version: ["3.8", "3.9"] + os: ["ubuntu-latest", "windows-latest"] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + cache-dependency-path: "setup.py" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[torch,metrics,quality] + - name: Test with pytest + run: | + make test diff --git a/Makefile b/Makefile index 3a4a12c9..65be047b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: quality style +.PHONY: quality style test check_dirs := scripts src tests @@ -9,3 +9,6 @@ quality: style: ruff check $(check_dirs) --fix ruff format $(check_dirs) + +test: + pytest tests/