feat(zk-ticket): implement all entry points #253
Workflow file for this run
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: Gatheraa CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| NODE_VERSION: '20.x' | |
| IMAGE_NAME: gatheraa/backend | |
| jobs: | |
| # --- Contract Jobs --- | |
| contract-lint: | |
| name: Contract Linting (Clippy & Fmt) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust stable toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, rustfmt | |
| - name: Cache Cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| contract/target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('contract/**/Cargo.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Add wasm32 target | |
| run: rustup target add wasm32-unknown-unknown | |
| - name: Check formatting | |
| working-directory: contract | |
| run: cargo fmt --all -- --check | |
| - name: Run Clippy | |
| working-directory: contract | |
| run: | | |
| cargo clippy \ | |
| --target wasm32-unknown-unknown \ | |
| --all-targets \ | |
| --all-features \ | |
| --message-format=short \ | |
| -- \ | |
| -D warnings | |
| continue-on-error: true | |
| contract-test: | |
| name: Contract Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust stable toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Add wasm32 target | |
| run: rustup target add wasm32-unknown-unknown | |
| - name: Cache Cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| contract/target | |
| key: ${{ runner.os }}-cargo-tests-${{ hashFiles('contract/**/Cargo.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-tests- | |
| - name: Run contract tests | |
| working-directory: contract | |
| run: cargo check --workspace --all-features --lib | |
| continue-on-error: true | |
| # --- Backend Jobs --- | |
| backend-test: | |
| name: Backend Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: app/backend/package-lock.json | |
| - name: Install dependencies | |
| working-directory: app/backend | |
| run: npm ci | |
| - name: Run tests | |
| working-directory: app/backend | |
| run: npm test | |
| - name: Check OpenAPI schema drift | |
| working-directory: app/backend | |
| run: npm run openapi:check | |
| # --- Frontend Jobs --- | |
| frontend-lint: | |
| name: Frontend Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: app/frontend/package-lock.json | |
| - name: Install dependencies | |
| working-directory: app/frontend | |
| run: npm ci | |
| - name: Run ESLint | |
| working-directory: app/frontend | |
| run: npm run lint | |
| continue-on-error: true | |
| frontend-typecheck: | |
| name: Frontend TypeCheck | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: app/frontend/package-lock.json | |
| - name: Install dependencies | |
| working-directory: app/frontend | |
| run: npm ci | |
| - name: Run TypeScript typecheck | |
| working-directory: app/frontend | |
| run: npx tsc --noEmit | |
| continue-on-error: true | |
| # --- Security & Dependency Scanning (#349) --- | |
| security-audit: | |
| name: Security & Dependency Scan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust stable toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Add wasm32 target | |
| run: rustup target add wasm32-unknown-unknown | |
| - name: Install cargo-audit | |
| uses: taiki-e/install-action@cargo-audit | |
| - name: Run Cargo Audit | |
| working-directory: contract | |
| run: cargo audit | |
| continue-on-error: true | |
| - name: Run NPM Audit | |
| working-directory: app/backend | |
| run: npm audit --audit-level=high | |
| continue-on-error: true | |
| - name: Run Trivy Vulnerability Scanner | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: '.' | |
| format: 'table' | |
| exit-code: '0' | |
| ignore-unfixed: true | |
| severity: 'CRITICAL,HIGH' | |
| # --- Gas Profiling (#350) --- | |
| gas-profiling: | |
| name: Gas Usage Profiling | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust stable toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Add wasm32 target | |
| run: rustup target add wasm32-unknown-unknown | |
| - name: Install system dependencies for Soroban CLI | |
| run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev libudev-dev pkg-config | |
| - name: Install Soroban CLI | |
| run: cargo install --locked soroban-cli | |
| continue-on-error: true | |
| - name: Build contracts | |
| working-directory: contract | |
| run: cargo build --target wasm32-unknown-unknown --release | |
| continue-on-error: true | |
| - name: Run Gas Profiling Script | |
| run: bash scripts/profile_gas.sh | |
| continue-on-error: true | |
| - name: Upload Gas Reports | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: gas-reports | |
| path: contract/gas_reports/ | |
| # --- Deployment & Verification (#348, #351) --- | |
| deploy-and-verify: | |
| name: Deploy & Verify Contracts | |
| needs: [contract-lint, contract-test, backend-test, security-audit] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Soroban CLI | |
| run: cargo install --locked soroban-cli | |
| continue-on-error: true | |
| - name: Build Contracts | |
| working-directory: contract | |
| run: cargo build --target wasm32-unknown-unknown --release | |
| continue-on-error: true | |
| - name: Deploy to Testnet/Mainnet | |
| run: bash scripts/deploy_contracts.sh | |
| env: | |
| SOROBAN_NETWORK: testnet | |
| SOROBAN_ACCOUNT_SECRET: ${{ secrets.SOROBAN_ACCOUNT_SECRET }} | |
| continue-on-error: true | |
| - name: Verify Deployed Contracts | |
| run: bash scripts/verify_contracts.sh | |
| continue-on-error: true | |
| env: | |
| SOROBAN_NETWORK: testnet | |