Research-Stack/4-Infrastructure/NoDupeLabs/.github/workflows-disabled/test.yml.disabled

98 lines
2.3 KiB
Text

name: Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -e .
- name: Run mypy type checking
run: |
mypy nodupe/ --strict
- name: Run pylint quality check
run: |
pylint nodupe/ --exit-zero | tee pylint-report.txt
# Check if pylint score is below 10.0
SCORE=$(pylint nodupe/ --score=y | grep "rated at" | awk '{print $7}')
if (( $(echo "$SCORE < 10.0" | bc -l) )); then
echo "Pylint score $SCORE is below 10.0 threshold"
exit 1
fi
- name: Run pytest with coverage
run: |
pytest tests/ --cov=nodupe --cov-report=xml --cov-report=html --cov-report=term-missing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
- name: Upload coverage reports to Codecov
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Security scan
run: |
pip install bandit safety
bandit -r nodupe/
safety check
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Install linters
run: |
pip install -r requirements-dev.txt
- name: Check formatting with black
run: |
black --check nodupe/ tests/
- name: Check import sorting with isort
run: |
isort --check-only nodupe/ tests/
- name: Run flake8
run: |
flake8 nodupe/ tests/