Skip to content

Naga Health Checks #5035

Naga Health Checks

Naga Health Checks #5035

name: Naga Health Checks
on:
push:
branches:
- feature/jss-29-feature-add-naga-uptime-bot
schedule:
- cron: '*/5 * * * *'
workflow_dispatch:
inputs:
naga_branch:
description: 'Branch to run health checks from (optional)'
required: true
default: 'naga'
network:
description: 'Specific network to test (leave empty for all)'
required: false
type: choice
options:
- naga-dev
- naga-test
env:
LIT_STATUS_WRITE_KEY: ${{ secrets.LIT_STATUS_WRITE_KEY }}
LIT_STATUS_BACKEND_URL: ${{ vars.LIT_STATUS_BACKEND_URL }}
jobs:
naga-health-check:
runs-on: ubuntu-latest
if: ${{ github.repository == 'LIT-Protocol/js-sdk' }}
environment: Health Check
strategy:
fail-fast: false
matrix:
network: [naga-dev, naga-test]
env:
NETWORK: ${{ matrix.network }}
LIVE_MASTER_ACCOUNT: ${{ matrix.network == 'naga-dev' && secrets.LIVE_MASTER_ACCOUNT_NAGA_DEV || secrets.LIVE_MASTER_ACCOUNT_NAGA_TEST }}
LIT_YELLOWSTONE_PRIVATE_RPC_URL: ${{ vars.LIT_YELLOWSTONE_PRIVATE_RPC_URL }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: LIT-Protocol/js-sdk
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.naga_branch || 'naga' }}
fetch-depth: 1
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rust-std
- name: Install wasm-pack
uses: jetli/[email protected]
with:
version: latest
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.18.0'
registry-url: 'https://registry.npmjs.org'
- name: Enable corepack and setup pnpm
run: |
corepack enable
corepack prepare [email protected] --activate
- name: Print repo, branch and lockfile context
run: |
echo "Repo: $GITHUB_REPOSITORY"
echo "Checked out repo: LIT-Protocol/js-sdk"
echo "Ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.naga_branch || 'naga' }}"
echo "Checked out ref: $(git rev-parse --abbrev-ref HEAD)"
echo "Current commit: $(git rev-parse HEAD)"
echo "Node: $(node -v)"
echo "PNPM: $(pnpm --version)"
[ -f pnpm-lock.yaml ] && echo "pnpm-lock.yaml present" || echo "pnpm-lock.yaml missing"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build project
run: pnpm build
- name: Verify required environment variables
run: |
echo "Checking environment variables for ${{ matrix.network }}..."
if [ -z "${LIVE_MASTER_ACCOUNT}" ]; then
echo "❌ LIVE_MASTER_ACCOUNT is not set for ${{ matrix.network }}"
exit 1
fi
if [ -z "${LIT_STATUS_WRITE_KEY}" ]; then
echo "❌ LIT_STATUS_WRITE_KEY is not set"
exit 1
fi
if [ -z "${LIT_STATUS_BACKEND_URL}" ]; then
echo "❌ LIT_STATUS_BACKEND_URL is not set"
exit 1
fi
echo "✅ All required environment variables are set"
- name: Run health check for ${{ matrix.network }}
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.network == '' || github.event.inputs.network == matrix.network }}
run: pnpm run ci:health
timeout-minutes: 10
env:
NETWORK: ${{ matrix.network }}
LIVE_MASTER_ACCOUNT: ${{ matrix.network == 'naga-dev' && secrets.LIVE_MASTER_ACCOUNT_NAGA_DEV || secrets.LIVE_MASTER_ACCOUNT_NAGA_TEST }}
LIT_STATUS_WRITE_KEY: ${{ secrets.LIT_STATUS_WRITE_KEY }}
LIT_STATUS_BACKEND_URL: ${{ vars.LIT_STATUS_BACKEND_URL }}
LIT_YELLOWSTONE_PRIVATE_RPC_URL: ${{ vars.LIT_YELLOWSTONE_PRIVATE_RPC_URL }}
LOG_LEVEL: info
- name: Health check summary
if: always()
run: |
if [[ "${{ job.status }}" == "success" ]]; then
echo "✅ Health check passed for ${{ matrix.network }}"
echo "Time: $(date -u +'%Y-%m-%d %H:%M:%S UTC')"
else
echo "❌ Health check failed for ${{ matrix.network }}"
echo "Time: $(date -u +'%Y-%m-%d %H:%M:%S UTC')"
echo "Please check the logs above for details"
fi