Skip to content

chore: pipeline validation test #5

chore: pipeline validation test

chore: pipeline validation test #5

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 -U runner -d cueapi_test"
--health-interval 2s
--health-timeout 3s
--health-retries 15
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: ""
CUEAPI_STAGING_URL: https://api-staging-e962.up.railway.app
CUEAPI_STAGING_API_KEY: ${{ secrets.ARGUS_STAGING_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 }}\"
}
}"