|
| 1 | +name: libit Package CI/CD |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*.*.*" |
| 7 | + branches: [ "main" ] |
| 8 | + pull_request: |
| 9 | + branches: [ "main" ] |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + test: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Set up Python ${{ matrix.python-version }} |
| 25 | + uses: actions/setup-python@v4 |
| 26 | + with: |
| 27 | + python-version: ${{ matrix.python-version }} |
| 28 | + |
| 29 | + - name: Install dependencies |
| 30 | + run: | |
| 31 | + python -m pip install --upgrade pip |
| 32 | + pip install setuptools wheel |
| 33 | + pip install -e . |
| 34 | + |
| 35 | + - name: Install test dependencies |
| 36 | + run: | |
| 37 | + pip install pytest pytest-cov pytest-xdist flake8 black mypy |
| 38 | + |
| 39 | + - name: Type checking with mypy |
| 40 | + run: | |
| 41 | + mypy libit --ignore-missing-imports --no-strict-optional |
| 42 | + continue-on-error: true |
| 43 | + |
| 44 | + - name: Code formatting check with black |
| 45 | + run: | |
| 46 | + black --check --diff . |
| 47 | + continue-on-error: true |
| 48 | + |
| 49 | + - name: Lint with flake8 |
| 50 | + run: | |
| 51 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 52 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 53 | +
|
| 54 | + - name: Security check with bandit |
| 55 | + run: | |
| 56 | + pip install bandit |
| 57 | + bandit -r libit/ -f json -o bandit-report.json || true |
| 58 | + bandit -r libit/ || true |
| 59 | + continue-on-error: true |
| 60 | + |
| 61 | + - name: Run comprehensive tests |
| 62 | + run: | |
| 63 | + python -m pytest tests.py tests_enhanced.py -v --cov=libit --cov-report=xml --cov-report=html |
| 64 | + continue-on-error: true |
| 65 | + |
| 66 | + - name: Test basic functionality |
| 67 | + run: | |
| 68 | + python -c "import libit; print('✅ Import successful')" |
| 69 | + python -c "from libit import gen_key, btc_wallet, multi_wallet; key = gen_key(); wallet = btc_wallet(key); print('✅ Multi-crypto functions work')" |
| 70 | + python -c "from libit import privatekey_addr; addr = privatekey_addr('a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2'); print('✅ Legacy functions work')" |
| 71 | + python -c "from libit import check_addr, is_valid, valid; result = check_addr('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa'); print('✅ Validation works')" |
| 72 | + python -c "from libit import btc, ltc, doge; w1=btc(); w2=ltc(); w3=doge(); print('✅ Short names work')" |
| 73 | +
|
| 74 | + - name: Test multi-crypto features |
| 75 | + run: | |
| 76 | + python -c " |
| 77 | + from libit import multi_wallet, gen_key, zcash_wallet, vtc_wallet |
| 78 | + key = gen_key() |
| 79 | + multi = multi_wallet(key) |
| 80 | + btc_info = multi.btc() |
| 81 | + print(f'BTC Legacy: {btc_info.addresses.legacy}') |
| 82 | + print(f'BTC Script: {btc_info.addresses.script}') |
| 83 | + zcash_info = zcash_wallet(key) |
| 84 | + vtc_info = vtc_wallet(key) |
| 85 | + print('✅ All cryptocurrencies supported') |
| 86 | + " |
| 87 | +
|
| 88 | + - name: Test validation features |
| 89 | + run: | |
| 90 | + python -c " |
| 91 | + from libit import check_addr, Validator, valid, coin_type |
| 92 | + btc_result = check_addr('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa', 'btc') |
| 93 | + auto_result = check_addr('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa') |
| 94 | + quick_check = valid('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa') |
| 95 | + coin = coin_type('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa') |
| 96 | + print('✅ Enhanced validation works') |
| 97 | + " |
| 98 | +
|
| 99 | + - name: Test examples |
| 100 | + run: | |
| 101 | + python examples_enhanced.py |
| 102 | + continue-on-error: true |
| 103 | + |
| 104 | + - name: Upload coverage reports |
| 105 | + uses: actions/upload-artifact@v3 |
| 106 | + with: |
| 107 | + name: coverage-reports-${{ matrix.python-version }} |
| 108 | + path: | |
| 109 | + coverage.xml |
| 110 | + htmlcov/ |
| 111 | + if: always() |
| 112 | + |
| 113 | + build: |
| 114 | + needs: test |
| 115 | + runs-on: ubuntu-latest |
| 116 | + |
| 117 | + steps: |
| 118 | + - name: Checkout repository |
| 119 | + uses: actions/checkout@v4 |
| 120 | + |
| 121 | + - name: Set up Python |
| 122 | + uses: actions/setup-python@v4 |
| 123 | + with: |
| 124 | + python-version: '3.x' |
| 125 | + |
| 126 | + - name: Install build dependencies |
| 127 | + run: | |
| 128 | + python -m pip install --upgrade pip |
| 129 | + pip install build twine |
| 130 | +
|
| 131 | + - name: Build package |
| 132 | + run: | |
| 133 | + python -m build |
| 134 | + ls -la dist/ |
| 135 | +
|
| 136 | + - name: Check package integrity |
| 137 | + run: | |
| 138 | + python setup.py check --strict |
| 139 | + twine check dist/* |
| 140 | + |
| 141 | + - name: Test package installation |
| 142 | + run: | |
| 143 | + pip install dist/*.whl |
| 144 | + python -c "import libit; print('✅ Package installs correctly')" |
| 145 | + |
| 146 | + - name: Upload build artifacts |
| 147 | + uses: actions/upload-artifact@v3 |
| 148 | + with: |
| 149 | + name: dist |
| 150 | + path: dist/ |
| 151 | + |
| 152 | + security: |
| 153 | + runs-on: ubuntu-latest |
| 154 | + needs: test |
| 155 | + |
| 156 | + steps: |
| 157 | + - name: Checkout repository |
| 158 | + uses: actions/checkout@v4 |
| 159 | + |
| 160 | + - name: Set up Python |
| 161 | + uses: actions/setup-python@v4 |
| 162 | + with: |
| 163 | + python-version: '3.x' |
| 164 | + |
| 165 | + - name: Install security tools |
| 166 | + run: | |
| 167 | + pip install safety bandit semgrep |
| 168 | + |
| 169 | + - name: Check dependencies for vulnerabilities |
| 170 | + run: | |
| 171 | + safety check --json --output safety-report.json || true |
| 172 | + safety check || true |
| 173 | + continue-on-error: true |
| 174 | + |
| 175 | + - name: Static security analysis |
| 176 | + run: | |
| 177 | + bandit -r libit/ -f json -o bandit-report.json || true |
| 178 | + bandit -r libit/ || true |
| 179 | + continue-on-error: true |
| 180 | + |
| 181 | + - name: Upload security reports |
| 182 | + uses: actions/upload-artifact@v3 |
| 183 | + with: |
| 184 | + name: security-reports |
| 185 | + path: | |
| 186 | + safety-report.json |
| 187 | + bandit-report.json |
| 188 | + if: always() |
| 189 | + |
| 190 | + publish: |
| 191 | + needs: [test, build, security] |
| 192 | + runs-on: ubuntu-latest |
| 193 | + if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' |
| 194 | + |
| 195 | + steps: |
| 196 | + - name: Checkout repository |
| 197 | + uses: actions/checkout@v4 |
| 198 | + |
| 199 | + - name: Download build artifacts |
| 200 | + uses: actions/download-artifact@v3 |
| 201 | + with: |
| 202 | + name: dist |
| 203 | + path: dist/ |
| 204 | + |
| 205 | + - name: Publish to PyPI |
| 206 | + env: |
| 207 | + TWINE_USERNAME: __token__ |
| 208 | + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
| 209 | + run: | |
| 210 | + pip install twine |
| 211 | + twine upload dist/* |
| 212 | + |
| 213 | + - name: Create GitHub Release |
| 214 | + if: success() |
| 215 | + uses: softprops/action-gh-release@v1 |
| 216 | + with: |
| 217 | + tag_name: "v5.2.0" |
| 218 | + name: "libit v5.2.0 - Enhanced Multi-Cryptocurrency Support" |
| 219 | + body: | |
| 220 | + ## 🚀 libit v5.2.0 - Major Enhancement Release |
| 221 | +
|
| 222 | + ### ✨ New Features |
| 223 | + - **Multi-Cryptocurrency Support**: Bitcoin, Litecoin, Dogecoin, Bitcoin Cash, Dash, Ethereum, Tron |
| 224 | + - **Shorter Function Names**: More intuitive and concise API |
| 225 | + - **Enhanced Validation**: Comprehensive address validation for all supported coins |
| 226 | + - **DataClass Integration**: Professional structure with better error handling |
| 227 | + - **Improved CI/CD**: Enhanced testing and automated quality checks |
| 228 | +
|
| 229 | + ### 🔧 Installation |
| 230 | + |
| 231 | + ```bash |
| 232 | + pip install libit --upgrade |
| 233 | + ``` |
| 234 | +
|
| 235 | + ### 💡 Quick Usage |
| 236 | + |
| 237 | + ```python |
| 238 | + from libit import gen_key, multi_wallet, btc_wallet, check_addr |
| 239 | + |
| 240 | + # Generate multi-crypto wallet |
| 241 | + key = gen_key() |
| 242 | + wallet = multi_wallet(key) |
| 243 | + |
| 244 | + # Get Bitcoin addresses |
| 245 | + btc = wallet.btc() |
| 246 | + print(btc.addresses.legacy) # Legacy address |
| 247 | + print(btc.addresses.script) # Script address |
| 248 | + |
| 249 | + # Individual coin wallets |
| 250 | + ltc = ltc_wallet(key) |
| 251 | + doge = doge_wallet(key) |
| 252 | + |
| 253 | + # Validate addresses |
| 254 | + result = check_addr("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa") |
| 255 | + print(result.valid, result.coin) |
| 256 | + ``` |
| 257 | +
|
| 258 | + ### 🔗 Links |
| 259 | + - [📚 Documentation](https://pylibit.github.io/libit/) |
| 260 | + - [🐍 PyPI Package](https://pypi.org/project/libit/) |
| 261 | + - [🔧 Source Code](https://github.com/pylibit/libit) |
| 262 | + |
| 263 | + ### 🏷️ Supported Cryptocurrencies |
| 264 | + - Bitcoin (BTC) - Legacy, Script, SegWit |
| 265 | + - Litecoin (LTC) - Legacy, Script, SegWit |
| 266 | + - Dogecoin (DOGE) - Legacy, Script |
| 267 | + - Bitcoin Cash (BCH) - Legacy, Script |
| 268 | + - Dash (DASH) - Legacy, Script |
| 269 | + - Ethereum (ETH) |
| 270 | + - Tron (TRX) |
| 271 | + |
| 272 | + **Full backward compatibility maintained** ✅ |
| 273 | + |
| 274 | + files: | |
| 275 | + dist/*.tar.gz |
| 276 | + dist/*.whl |
| 277 | + env: |
| 278 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments