Skip to content

Actually does not run pytests if no files changed #19

Actually does not run pytests if no files changed

Actually does not run pytests if no files changed #19

Workflow file for this run

name: Python Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.8"] # Reduced to just 3.8 since that's your target version
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Install PyTorch first
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install -r requirements.txt
pip install pytest pytest-cov coverage-badge mypy flake8 black isort pre-commit
# Create symlink to ensure pytest is in PATH
sudo ln -s $(which pytest) /usr/local/bin/pytest
- name: Run pre-commit
run: |
pre-commit install
pre-commit run --all-files
# - name: Type checking with mypy
# run: mypy .
# - name: Lint with flake8
# run: flake8 . --count --max-line-length=120 --statistics
# - name: Check formatting with black
# run: black --check . --line-length=120
# - name: Check import sorting with isort
# run: isort --check-only --diff .
- name: Run tests with coverage
run: |
pytest tests/ -v --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
name: codecov-ainex
fail_ci_if_error: true # Enable this to catch upload issues
verbose: true # Add verbose output for debugging