@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
yml 170 lines 9.11 KB
Raw
1 name: CLI Install Health Check
2
3 on:
4 schedule:
5 - cron: '0 * * * *'
6 workflow_dispatch:
7
8 permissions:
9 contents: read # gh release list reads the published releases
10
11 jobs:
12 health-check:
13 name: Test CLI Installation
14 runs-on: ubuntu-latest
15 env:
16 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 steps:
18 # Resolve the newest PUBLISHED stable @composio/cli release — exactly what install.sh and
19 # the /releases/latest redirect (humans) resolve and download from.
20 #
21 # Drafts are excluded here, so this only ever resolves a fully-published release — an
22 # in-flight one stays invisible until its assets are verified and attached.
23 - name: Resolve newest published release
24 id: resolve
25 run: |
26 set -euo pipefail
27 tag=$(gh release list --repo "${{ github.repository }}" --limit 1000 --exclude-drafts --exclude-pre-releases --json tagName \
28 --jq '.[] | select(.tagName | startswith("@composio/cli@")) | .tagName' \
29 | sed -n '1p')
30 if [[ -z "$tag" ]]; then
31 echo "::error::No published @composio/cli release found"
32 exit 1
33 fi
34 echo "tag=${tag}" >> "$GITHUB_OUTPUT"
35 echo "Latest published release: ${tag}"
36
37 # Install the PINNED newest tag. This is the path that 404s when a release ships without
38 # assets. The no-arg `curl | sh` below is asset-aware and silently falls back to the
39 # previous good release, so it would stay green even when the newest release is broken —
40 # which is exactly why the previous canary never caught the recurring outage.
41 - name: Install newest stable (pinned — fails on a release with missing assets)
42 run: |
43 set -euo pipefail
44 # Install-only leg: this step's signal is asset availability, so it opts out of
45 # automatic shell setup with COMPOSIO_INSTALL_SHELL=none. Default-flow (auto)
46 # coverage stays with the no-arg leg below.
47 curl -fsSL https://composio.dev/install | COMPOSIO_INSTALL_SHELL=none sh -s -- "${{ steps.resolve.outputs.tag }}"
48 echo "$HOME/.local/bin" >> "$GITHUB_PATH"
49
50 - name: Verify pinned installation
51 run: |
52 set -euo pipefail
53 ls -la "$HOME/.composio" || true
54 test -x "$HOME/.composio/composio"
55 test -L "$HOME/.local/bin/composio"
56 which composio
57 composio --version
58
59 # Secondary: the default no-arg flow most users run, exactly as they run it — including
60 # automatic shell setup (the default infers the shell from $SHELL; the idempotent rc
61 # edit on this ephemeral runner is harmless). Asset-aware and self-healing, so it is a
62 # coverage net rather than the primary signal.
63 #
64 # This leg is also the canary for the auto shell-setup default itself: shell-setup
65 # failure is non-fatal in install.sh (exit 0 + warning), so without asserting the
66 # actual contract below, a broken default would install a working binary and still
67 # report green. SHELL=/bin/bash pins deterministic auto-resolution on this runner, and
68 # the assertions mirror cli.test-installation.yml's checks — the managed PATH block in
69 # ~/.bashrc, plus that a login shell can actually resolve the binary.
70 #
71 # COMPOSIO_BIN_DIR is pinned to a NON-default directory ($HOME/.composio-canary/bin)
72 # to isolate managed-PATH reachability: Ubuntu's skel ~/.profile already adds
73 # ~/.local/bin to PATH, and the ~/.bash_profile the installer seeds keeps sourcing
74 # ~/.profile — so with the default bin dir the login-shell probe below would find
75 # composio even if the managed block did nothing. No startup file but the managed
76 # block ever adds the canary dir, so resolving composio from it proves the block.
77 #
78 # Deployment coupling: like the production legs in cli.install-e2e.yml, this installs
79 # from the PRODUCTION installer (composio.dev/install), so the shell-setup assertions
80 # only pass once the auto-default ships there. This workflow is schedule/workflow_dispatch
81 # only (no pull_request trigger), so it never runs against a pre-deploy PR or branch.
82 - name: Install via default no-arg flow
83 run: |
84 set -euo pipefail
85 rm -f \
86 "$HOME/.local/bin/composio" \
87 "$HOME/.composio/composio" \
88 "$HOME/.composio/release-tag.txt" \
89 "$HOME/.composio/release-manifest.json" \
90 "$HOME/.composio/run-helpers-runtime.mjs" \
91 "$HOME/.composio/run-subagent-shared.mjs" \
92 "$HOME/.composio/run-subagent-acp.mjs" \
93 "$HOME/.composio/run-subagent-legacy.mjs" \
94 "$HOME/.composio/run-subagent-output-mcp.mjs" \
95 "$HOME/.composio/generation-runtime.mjs" \
96 "$HOME/.composio/execute-output-encoder-runtime.mjs"
97 rm -rf \
98 "$HOME/.composio/services" \
99 "$HOME/.composio/acp-adapters" \
100 "$HOME/.composio/local-tools-binaries"
101 # Torn down separately, and deliberately not part of the block above:
102 # test/release-workflow.test.ts pins that block against INSTALL.md's
103 # documented uninstall, and the canary bin dir is this workflow's own
104 # isolation directory rather than something a user would ever remove.
105 rm -rf "$HOME/.composio-canary"
106 curl -fsSL https://composio.dev/install | SHELL=/bin/bash COMPOSIO_BIN_DIR="$HOME/.composio-canary/bin" sh
107 test -x "$HOME/.composio/composio"
108 test -L "$HOME/.composio-canary/bin/composio"
109 "$HOME/.composio-canary/bin/composio" --version
110 # The pinned leg's default entry point was removed above and must stay
111 # absent: the canary bin dir is the only place this install may surface
112 # the binary, so nothing outside the managed block can resolve it.
113 test ! -e "$HOME/.local/bin/composio"
114
115 # Assert the auto shell-setup contract: the managed PATH block landed in ~/.bashrc.
116 if grep -Fqx '# Composio CLI' "$HOME/.bashrc" \
117 && grep -Fqx 'export PATH="$HOME/.composio-canary/bin:$PATH"' "$HOME/.bashrc"; then
118 echo "✅ ~/.bashrc gained the managed Composio PATH block via automatic shell setup"
119 else
120 echo "❌ ~/.bashrc missing the managed Composio PATH block after the no-argument install"
121 echo "=== ~/.bashrc contents ==="
122 cat "$HOME/.bashrc" || true
123 exit 1
124 fi
125
126 # Assert the login-mode startup file (the file a login bash actually reads —
127 # ~/.bashrc is not it) also carries the managed block. Mirrors install.sh's
128 # bash_login_path_file selection: first existing of ~/.bash_profile or
129 # ~/.bash_login, else the ~/.bash_profile the installer creates.
130 if [ ! -f "$HOME/.bash_profile" ] && [ -f "$HOME/.bash_login" ]; then
131 login_file="$HOME/.bash_login"
132 else
133 login_file="$HOME/.bash_profile"
134 fi
135 if grep -Fqx '# Composio CLI' "$login_file" \
136 && grep -Fqx 'export PATH="$HOME/.composio-canary/bin:$PATH"' "$login_file"; then
137 echo "✅ $login_file gained the managed Composio PATH block via automatic shell setup"
138 else
139 echo "❌ $login_file missing the managed Composio PATH block after the no-argument install"
140 echo "=== $login_file contents ==="
141 cat "$login_file" || true
142 exit 1
143 fi
144
145 # Assert a login shell actually resolves the binary through the MANAGED
146 # PATH block. env -i drops the step's inherited PATH (GITHUB_PATH from the
147 # pinned-tag step), and the non-default canary bin dir defeats the other
148 # leak: ~/.profile — which the installer-seeded ~/.bash_profile keeps
149 # sourcing — prepends ~/.local/bin, never $HOME/.composio-canary/bin. The
150 # probe therefore requires the resolved path to be the canary entry point.
151 # This mirrors the harness's assert_login_bash_path clean-environment probe.
152 resolved=$(env -i HOME="$HOME" PATH=/usr/bin:/bin bash -ilc 'command -v composio' || true)
153 if [ "$resolved" = "$HOME/.composio-canary/bin/composio" ] \
154 && env -i HOME="$HOME" PATH=/usr/bin:/bin bash -ilc 'composio --version'; then
155 echo "✅ composio resolves to the managed canary bin dir via a login bash shell"
156 else
157 echo "❌ composio did not resolve to \$HOME/.composio-canary/bin/composio via a login bash shell (got: ${resolved:-nothing})"
158 exit 1
159 fi
160
161 - name: Send Slack Notification (Failure)
162 if: failure()
163 uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
164 with:
165 webhook: ${{ secrets.SLACK_RELEASE_WEBHOOK_URL }}
166 webhook-type: incoming-webhook
167 payload: |
168 {
169 "text": "⚠️ CLI Install Health Check Failed!\n*Repository:* ${{ github.repository }}\n*Workflow:* ${{ github.workflow }}\n*Run:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\n*Commit:* ${{ github.sha }}"
170 }