Skip to content

Use rescore_region_graph=False for dust merge (skip stale edge re-sco… #247

Use rescore_region_graph=False for dust merge (skip stale edge re-sco…

Use rescore_region_graph=False for dust merge (skip stale edge re-sco… #247

Workflow file for this run

name: Tests
on:
push:
branches: [ main, master, v2.0 ]
pull_request:
branches: [ main, master, v2.0 ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.11']
steps:
- uses: actions/checkout@v3
- 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 pytest-cov
pip install -e .
- name: Validate tutorial configs
run: |
python scripts/validate_tutorial_configs.py
- name: Run tests
run: |
pytest tests/ -v --cov=connectomics --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install linters
run: |
python -m pip install --upgrade pip
pip install black flake8 isort mypy
- name: Collect changed Python files
id: changed-py
shell: bash
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
git fetch --no-tags --depth=1 origin "${{ github.base_ref }}"
files=$(git diff --name-only --diff-filter=ACMRT "origin/${{ github.base_ref }}...HEAD" -- 'connectomics/**/*.py')
else
if git rev-parse --verify HEAD~1 >/dev/null 2>&1; then
files=$(git diff --name-only --diff-filter=ACMRT HEAD~1..HEAD -- 'connectomics/**/*.py')
else
files=$(git ls-files 'connectomics/**/*.py')
fi
fi
echo "files<<EOF" >> "$GITHUB_OUTPUT"
echo "$files" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Run black
env:
CHANGED_FILES: ${{ steps.changed-py.outputs.files }}
run: |
python - <<'PY'
import os
import subprocess
import sys
files = [f for f in os.environ.get("CHANGED_FILES", "").splitlines() if f]
if not files:
print("No changed Python files under connectomics/. Skipping black.")
sys.exit(0)
subprocess.check_call(["black", "--check", *files])
PY
- name: Run flake8
env:
CHANGED_FILES: ${{ steps.changed-py.outputs.files }}
run: |
python - <<'PY'
import os
import subprocess
import sys
files = [f for f in os.environ.get("CHANGED_FILES", "").splitlines() if f]
if not files:
print("No changed Python files under connectomics/. Skipping flake8.")
sys.exit(0)
subprocess.check_call(["flake8", "--max-line-length=100", *files])
PY
- name: Run isort
env:
CHANGED_FILES: ${{ steps.changed-py.outputs.files }}
run: |
python - <<'PY'
import os
import subprocess
import sys
files = [f for f in os.environ.get("CHANGED_FILES", "").splitlines() if f]
if not files:
print("No changed Python files under connectomics/. Skipping isort.")
sys.exit(0)
subprocess.check_call(["isort", "--check", *files])
PY
- name: Run mypy
env:
CHANGED_FILES: ${{ steps.changed-py.outputs.files }}
run: |
python - <<'PY'
import os
import subprocess
import sys
files = [f for f in os.environ.get("CHANGED_FILES", "").splitlines() if f]
if not files:
print("No changed Python files under connectomics/. Skipping mypy.")
sys.exit(0)
subprocess.check_call(["mypy", "--config-file", ".github/mypy_changed.ini", *files])
PY