Skip to content

Fix README

Fix README #41

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PYTHON_VERSION: "3.9"
CI: true
jobs:
code-quality:
name: Code Quality
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up development environment
run: ./scripts/setup-venv.sh
- name: Run code quality checks
timeout-minutes: 5
run: |
source venv/bin/activate
make format
make lint
make type-check
unit-tests:
name: Unit Tests
needs: code-quality
runs-on: ubuntu-22.04
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
exclude:
- python-version: "3.12.0"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up development environment
env:
CI_SKIP_INSTALL: true
run: ./scripts/setup-venv.sh
- name: Regenerate lock file for Python ${{ matrix.python-version }}
run: |
source venv/bin/activate
echo "πŸ”„ Regenerating poetry.lock for Python ${{ matrix.python-version }}"
# Remove existing lock file to ensure clean regeneration
# This is necessary because Poetry generates version-specific lock files
rm -f poetry.lock
# Generate new lock file for current Python version
poetry lock --verbose
echo "βœ… Lock file regenerated for Python ${{ matrix.python-version }}"
- name: Install dependencies with version-specific lock file
run: |
source venv/bin/activate
echo "πŸ“¦ Installing dependencies for Python ${{ matrix.python-version }}"
poetry install --with dev --no-interaction --verbose
echo "βœ… Dependencies installed for Python ${{ matrix.python-version }}"
- name: Run unit tests
timeout-minutes: 10
run: |
source venv/bin/activate
make test-unit
- name: Generate coverage report (Python 3.9 only)
if: matrix.python-version == '3.9'
run: |
source venv/bin/activate
make test-unit-cov
# Ensure coverage.xml is generated for codecov
if [ ! -f "coverage.xml" ] && [ -f "coverage-unit.xml" ]; then
cp coverage-unit.xml coverage.xml
fi
integration-tests:
name: Integration Tests
needs: unit-tests
runs-on: ubuntu-22.04
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
exclude:
- python-version: "3.12.0"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
# Install solc-select and Solidity compiler
pip install solc-select
solc-select install 0.8.19
solc-select use 0.8.19
# Verify
echo "πŸ” Verifying..."
which solc && solc --version || echo "⚠️ solc not found"
- name: Set up development environment
env:
CI_SKIP_INSTALL: true
run: ./scripts/setup-venv.sh
- name: Regenerate lock file for Python ${{ matrix.python-version }}
run: |
source venv/bin/activate
echo "πŸ”„ Regenerating poetry.lock for Python ${{ matrix.python-version }}"
# Remove existing lock file to ensure clean regeneration
# This is necessary because Poetry generates version-specific lock files
rm -f poetry.lock
# Generate new lock file for current Python version
poetry lock --verbose
echo "βœ… Lock file regenerated for Python ${{ matrix.python-version }}"
- name: Install dependencies with version-specific lock file
run: |
source venv/bin/activate
echo "πŸ“¦ Installing dependencies for Python ${{ matrix.python-version }}"
poetry install --with dev --no-interaction --verbose
echo "βœ… Dependencies installed for Python ${{ matrix.python-version }}"
- name: Run integration tests
timeout-minutes: 15
run: |
source venv/bin/activate
make test-integration
- name: Test sample contract analysis
run: |
source venv/bin/activate
if [ -f "samples/OpenAddressLottery.rt.hex" ]; then
echo "πŸ§ͺ Testing with available sample contract..."
python oyente/oyente.py -s samples/OpenAddressLottery.rt.hex -b || echo "Analysis completed with expected behavior"
else
echo "⚠️ Sample contract not found, skipping manual verification"
fi