|
| 1 | +name: Naga Health Checks |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - feature/jss-29-feature-add-naga-uptime-bot |
| 7 | + schedule: |
| 8 | + - cron: '*/5 * * * *' |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + naga_branch: |
| 12 | + description: 'Branch to run health checks from (optional)' |
| 13 | + required: true |
| 14 | + default: 'naga' |
| 15 | + network: |
| 16 | + description: 'Specific network to test (leave empty for all)' |
| 17 | + required: false |
| 18 | + type: choice |
| 19 | + options: |
| 20 | + - naga-dev |
| 21 | + - naga-test |
| 22 | + |
| 23 | +env: |
| 24 | + LIT_STATUS_WRITE_KEY: ${{ secrets.LIT_STATUS_WRITE_KEY }} |
| 25 | + LIT_STATUS_BACKEND_URL: ${{ vars.LIT_STATUS_BACKEND_URL }} |
| 26 | + |
| 27 | +jobs: |
| 28 | + naga-health-check: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + environment: Health Check |
| 31 | + strategy: |
| 32 | + fail-fast: false |
| 33 | + matrix: |
| 34 | + network: [naga-dev, naga-test] |
| 35 | + env: |
| 36 | + NETWORK: ${{ matrix.network }} |
| 37 | + LIVE_MASTER_ACCOUNT: ${{ matrix.network == 'naga-dev' && secrets.LIVE_MASTER_ACCOUNT_NAGA_DEV || secrets.LIVE_MASTER_ACCOUNT_NAGA_TEST }} |
| 38 | + LIT_YELLOWSTONE_PRIVATE_RPC_URL: ${{ vars.LIT_YELLOWSTONE_PRIVATE_RPC_URL }} |
| 39 | + steps: |
| 40 | + - name: Checkout repository |
| 41 | + uses: actions/checkout@v4 |
| 42 | + with: |
| 43 | + ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.naga_branch || github.ref }} |
| 44 | + fetch-depth: 1 |
| 45 | + |
| 46 | + - name: Install rust |
| 47 | + uses: actions-rs/toolchain@v1 |
| 48 | + with: |
| 49 | + toolchain: stable |
| 50 | + override: true |
| 51 | + components: rust-std |
| 52 | + |
| 53 | + - name: Install wasm-pack |
| 54 | + |
| 55 | + with: |
| 56 | + version: latest |
| 57 | + |
| 58 | + - name: Setup Node.js |
| 59 | + uses: actions/setup-node@v4 |
| 60 | + with: |
| 61 | + node-version: '22.18.0' |
| 62 | + registry-url: 'https://registry.npmjs.org' |
| 63 | + |
| 64 | + - name: Enable corepack and setup pnpm |
| 65 | + run: | |
| 66 | + corepack enable |
| 67 | + corepack prepare [email protected] --activate |
| 68 | +
|
| 69 | + - name: Install dependencies |
| 70 | + run: pnpm install --frozen-lockfile |
| 71 | + |
| 72 | + - name: Build project |
| 73 | + run: pnpm build |
| 74 | + |
| 75 | + - name: Verify required environment variables |
| 76 | + run: | |
| 77 | + echo "Checking environment variables for ${{ matrix.network }}..." |
| 78 | + if [ -z "${LIVE_MASTER_ACCOUNT}" ]; then |
| 79 | + echo "❌ LIVE_MASTER_ACCOUNT is not set for ${{ matrix.network }}" |
| 80 | + exit 1 |
| 81 | + fi |
| 82 | + if [ -z "${LIT_STATUS_WRITE_KEY}" ]; then |
| 83 | + echo "❌ LIT_STATUS_WRITE_KEY is not set" |
| 84 | + exit 1 |
| 85 | + fi |
| 86 | + if [ -z "${LIT_STATUS_BACKEND_URL}" ]; then |
| 87 | + echo "❌ LIT_STATUS_BACKEND_URL is not set" |
| 88 | + exit 1 |
| 89 | + fi |
| 90 | + echo "✅ All required environment variables are set" |
| 91 | +
|
| 92 | + - name: Run health check for ${{ matrix.network }} |
| 93 | + if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.network == '' || github.event.inputs.network == matrix.network }} |
| 94 | + run: pnpm run ci:health |
| 95 | + timeout-minutes: 10 |
| 96 | + env: |
| 97 | + NETWORK: ${{ matrix.network }} |
| 98 | + LIVE_MASTER_ACCOUNT: ${{ matrix.network == 'naga-dev' && secrets.LIVE_MASTER_ACCOUNT_NAGA_DEV || secrets.LIVE_MASTER_ACCOUNT_NAGA_TEST }} |
| 99 | + LIT_STATUS_WRITE_KEY: ${{ secrets.LIT_STATUS_WRITE_KEY }} |
| 100 | + LIT_STATUS_BACKEND_URL: ${{ vars.LIT_STATUS_BACKEND_URL }} |
| 101 | + LIT_YELLOWSTONE_PRIVATE_RPC_URL: ${{ vars.LIT_YELLOWSTONE_PRIVATE_RPC_URL }} |
| 102 | + LOG_LEVEL: info |
| 103 | + |
| 104 | + - name: Health check summary |
| 105 | + if: always() |
| 106 | + run: | |
| 107 | + if [[ "${{ job.status }}" == "success" ]]; then |
| 108 | + echo "✅ Health check passed for ${{ matrix.network }}" |
| 109 | + echo "Time: $(date -u +'%Y-%m-%d %H:%M:%S UTC')" |
| 110 | + else |
| 111 | + echo "❌ Health check failed for ${{ matrix.network }}" |
| 112 | + echo "Time: $(date -u +'%Y-%m-%d %H:%M:%S UTC')" |
| 113 | + echo "Please check the logs above for details" |
| 114 | + fi |
0 commit comments