2024-01-22 23:13:04 +08:00
|
|
|
name: tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2024-06-08 01:48:30 +08:00
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
|
|
|
- "**.py"
|
|
|
|
- "requirements.txt"
|
|
|
|
- ".github/workflows/*.yml"
|
2024-01-22 23:13:04 +08:00
|
|
|
pull_request:
|
2024-06-08 01:48:30 +08:00
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
|
|
|
- "**.py"
|
|
|
|
- "requirements.txt"
|
|
|
|
- ".github/workflows/*.yml"
|
2024-01-22 23:13:04 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
check_code_quality:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-02-07 01:18:22 +08:00
|
|
|
- uses: actions/checkout@v4
|
2024-01-22 23:22:15 +08:00
|
|
|
- name: Set up Python
|
2024-02-07 01:18:22 +08:00
|
|
|
uses: actions/setup-python@v5
|
2024-01-22 23:22:15 +08:00
|
|
|
with:
|
|
|
|
python-version: "3.8"
|
2024-06-08 01:48:30 +08:00
|
|
|
cache: "pip"
|
|
|
|
cache-dependency-path: "setup.py"
|
2024-01-22 23:22:15 +08:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
2024-06-08 01:48:30 +08:00
|
|
|
python -m pip install .[torch,metrics,quality]
|
2024-01-22 23:22:15 +08:00
|
|
|
- name: Check quality
|
|
|
|
run: |
|
|
|
|
make style && make quality
|
2024-06-08 01:48:30 +08:00
|
|
|
|
|
|
|
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
|