Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/scos-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: SCOS Integration Tests

on:
pull_request:
branches: [main]
paths:
- 'src/snowflake/snowpark/**'
- 'setup.py'
- 'pyproject.toml'

jobs:
trigger-scos:
name: Trigger SCOS Tests
runs-on: ubuntu-latest
steps:
- name: Trigger SCOS repository_dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.SCOS_TRIGGER_PAT }}
repository: snowflake-eng/sas
event-type: snowpark-python-test
client-payload: |
{
"caller_repo": "${{ github.repository }}",
"caller_sha": "${{ github.event.pull_request.head.sha }}",
"pr_number": "${{ github.event.pull_request.number }}",
"pr_title": ${{ toJSON(github.event.pull_request.title) }},
"snowpark_python_path": "git+https://github.com/${{ github.repository }}.git@refs/pull/${{ github.event.pull_request.number }}/head",
"snowpark_python_branch": "PR-${{ github.event.pull_request.number }}"
}

- name: Wait for SCOS status
run: |
echo "SCOS tests triggered. Waiting for status..."
SHA="${{ github.event.pull_request.head.sha }}"

# Let SCOS's report-pending job post an initial status.
sleep 15

# Poll for status (timeout after 60 minutes: 120 iterations * 30s).
# If SCOS hasn't posted any status within the first ~5 minutes,
# assume the dispatch silently failed (bad PAT, wrong repo, etc.)
# and fail fast rather than waiting the full 60 minutes.
seen_status="false"
pending_ack_deadline=10 # iterations before we give up waiting for first status

for i in $(seq 1 120); do
RAW=$(gh api "repos/${{ github.repository }}/commits/${SHA}/status" \
-q '.statuses[] | select(.context == "SCOS Integration Tests") | .state' \
2>/dev/null | head -n 1 || true)

if [ -n "$RAW" ]; then
seen_status="true"
STATUS="$RAW"
else
STATUS="missing"
fi

if [ "$STATUS" = "success" ]; then
echo "SCOS tests passed"
exit 0
elif [ "$STATUS" = "failure" ] || [ "$STATUS" = "error" ]; then
echo "SCOS tests failed (state=$STATUS)"
exit 1
fi

if [ "$seen_status" = "false" ] && [ "$i" -ge "$pending_ack_deadline" ]; then
echo "No status received from SCOS after ${pending_ack_deadline} polls."
echo "This usually means the repository_dispatch did not reach SCOS."
echo "Check: SCOS_TRIGGER_PAT validity/scope, target repo, and that"
echo "SCOS's precommit.yml has repository_dispatch type 'snowpark-python-test'."
exit 1
fi

echo "Status: $STATUS - waiting 30s... (attempt $i/120)"
sleep 30
done

echo "Timeout waiting for SCOS tests"
exit 1
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading