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
57 changes: 57 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Git
.git
.gitignore
.github

# Python
__pycache__
*.py[cod]
*$py.class
*.so
.Python
*.egg-info
dist
build
*.egg

# Virtual environments
venv/
env/
ENV/
.venv

# IDE
.vscode
.idea
*.swp
*.swo
*~

# Testing
.pytest_cache
.coverage
htmlcov
.tox
.nox

# Documentation
docs/_build

# OS
.DS_Store
Thumbs.db

# Project specific
*.blockchain
wallets/
*.key
*.pem
logs/
data/
*.log

# Development
*.md
LICENSE
.dockerignore
docker-compose.yml
167 changes: 167 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: Blockchain CI/CD

on:
push:
branches: [ main, develop, claude/** ]
pull_request:
branches: [ main, develop ]

jobs:
test:
name: Test on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .

- name: Run tests with pytest
run: |
pytest -v --cov=blockchain_core --cov-report=xml --cov-report=term

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

lint:
name: Lint and Format Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 black pylint mypy

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

- name: Check formatting with black
run: |
black --check blockchain_core tests examples

- name: Lint with pylint
run: |
pylint blockchain_core --exit-zero

- name: Type check with mypy
run: |
mypy blockchain_core --ignore-missing-imports --no-strict-optional || true

security:
name: Security Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install safety bandit

- name: Check for security vulnerabilities
run: |
safety check --json || true

- name: Run bandit security linter
run: |
bandit -r blockchain_core -f json -o bandit-report.json || true

- name: Upload bandit report
uses: actions/upload-artifact@v3
with:
name: bandit-security-report
path: bandit-report.json

docker:
name: Build Docker Image
runs-on: ubuntu-latest
needs: [test, lint]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build Docker image
run: |
docker build -t blockchain:${{ github.sha }} .

- name: Test Docker image
run: |
docker run --rm blockchain:${{ github.sha }} python -c "from blockchain_core import Blockchain; print('Docker build successful!')"

examples:
name: Run Examples
runs-on: ubuntu-latest
needs: test

steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .

- name: Run basic usage example
run: |
python examples/basic_usage.py

- name: Run advanced features example
run: |
python examples/advanced_features.py
144 changes: 144 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
Pipfile.lock

# PEP 582
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Blockchain specific
*.blockchain
wallets/
*.key
*.pem

# Logs
logs/
*.log
Loading
Loading