@devries-cameron20 / composio Mirror · read-only
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 03:37 UTC

next
sh 64 lines 2.51 KB
Raw
1 #!/usr/bin/env bash
2 #
3 # Loud failure gate: assert the full canonical asset set is attached to the release AND fully
4 # uploaded (state == "uploaded"). An asset can appear in the listing while still processing,
5 # which is exactly how a release ends up serving 404s — so require state == "uploaded", with a
6 # bounded retry while uploads settle.
7 #
8 # Inputs (env): RELEASE_TAG, GH_TOKEN
9 # WINDOWS_VERIFIED (optional): "false" when the experimental Windows build failed
10 # its native checks, so the release ships without the Windows archive
11 # VERIFY_ATTEMPTS / VERIFY_SLEEP_SECONDS (optional, for fast tests)
12 set -euo pipefail
13
14 # Keep this list in lock-step with build-cli-binaries.yml and cli.windows.yml (5 platforms)
15 # plus the skill bundle and checksums. Adding a platform to the matrix must extend this list.
16 expected=(
17 composio-linux-x64.zip
18 composio-linux-aarch64.zip
19 composio-darwin-x64.zip
20 composio-darwin-aarch64.zip
21 composio-skill.zip
22 checksums.txt
23 )
24 if [[ "${WINDOWS_VERIFIED:-true}" != "false" ]]; then
25 expected+=(composio-windows-x64.zip)
26 fi
27
28 attempts="${VERIFY_ATTEMPTS:-10}"
29 sleep_seconds="${VERIFY_SLEEP_SECONDS:-15}"
30
31 for attempt in $(seq 1 "$attempts"); do
32 # Single snapshot per attempt — querying names and state separately would open a
33 # time-of-check/time-of-use gap in the very gate meant to close one.
34 payload=$(gh release view "$RELEASE_TAG" --json assets)
35 uploaded=$(jq -r '.assets[] | select(.state == "uploaded") | .name' <<<"$payload" | sort)
36
37 missing=()
38 for want in "${expected[@]}"; do
39 printf '%s\n' "$uploaded" | grep -qxF "$want" || missing+=("$want")
40 done
41
42 # An asset outside the expected set is not covered by checksums.txt, for example a Windows
43 # archive left on a resumed draft. Waiting cannot fix that, so fail at once.
44 unexpected=()
45 while IFS= read -r have; do
46 [[ -z "$have" ]] || printf '%s\n' "${expected[@]}" | grep -qxF "$have" || unexpected+=("$have")
47 done < <(jq -r '.assets[].name' <<<"$payload")
48 if [[ ${#unexpected[@]} -gt 0 ]]; then
49 echo "::error::Release $RELEASE_TAG has unexpected assets: ${unexpected[*]}"
50 exit 1
51 fi
52
53 if [[ ${#missing[@]} -eq 0 ]]; then
54 echo "✅ All ${#expected[@]} expected assets present and uploaded."
55 exit 0
56 fi
57
58 echo "Attempt ${attempt}/${attempts} — missing or not-yet-uploaded: ${missing[*]}"
59 if [[ "$attempt" -eq "$attempts" ]]; then
60 echo "::error::Release $RELEASE_TAG is incomplete — missing or not uploaded: ${missing[*]}"
61 exit 1
62 fi
63 sleep "$sleep_seconds"
64 done