Skip to content

update universa setup #102

update universa setup

update universa setup #102

Workflow file for this run

name: VERSA CI
on:
push:
pull_request:
branches: [ main ]
jobs:
code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # Updated to v4
with:
fetch-depth: 0
ref: ${{ github.head_ref || github.ref }} # Ensure correct branch checkout
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black flake8 pre-commit
pip install -e .
- name: Run pre-commit hooks with auto-fix
run: |
pre-commit run --all-files
- name: Commit auto-fixes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "style: auto-fix code formatting with pre-commit"
branch: ${{ github.head_ref || github.ref_name }}
if: github.event_name == 'pull_request' # Only auto-commit on PRs
- name: Lint with flake8
run: |
flake8 versa scripts test *.py --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 versa scripts test *.py --count --exit-zero --max-line-length=127 --statistics
install-tests:
needs: code-quality
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-22.04]
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4 # Updated to v4
with:
ref: ${{ github.head_ref || github.ref }}
- 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 pytest
pip install -e .
- name: Test installation
run: |
python -c "import versa; print(versa.__version__)"
basic-tests:
needs: install-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # Updated to v4
with:
ref: ${{ github.head_ref || github.ref }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
pip install -e .
- name: Run basic tests
run: |
pytest -xvs test/test_general.py
metric-tests:
needs: basic-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # Updated to v4
with:
ref: ${{ github.head_ref || github.ref }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
pip install -e .
- name: Run metric tests
run: |
pytest -xvs test/test_metrics/
# Optionally, you can generate a coverage report
# pytest -xvs test/test_metrics/ --cov=versa.metrics --cov-report=xml