From 04fc86eecfa0136fd02d3100197c347b766ff184 Mon Sep 17 00:00:00 2001 From: Gk Date: Sat, 4 Apr 2026 10:57:35 -0700 Subject: [PATCH 1/3] ci: remove dormant workflows, add auto-merge for feature PRs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Delete staging-integration.yml (dormant repository_dispatch, never fired) - Delete argus-qa.yml (Argus QA handled separately) - Add feature-to-main.yml: pytest on PRs → auto-merge → CueAPI merge cue - sdk-integration.yml unchanged (already correct) Also via API (not in this commit): - Branch protection: PR + 1 review, enforce_admins, required checks - Secrets added: GOVIND_GITHUB_TOKEN, ARGUS_CUEAPI_KEY Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/argus-qa.yml | 38 --------- .github/workflows/feature-to-main.yml | 96 +++++++++++++++++++++++ .github/workflows/staging-integration.yml | 26 ------ 3 files changed, 96 insertions(+), 64 deletions(-) delete mode 100644 .github/workflows/argus-qa.yml create mode 100644 .github/workflows/feature-to-main.yml delete mode 100644 .github/workflows/staging-integration.yml diff --git a/.github/workflows/argus-qa.yml b/.github/workflows/argus-qa.yml deleted file mode 100644 index d6de9c1..0000000 --- a/.github/workflows/argus-qa.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Argus QA - -on: - workflow_run: - workflows: ["SDK Staging Integration"] - types: [completed] - -jobs: - trigger-argus: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - name: Trigger Argus QA - run: | - FIRE_AT=$(date -u -d '+30 seconds' '+%Y-%m-%dT%H:%M:%SZ' 2>/dev/null || \ - date -u -v+30S '+%Y-%m-%dT%H:%M:%SZ') - RESPONSE=$(curl -s -w "\n%{http_code}" -X POST https://api.cueapi.ai/v1/cues \ - -H "Authorization: Bearer ${{ secrets.ARGUS_API_KEY }}" \ - -H "Content-Type: application/json" \ - -d "{ - \"name\": \"argus-cueapi-python-${{ github.event.workflow_run.head_sha }}\", - \"schedule\": {\"type\": \"once\", \"at\": \"${FIRE_AT}\"}, - \"transport\": \"worker\", - \"payload\": { - \"task\": \"sdk-qa\", - \"repo\": \"cueapi-python\", - \"commit\": \"${{ github.event.workflow_run.head_sha }}\", - \"staging_url\": \"${{ secrets.CUEAPI_STAGING_URL }}\" - } - }") - HTTP_CODE=$(echo "$RESPONSE" | tail -1) - BODY=$(echo "$RESPONSE" | head -1) - echo "Response ($HTTP_CODE): $BODY" - if [ "$HTTP_CODE" != "201" ]; then - echo "Failed to create Argus cue" - exit 1 - fi - echo "Argus will pick up SDK QA cue within 15 seconds." diff --git a/.github/workflows/feature-to-main.yml b/.github/workflows/feature-to-main.yml new file mode 100644 index 0000000..efe505e --- /dev/null +++ b/.github/workflows/feature-to-main.yml @@ -0,0 +1,96 @@ +name: Feature PR to Main + +on: + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:15-alpine + env: + POSTGRES_DB: cueapi_test + POSTGRES_USER: runner + POSTGRES_PASSWORD: "" + POSTGRES_HOST_AUTH_METHOD: trust + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 2s + --health-timeout 3s + --health-retries 10 + + redis: + image: redis:7-alpine + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 2s + --health-timeout 3s + --health-retries 10 + + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.7 + + - name: Checkout cueapi-core + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.7 + with: + repository: cueapi/cueapi-core + path: cueapi-core + token: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.3.0 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + pip install -r cueapi-core/requirements.txt + pip install -e . + + - name: Run tests + env: + DATABASE_URL: postgresql+asyncpg://runner@localhost:5432/cueapi_test + REDIS_URL: redis://localhost:6379 + SESSION_SECRET: test-session-secret-32-chars-minimum!! + ENV: test + RESEND_API_KEY: "" + run: pytest tests/ -v --tb=short + + auto-merge: + needs: test + runs-on: ubuntu-latest + steps: + - name: Auto-merge PR + run: gh pr merge ${{ github.event.pull_request.number }} --squash --auto + env: + GH_TOKEN: ${{ secrets.GOVIND_GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + + notify-merge: + needs: auto-merge + runs-on: ubuntu-latest + steps: + - name: Create merge confirmation cue + run: | + FIRE_AT=$(date -u -d '+2 minutes' '+%Y-%m-%dT%H:%M:%SZ' 2>/dev/null || \ + date -u -v+2M '+%Y-%m-%dT%H:%M:%SZ') + curl -s -w "\n%{http_code}" -X POST https://api.cueapi.ai/v1/cues \ + -H "Authorization: Bearer ${{ secrets.ARGUS_CUEAPI_KEY }}" \ + -H "Content-Type: application/json" \ + -d "{ + \"name\": \"cueapi-python-merged-${{ github.event.pull_request.number }}\", + \"schedule\": {\"type\": \"once\", \"at\": \"${FIRE_AT}\"}, + \"transport\": \"worker\", + \"payload\": { + \"task\": \"verify-github-merge\", + \"repo\": \"cueapi/cueapi-python\", + \"pr_number\": \"${{ github.event.pull_request.number }}\", + \"commit_sha\": \"${{ github.event.pull_request.head.sha }}\" + } + }" diff --git a/.github/workflows/staging-integration.yml b/.github/workflows/staging-integration.yml deleted file mode 100644 index 20c5fca..0000000 --- a/.github/workflows/staging-integration.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: SDK Staging Integration - -on: - workflow_dispatch: - repository_dispatch: - types: [cueapi-core-staging-ready] - -jobs: - sdk-staging: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.7 - - - name: Set up Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.3.0 - with: - python-version: '3.12' - - - name: Install SDK - run: pip install -e . - - - name: Run SDK tests against staging - env: - CUEAPI_BASE_URL: ${{ secrets.CUEAPI_STAGING_URL }} - CUEAPI_API_KEY: ${{ secrets.CUEAPI_STAGING_API_KEY }} - run: pytest tests/ -v --tb=short From 96f3870c7ae99c5f7cd82848112eacf34eb2892f Mon Sep 17 00:00:00 2001 From: govindkavaturi-art Date: Sat, 4 Apr 2026 11:14:25 -0700 Subject: [PATCH 2/3] ci: fix pg_isready health-cmd, add CUEAPI_STAGING_API_KEY env var --- .github/workflows/feature-to-main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/feature-to-main.yml b/.github/workflows/feature-to-main.yml index efe505e..57cb392 100644 --- a/.github/workflows/feature-to-main.yml +++ b/.github/workflows/feature-to-main.yml @@ -19,10 +19,10 @@ jobs: ports: - 5432:5432 options: >- - --health-cmd pg_isready + --health-cmd "pg_isready -U runner -d cueapi_test" --health-interval 2s --health-timeout 3s - --health-retries 10 + --health-retries 15 redis: image: redis:7-alpine @@ -60,6 +60,8 @@ jobs: SESSION_SECRET: test-session-secret-32-chars-minimum!! ENV: test RESEND_API_KEY: "" + CUEAPI_STAGING_URL: https://api-staging-e962.up.railway.app + CUEAPI_STAGING_API_KEY: ${{ secrets.ARGUS_CUEAPI_KEY }} run: pytest tests/ -v --tb=short auto-merge: From ddaf5746d3d156a1138d7bd3091f98ade5b87398 Mon Sep 17 00:00:00 2001 From: govindkavaturi-art Date: Sat, 4 Apr 2026 11:16:04 -0700 Subject: [PATCH 3/3] ci: use ARGUS_STAGING_KEY for cue tests (staging key, not prod key) --- .github/workflows/feature-to-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/feature-to-main.yml b/.github/workflows/feature-to-main.yml index 57cb392..54e7b37 100644 --- a/.github/workflows/feature-to-main.yml +++ b/.github/workflows/feature-to-main.yml @@ -61,7 +61,7 @@ jobs: ENV: test RESEND_API_KEY: "" CUEAPI_STAGING_URL: https://api-staging-e962.up.railway.app - CUEAPI_STAGING_API_KEY: ${{ secrets.ARGUS_CUEAPI_KEY }} + CUEAPI_STAGING_API_KEY: ${{ secrets.ARGUS_STAGING_KEY }} run: pytest tests/ -v --tb=short auto-merge: