This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: SaintDurbin Integration Tests | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| foundry-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| version: nightly | |
| - name: Run Foundry tests | |
| run: forge test -vvv | |
| - name: Check contract compilation | |
| run: forge build --sizes | |
| javascript-integration-tests: | |
| runs-on: ubuntu-latest | |
| needs: foundry-tests | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: 'scripts/package-lock.json' | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| components: rustfmt, clippy | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| version: nightly | |
| - name: Cache Cargo dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| subtensor_chain/target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('subtensor_chain/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}- | |
| ${{ runner.os }}-cargo- | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential clang libclang-dev libssl-dev pkg-config protobuf-compiler | |
| - name: Setup test environment | |
| run: | | |
| # Create test environment file | |
| cat > .env.test << EOF | |
| SAINT_DURBIN_ADDRESS=0x0000000000000000000000000000000000000000 | |
| PRIVATE_KEY=0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133 | |
| RPC_URL=http://127.0.0.1:9944 | |
| CHAIN_ENDPOINT=ws://127.0.0.1:9944 | |
| EOF | |
| # Make integration test script executable | |
| chmod +x ./run-integration-tests.sh | |
| - name: Install JavaScript dependencies | |
| working-directory: scripts | |
| run: | | |
| npm ci || npm install | |
| npm install --save-dev mocha chai sinon @polkadot/api | |
| - name: Run unit tests only | |
| working-directory: scripts | |
| run: npm test | |
| env: | |
| NODE_ENV: test | |
| # Note: Full integration tests with local chain would run here | |
| # but are commented out as they require significant setup time | |
| # - name: Run Integration Test Script | |
| # run: ./run-integration-tests.sh | |
| # timeout-minutes: 30 | |
| contract-security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| version: nightly | |
| - name: Run Slither | |
| uses: crytic/slither-action@v0.3.0 | |
| continue-on-error: true | |
| with: | |
| target: 'src/' | |
| slither-args: '--compile-force-framework foundry' | |
| - name: Run Aderyn | |
| shell: bash | |
| run: | | |
| # Install aderyn | |
| cargo install aderyn | |
| # Run security analysis | |
| aderyn . || true | |
| deployment-test: | |
| runs-on: ubuntu-latest | |
| needs: [foundry-tests, javascript-integration-tests] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| version: nightly | |
| - name: Test deployment script | |
| run: | | |
| # Test that deployment script compiles and dry-runs successfully | |
| forge script script/DeploySaintDurbin.s.sol:DeploySaintDurbin --fork-url ${{ secrets.BITTENSOR_RPC_URL || 'http://127.0.0.1:9944' }} | |
| env: | |
| EMERGENCY_OPERATOR: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" | |
| DRAIN_SS58_ADDRESS: "0x0000000000000000000000000000000000000000000000000000000000000001" | |
| VALIDATOR_HOTKEY: "0x0000000000000000000000000000000000000000000000000000000000000002" | |
| VALIDATOR_UID: "0" | |
| THIS_SS58_PUBLIC_KEY: "0x0000000000000000000000000000000000000000000000000000000000000003" | |
| NETUID: "0" |