1+ name : SaintDurbin Integration Tests
2+
3+ on :
4+ push :
5+ branches : [ main, develop ]
6+ pull_request :
7+ branches : [ main, develop ]
8+
9+ jobs :
10+ foundry-tests :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - uses : actions/checkout@v4
14+
15+ - name : Install Foundry
16+ uses : foundry-rs/foundry-toolchain@v1
17+ with :
18+ version : nightly
19+
20+ - name : Run Foundry tests
21+ run : forge test -vvv
22+
23+ - name : Check contract compilation
24+ run : forge build --sizes
25+
26+ javascript-integration-tests :
27+ runs-on : ubuntu-latest
28+ needs : foundry-tests
29+ steps :
30+ - name : Checkout code
31+ uses : actions/checkout@v4
32+ with :
33+ submodules : recursive
34+
35+ - name : Set up Node.js
36+ uses : actions/setup-node@v4
37+ with :
38+ node-version : ' 20'
39+ cache : ' npm'
40+ cache-dependency-path : ' scripts/package-lock.json'
41+
42+ - name : Install Rust toolchain
43+ uses : dtolnay/rust-toolchain@stable
44+ with :
45+ toolchain : stable
46+ components : rustfmt, clippy
47+
48+ - name : Install Foundry
49+ uses : foundry-rs/foundry-toolchain@v1
50+ with :
51+ version : nightly
52+
53+ - name : Cache Cargo dependencies
54+ uses : actions/cache@v3
55+ with :
56+ path : |
57+ ~/.cargo/bin/
58+ ~/.cargo/registry/index/
59+ ~/.cargo/registry/cache/
60+ ~/.cargo/git/db/
61+ subtensor_chain/target/
62+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('subtensor_chain/Cargo.lock') }}
63+ restore-keys : |
64+ ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-
65+ ${{ runner.os }}-cargo-
66+
67+ - name : Install system dependencies
68+ run : |
69+ sudo apt-get update
70+ sudo apt-get install -y build-essential clang libclang-dev libssl-dev pkg-config protobuf-compiler
71+
72+ - name : Setup test environment
73+ run : |
74+ # Create test environment file
75+ cat > .env.test << EOF
76+ SAINT_DURBIN_ADDRESS=0x0000000000000000000000000000000000000000
77+ PRIVATE_KEY=0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133
78+ RPC_URL=http://127.0.0.1:9944
79+ CHAIN_ENDPOINT=ws://127.0.0.1:9944
80+ EOF
81+
82+ # Make integration test script executable
83+ chmod +x ./run-integration-tests.sh
84+
85+ - name : Install JavaScript dependencies
86+ working-directory : scripts
87+ run : |
88+ npm ci || npm install
89+ npm install --save-dev mocha chai sinon @polkadot/api
90+
91+ - name : Run unit tests only
92+ working-directory : scripts
93+ run : npm test
94+ env :
95+ NODE_ENV : test
96+
97+ # Note: Full integration tests with local chain would run here
98+ # but are commented out as they require significant setup time
99+ # - name: Run Integration Test Script
100+ # run: ./run-integration-tests.sh
101+ # timeout-minutes: 30
102+
103+ contract-security :
104+ runs-on : ubuntu-latest
105+ steps :
106+ - uses : actions/checkout@v4
107+
108+ - name : Install Foundry
109+ uses : foundry-rs/foundry-toolchain@v1
110+ with :
111+ version : nightly
112+
113+ - name : Run Slither
114+ uses : crytic/slither-action@v0.3.0
115+ continue-on-error : true
116+ with :
117+ target : ' src/'
118+ slither-args : ' --compile-force-framework foundry'
119+
120+ - name : Run Aderyn
121+ shell : bash
122+ run : |
123+ # Install aderyn
124+ cargo install aderyn
125+ # Run security analysis
126+ aderyn . || true
127+
128+ deployment-test :
129+ runs-on : ubuntu-latest
130+ needs : [foundry-tests, javascript-integration-tests]
131+ steps :
132+ - uses : actions/checkout@v4
133+
134+ - name : Install Foundry
135+ uses : foundry-rs/foundry-toolchain@v1
136+ with :
137+ version : nightly
138+
139+ - name : Test deployment script
140+ run : |
141+ # Test that deployment script compiles and dry-runs successfully
142+ forge script script/DeploySaintDurbin.s.sol:DeploySaintDurbin --fork-url ${{ secrets.BITTENSOR_RPC_URL || 'http://127.0.0.1:9944' }}
143+ env :
144+ EMERGENCY_OPERATOR : " 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
145+ DRAIN_SS58_ADDRESS : " 0x0000000000000000000000000000000000000000000000000000000000000001"
146+ VALIDATOR_HOTKEY : " 0x0000000000000000000000000000000000000000000000000000000000000002"
147+ VALIDATOR_UID : " 0"
148+ THIS_SS58_PUBLIC_KEY : " 0x0000000000000000000000000000000000000000000000000000000000000003"
149+ NETUID : " 0"
0 commit comments