diff --git a/.github/workflows/naga-health-check.yml b/.github/workflows/naga-health-check.yml new file mode 100644 index 000000000..7c4138cbb --- /dev/null +++ b/.github/workflows/naga-health-check.yml @@ -0,0 +1,114 @@ +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 + 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: + ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.naga_branch || github.ref }} + 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/wasm-pack-action@v0.4.0 + 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 pnpm@9.15.0 --activate + + - 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b0a56bf17..b4bfae112 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - ref: ${{ github.event.workflow_run.head_sha }} + ref: ${{ github.event.workflow_run.head_branch }} - name: Setup PNPM uses: pnpm/action-setup@v4