Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Codecov configuration for fa2_modified

coverage:
status:
project:
default:
target: auto
threshold: 5%
patch:
default:
target: auto
threshold: 5%

ignore:
- "tests/"
- "examples/"
- "setup.py"
- "fa2_modified/fa2util.c" # Generated C file

comment:
layout: "reach, diff, flags, files"
behavior: default
require_changes: false

91 changes: 91 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Continuous Integration

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master, dev ]
schedule:
# Run tests weekly on Monday at 00:00 UTC
- cron: '0 0 * * 1'
workflow_dispatch:

jobs:
quick-test:
name: Quick test (Python 3.11, Ubuntu)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install Cython
pip install -e .
pip install pytest networkx

- name: Run quick tests
run: |
pytest tests/test_fa2util.py tests/test_forceatlas2.py -v

full-test:
name: Full test suite
needs: quick-test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.10', '3.11', '3.12', '3.13']
exclude:
- os: macos-latest
python-version: '3.8'
- os: windows-latest
python-version: '3.8'

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'

- name: Install system dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install Cython
pip install -e .
pip install pytest pytest-cov networkx

- name: Install igraph (non-Windows)
if: runner.os != 'Windows'
continue-on-error: true
run: pip install python-igraph

- name: Run tests
run: |
pytest tests/ -v --cov=fa2_modified --cov-report=xml

- name: Upload coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
fail_ci_if_error: false

87 changes: 87 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Code Quality

on:
pull_request:
branches: [ main, master, dev ]
push:
branches: [ main, master ]

jobs:
lint:
name: Linting (flake8)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install flake8
run: pip install flake8

- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 fa2_modified --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 fa2_modified --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

format-check:
name: Code Formatting (black)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install black
run: pip install black

- name: Check formatting
run: black --check --diff fa2_modified/ tests/

import-sort:
name: Import Sorting (isort)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install isort
run: pip install isort

- name: Check import sorting
run: isort --check-only --diff fa2_modified/ tests/

type-check:
name: Type Checking (mypy)
runs-on: ubuntu-latest
continue-on-error: true # Don't fail the build on type errors for now

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install dependencies
run: |
pip install mypy numpy scipy tqdm

- name: Type check with mypy
run: mypy fa2_modified/ --ignore-missing-imports || echo "Type checking found issues (not blocking)"

120 changes: 88 additions & 32 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,101 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package
name: Build and Publish Wheels

on:
release:
types: [published]
workflow_dispatch:

permissions:
contents: read

jobs:
deploy:
build-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Set up QEMU for Linux ARM builds
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
pip install cibuildwheel==2.16.5

- name: Build wheels
env:
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-* cp313-*"
CIBW_SKIP: "pp* *-musllinux_*"
CIBW_BEFORE_BUILD: "pip install -U pip setuptools wheel Cython numpy"
CIBW_BEFORE_BUILD_LINUX: "pip install -U pip setuptools wheel Cython numpy && yum install -y gcc"
CIBW_TEST_COMMAND: "python -c \"import fa2_modified; print('Import successful')\""
CIBW_TEST_REQUIRES: "numpy scipy tqdm"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_ARCHS_WINDOWS: "AMD64"
CIBW_ARCHS_LINUX: "x86_64 aarch64"
CIBW_BUILD_VERBOSITY: 1
run: |
python -m cibuildwheel --output-dir wheelhouse

- name: Build sdist (source)
if: matrix.os == 'ubuntu-latest'
run: |
python -m pip install build Cython
python -m build --sdist --outdir wheelhouse

- name: List built wheels
run: ls -lh wheelhouse/

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: wheelhouse/*
if-no-files-found: error

publish:
name: Publish to PyPI
needs: build-wheels
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/fa2-modified
permissions:
id-token: write
contents: read

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: docker://quay.io/pypa/manylinux2014_x86_64
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine auditwheel
- name: Build package
run: |
python3 -m pip install --upgrade build
python3 -m build
- name: Repair wheels
run: |
auditwheel repair --wheel-dir dist dist/*.whl
rm -rf dist/*linux_x86_64*.whl
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_GITHUB }}
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true

- name: List all files to publish
run: ls -lh dist/

- name: Verify wheels
run: |
pip install twine
twine check dist/*

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN_GITHUB }}
packages-dir: dist
verbose: true
print-hash: true
Loading
Loading