|
| 1 | +name: Test Installation |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, develop, real-using-test] |
| 6 | + pull_request: |
| 7 | + branches: [main, develop] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test-wheel-install: |
| 11 | + name: Test Wheel Installation (Python ${{ matrix.python-version }}) |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + python-version: ['3.10', '3.11', '3.12', '3.13'] |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Install Rust |
| 23 | + uses: dtolnay/rust-toolchain@stable |
| 24 | + |
| 25 | + - name: Set up Python ${{ matrix.python-version }} |
| 26 | + uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: ${{ matrix.python-version }} |
| 29 | + |
| 30 | + - name: Install build tools |
| 31 | + run: | |
| 32 | + python -m pip install --upgrade pip |
| 33 | + pip install 'maturin>=1.8,<2.0' build wheel setuptools |
| 34 | +
|
| 35 | + - name: Build wheel |
| 36 | + run: | |
| 37 | + maturin build --release --out dist/ |
| 38 | + python -m build --sdist |
| 39 | +
|
| 40 | + - name: Test wheel installation in clean environment |
| 41 | + run: | |
| 42 | + # Create a fresh virtual environment |
| 43 | + python -m venv /tmp/test-env |
| 44 | + source /tmp/test-env/bin/activate |
| 45 | +
|
| 46 | + # Install the built wheel |
| 47 | + pip install dist/*.whl |
| 48 | +
|
| 49 | + # Verify package can be imported |
| 50 | + python -c "import aiochainscan; print('✓ Package imported successfully')" |
| 51 | +
|
| 52 | + # Verify version |
| 53 | + python -c "import aiochainscan; print(f'✓ Version: {aiochainscan.__version__}')" |
| 54 | +
|
| 55 | + # Verify main modules |
| 56 | + python -c "from aiochainscan import ChainscanClient, Method; print('✓ Main classes imported')" |
| 57 | +
|
| 58 | + # Verify facade imports |
| 59 | + python -c "from aiochainscan import get_balance, get_block, get_transaction; print('✓ Facades imported')" |
| 60 | +
|
| 61 | + # Verify CLI is available |
| 62 | + which aiochainscan || echo "⚠ CLI not found" |
| 63 | + aiochainscan --help || echo "⚠ CLI help failed" |
| 64 | +
|
| 65 | + deactivate |
| 66 | +
|
| 67 | + - name: Test source distribution installation |
| 68 | + run: | |
| 69 | + # Verify sdist was created correctly |
| 70 | + ls -la dist/*.tar.gz |
| 71 | + python -c " |
| 72 | + import tarfile, sys |
| 73 | + sdist = sorted(__import__('glob').glob('dist/*.tar.gz'))[0] |
| 74 | + with tarfile.open(sdist) as t: |
| 75 | + names = t.getnames() |
| 76 | + print(f'✓ Source distribution created: {sdist}') |
| 77 | + print(f' Contains {len(names)} files') |
| 78 | + has_pyproject = any('pyproject.toml' in n for n in names) |
| 79 | + has_cargo = any('Cargo.toml' in n for n in names) |
| 80 | + has_rust = any('.rs' in n for n in names) |
| 81 | + print(f' pyproject.toml present: {has_pyproject}') |
| 82 | + print(f' Cargo.toml present: {has_cargo}') |
| 83 | + print(f' Rust sources present: {has_rust}') |
| 84 | + if not (has_pyproject and has_cargo and has_rust): |
| 85 | + print('✗ Source distribution is incomplete!') |
| 86 | + sys.exit(1) |
| 87 | + print('✓ Source distribution structure is valid') |
| 88 | + " |
| 89 | +
|
| 90 | + - name: Test editable install |
| 91 | + run: | |
| 92 | + # Test development install |
| 93 | + python -m venv /tmp/test-editable |
| 94 | + source /tmp/test-editable/bin/activate |
| 95 | +
|
| 96 | + # Install maturin first (for Rust extension build) |
| 97 | + pip install 'maturin>=1.8,<2.0' |
| 98 | +
|
| 99 | + pip install -e . |
| 100 | +
|
| 101 | + # Verify editable install |
| 102 | + python -c "import aiochainscan; print('✓ Editable install works')" |
| 103 | +
|
| 104 | + deactivate |
| 105 | +
|
| 106 | + test-git-install: |
| 107 | + name: Test Git Installation (Python 3.11) |
| 108 | + runs-on: ubuntu-latest |
| 109 | + |
| 110 | + steps: |
| 111 | + - name: Checkout code |
| 112 | + uses: actions/checkout@v4 |
| 113 | + |
| 114 | + - name: Install Rust |
| 115 | + uses: dtolnay/rust-toolchain@stable |
| 116 | + |
| 117 | + - name: Set up Python |
| 118 | + uses: actions/setup-python@v5 |
| 119 | + with: |
| 120 | + python-version: '3.11' |
| 121 | + |
| 122 | + - name: Test direct git install |
| 123 | + run: | |
| 124 | + # Build wheel directly with maturin (avoids PEP 517 isolation ZIP64 issue) |
| 125 | + python -m pip install --upgrade pip 'maturin>=1.8,<2.0' |
| 126 | + maturin build --release --out /tmp/git-wheels/ |
| 127 | +
|
| 128 | + # Simulate user installing the built wheel |
| 129 | + python -m venv /tmp/test-git |
| 130 | + source /tmp/test-git/bin/activate |
| 131 | + pip install /tmp/git-wheels/*.whl |
| 132 | +
|
| 133 | + # Verify installation |
| 134 | + python -c "import aiochainscan; print('✓ Git install successful')" |
| 135 | + python -c "from aiochainscan import *; print('✓ All imports successful')" |
| 136 | +
|
| 137 | + # List installed files to verify Python modules are present |
| 138 | + pip show -f aiochainscan | grep -E '(aiochainscan/.*\.py|Location:)' | head -20 |
| 139 | +
|
| 140 | + deactivate |
| 141 | +
|
| 142 | + test-dependencies: |
| 143 | + name: Test Dependencies (Python 3.11) |
| 144 | + runs-on: ubuntu-latest |
| 145 | + |
| 146 | + steps: |
| 147 | + - name: Checkout code |
| 148 | + uses: actions/checkout@v4 |
| 149 | + |
| 150 | + - name: Install Rust |
| 151 | + uses: dtolnay/rust-toolchain@stable |
| 152 | + |
| 153 | + - name: Set up Python |
| 154 | + uses: actions/setup-python@v5 |
| 155 | + with: |
| 156 | + python-version: '3.11' |
| 157 | + |
| 158 | + - name: Build and install |
| 159 | + run: | |
| 160 | + python -m pip install --upgrade pip 'maturin>=1.8,<2.0' |
| 161 | + # Use maturin directly to avoid pip PEP 517 isolation which triggers ZIP64 issue |
| 162 | + maturin build --release --out dist/ |
| 163 | + pip install dist/*.whl |
| 164 | +
|
| 165 | + - name: Check dependencies are installed |
| 166 | + run: | |
| 167 | + python -c "import httpx; print('✓ httpx')" |
| 168 | + python -c "import aiolimiter; print('✓ aiolimiter')" |
| 169 | + python -c "import tenacity; print('✓ tenacity')" |
| 170 | + python -c "import eth_abi; print('✓ eth_abi')" |
| 171 | + python -c "import structlog; print('✓ structlog')" |
| 172 | + python -c "import orjson; print('✓ orjson')" |
| 173 | + python -c "import pydantic; print('✓ pydantic')" |
| 174 | +
|
| 175 | + - name: Verify package structure |
| 176 | + run: | |
| 177 | + python -c " |
| 178 | + import aiochainscan |
| 179 | + import os |
| 180 | + pkg_path = os.path.dirname(aiochainscan.__file__) |
| 181 | + print(f'Package location: {pkg_path}') |
| 182 | +
|
| 183 | + # Check for key modules |
| 184 | + modules = ['client', 'config', 'network', 'core', 'services', 'adapters', 'ports', 'domain'] |
| 185 | + for mod in modules: |
| 186 | + mod_path = os.path.join(pkg_path, mod + '.py') |
| 187 | + dir_path = os.path.join(pkg_path, mod) |
| 188 | + if os.path.exists(mod_path) or os.path.isdir(dir_path): |
| 189 | + print(f'✓ {mod} exists') |
| 190 | + else: |
| 191 | + print(f'✗ {mod} missing') |
| 192 | + " |
0 commit comments