🚀 MAJOR PRODUCTION READINESS UPGRADE - 85%+ Complete! #2
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: RTF Infrastructure CI/CD | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| test: | |
| name: Test Suite | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| rust: [stable, beta] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| components: rustfmt, clippy | |
| - name: Cache dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Run clippy | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| - name: Run tests | |
| run: cargo test --all-features --workspace | |
| - name: Run integration tests | |
| run: cargo test --test '*' --all-features | |
| security: | |
| name: Security Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-audit | |
| run: cargo install cargo-audit | |
| - name: Run security audit | |
| run: cargo audit | |
| - name: Run cargo-deny | |
| uses: EmbarkStudios/cargo-deny-action@v1 | |
| solana: | |
| name: Solana Programs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Solana CLI | |
| run: | | |
| sh -c "$(curl -sSfL https://release.solana.com/v1.16.0/install)" | |
| echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Solana dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cache/solana | |
| ~/.local/share/solana | |
| key: ${{ runner.os }}-solana-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build Solana programs | |
| run: | | |
| cd contracts/solana | |
| for program in */; do | |
| if [[ -d "$program" && -f "$program/Cargo.toml" ]]; then | |
| echo "Building $program..." | |
| cd "$program" | |
| cargo build-bpf | |
| cd .. | |
| fi | |
| done | |
| - name: Test Solana programs | |
| run: | | |
| cd contracts/solana | |
| for program in */; do | |
| if [[ -d "$program" && -f "$program/Cargo.toml" ]]; then | |
| echo "Testing $program..." | |
| cd "$program" | |
| cargo test-bpf | |
| cd .. | |
| fi | |
| done | |
| ethereum: | |
| name: Ethereum Contracts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| - name: Build Ethereum contracts | |
| run: | | |
| cd contracts/ethereum | |
| forge build | |
| - name: Test Ethereum contracts | |
| run: | | |
| cd contracts/ethereum | |
| forge test | |
| - name: Gas report | |
| run: | | |
| cd contracts/ethereum | |
| forge test --gas-report | |
| starknet: | |
| name: Starknet Contracts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Scarb | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Build Starknet contracts | |
| run: | | |
| cd contracts/starknet | |
| scarb build | |
| - name: Test Starknet contracts | |
| run: | | |
| cd contracts/starknet | |
| scarb test | |
| coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-tarpaulin | |
| run: cargo install cargo-tarpaulin | |
| - name: Generate coverage report | |
| run: cargo tarpaulin --all-features --workspace --timeout 120 --out xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./cobertura.xml | |
| fail_ci_if_error: true | |
| performance: | |
| name: Performance Benchmarks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Run benchmarks | |
| run: cargo bench --all-features | |
| - name: Store benchmark results | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| tool: 'cargo' | |
| output-file-path: target/criterion/report/index.html | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| auto-push: true | |
| docker: | |
| name: Docker Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| run: | | |
| docker build -t rtf-infrastructure:latest . | |
| - name: Test Docker image | |
| run: | | |
| docker run --rm rtf-infrastructure:latest --version | |
| deploy: | |
| name: Deploy to Staging | |
| runs-on: ubuntu-latest | |
| needs: [test, security, solana, ethereum, starknet] | |
| if: github.ref == 'refs/heads/develop' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Deploy to staging | |
| run: | | |
| echo "Deploying to staging environment..." | |
| # Add deployment scripts here | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: [test, security, solana, ethereum, starknet, coverage, performance] | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Create Release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ github.run_number }} | |
| release_name: Release v${{ github.run_number }} | |
| body: | | |
| Automated release from main branch | |
| Changes in this release: | |
| ${{ github.event.head_commit.message }} | |
| draft: false | |
| prerelease: false |