Skip to content

feat: enhance IPFSSimpleAPI loading with fastapi module fallback #474

feat: enhance IPFSSimpleAPI loading with fastapi module fallback

feat: enhance IPFSSimpleAPI loading with fastapi module fallback #474

# AMD64 Python Package CI/CD
# Based on generative-protein-binder-design repository patterns
name: AMD64 Python Package
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install system dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
build-essential \
git \
curl \
wget \
ca-certificates \
pkg-config \
libffi-dev \
libssl-dev
- name: Install Python dependencies
run: |
IPFS_KIT_EXTRAS=dev,full ./scripts/zero_touch_install.sh
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=.git,__pycache__,build,dist,*.egg-info
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=.git,__pycache__,build,dist,*.egg-info
- name: Type checking with mypy
run: |
pip install mypy types-requests
mypy . --ignore-missing-imports --exclude='build/|dist/|\.egg-info/' || true
- name: Security check with bandit
run: |
pip install bandit
bandit -r . -x ./tests/ -f json -o security-report.json || true
if [ -f security-report.json ]; then cat security-report.json; fi
- name: Test with pytest
run: |
pytest tests/ -v --cov=./ --cov-report=xml --cov-report=html --timeout=300 --maxfail=3 --ignore=tests/test_mcp_restoration.py
timeout-minutes: 30
- name: Upload coverage reports
uses: codecov/codecov-action@v3
if: matrix.python-version == '3.12'
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
- name: Archive test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.python-version }}
path: |
htmlcov/
security-report.json
pytest.xml
integration-tests:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
IPFS_KIT_EXTRAS=dev,full ./scripts/zero_touch_install.sh
- name: Run integration tests
run: |
if [ -d "tests/integration" ]; then
pytest tests/integration/ -v --timeout=600
else
echo "No integration tests found, skipping..."
fi
timeout-minutes: 15
docker-build:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./deployment/docker/Dockerfile
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max