name: KONG

on:
  workflow_dispatch:
  pull_request:
    branches: [main]
  push:
    branches: [main]

env:
  test_api_key: ${{ secrets.KONG_SERVER_SDK_KEY }}
  test_client_key: ${{ secrets. KONG_CLIENT_SDK_KEY }}
  repo_pat: ${{ secrets.KONG_FINE_GRAINED_REPO_PAT }}
  FORCE_COLOR: true

jobs:
  KONG:
    timeout-minutes: 5
    runs-on: ubuntu-latest
    steps:
      - name: Get KONG
        run: git clone https://oauth2:$repo_pat@github.com/statsig-io/kong.git .

      - name: Install Deps
        run: npm install

      - name: Setup react SDK
        run: npm run kong -- setup react -v

      - name: Build Bridge Image
        run: npm run kong -- build react -v

      - name: Run Tests
        run: npm run kong -- test react -v -r
