A comprehensive tool for actively testing CKB SDKs against deployment configurations. This tool discovers SDKs on npm, installs them dynamically, and validates their script information against known-good deployment data.
- 🔍 Dynamic SDK Discovery - Automatically finds CKB SDK packages on npm
- 🧪 Runtime Testing - Installs and tests SDKs at runtime
- 📊 Comprehensive Validation - Tests against all known script deployments
- 📈 Detailed Reporting - Generates detailed test reports and summaries
- 🤖 CI/CD Ready - GitHub Actions integration for daily testing
- 🔄 Automated Workflow - Runs daily to catch SDK issues early
npm install
npm run build# Discover available SDKs
npm start discover
# Test a specific SDK
npm start test ckb-sdk-js
# Run full daily validation
npm start daily
# Show help
npm start helpimport { DailyTestRunner } from './src/ci/daily-test-runner';
import { NPMSDKDiscoverer } from './src/discovery/npm-sdk-discoverer';
import { DynamicSDKTester } from './src/testing/dynamic-sdk-tester';
// Run daily tests
const runner = new DailyTestRunner();
await runner.runDailyTests();
// Discover SDKs
const discoverer = new NPMSDKDiscoverer();
const sdkNames = await discoverer.discoverSDKs();
// Test specific SDKs
const tester = new DynamicSDKTester();
const reports = await tester.testAllSDKs(['ckb-sdk-js', 'another-sdk']);The tool searches npm for packages matching patterns like:
ckb-sdknervos-sdkckb-jsckb
For each discovered SDK:
- Installs the latest version:
npm install sdk-name@latest - Loads the SDK module dynamically
- Attempts to extract script information
The tool tries multiple patterns to extract script info:
// Pattern 1
sdk.getScriptInfo(scriptName, network)
// Pattern 2
sdk.scripts.get(scriptName, network)
// Pattern 3
sdk.getScript(scriptName, network)
// Pattern 4
sdk.scriptInfo(scriptName, network)
// Pattern 5
sdk.Scripts.get(scriptName, network)Compares SDK-provided script info against deployment configurations:
- codeHash - Script hash validation
- hashType - Hash type validation
- cellDeps - Cell dependencies validation
Generates comprehensive reports:
- Individual SDK test results
- Overall validation summary
- Detailed error reporting
- Success/failure statistics
🚀 Starting daily SDK validation...
==================================================
🔍 Discovering CKB SDK packages on npm...
Found 5 packages matching "ckb-sdk"
📦 Total unique SDK packages found: 8
🧪 Testing 8 SDK packages...
📦 Testing SDK: ckb-sdk-js
📥 Installing ckb-sdk-js@latest...
🔧 Loading SDK module...
🧪 Testing against 25 known scripts...
✅ ckb-sdk-js: 48/50 tests passed
📊 Validation Summary
==================================================
Total SDKs tested: 8
Successful: 6
Failed: 2
Success rate: 75.0%
Total tests: 400
Passed tests: 380
Failed tests: 20
Duration: 45.2s
Results are saved to the results/ directory:
validation-results-2024-01-15T10-30-00-000Z.json- Detailed resultsvalidation-summary-2024-01-15T10-30-00-000Z.json- Summarylatest-results.json- Latest detailed resultslatest-summary.json- Latest summary
The tool includes a GitHub Actions workflow that runs daily:
name: Daily SDK Validation
on:
schedule:
- cron: '0 2 * * *' # Daily at 2 AM UTC
workflow_dispatch: # Manual trigger- Scheduled Execution - Runs daily at 2 AM UTC
- Manual Trigger - Can be triggered manually
- PR Integration - Comments on PRs with validation results
- Artifact Upload - Saves results as GitHub artifacts
- Caching - Uses npm cache for faster builds
PORT- API server port (default: 3000)RESULTS_DIR- Results directory (default: ./results)
You can customize the tool by modifying:
- Search Patterns - Add more npm search patterns
- Test Scripts - Add more script names to test
- Validation Rules - Add custom validation logic
- Notification - Add custom notification handlers
src/
├── discovery/
│ └── npm-sdk-discoverer.ts # NPM package discovery
├── testing/
│ └── dynamic-sdk-tester.ts # SDK testing logic
├── validate/
│ └── ccc.ts # Validation engine
├── ci/
│ └── daily-test-runner.ts # CI/CD orchestration
└── index.ts # CLI interface
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
ISC License
For issues and questions:
- Check the existing issues
- Create a new issue with detailed information
- Include SDK names and error messages