Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | name: Test Installation |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | tags: |
| 6 | # Temporary compatibility window: support both legacy v* and package-scoped CLI tags. |
| 7 | - 'v*' |
| 8 | - '@composio/cli@*' |
| 9 | # An installer-only change ships nothing through the TypeScript packages, so |
| 10 | # nothing else would lint or test it before it lands. Only the cheap |
| 11 | # ubuntu-only unit-test job runs here; the multi-OS matrix installs a |
| 12 | # published release and stays on the release path (a push to `next` reaches |
| 13 | # it through Build CLI Binaries, whose path filter covers these files too). |
| 14 | pull_request: |
| 15 | paths: |
| 16 | - 'install.sh' |
| 17 | - 'install.ps1' |
| 18 | - 'install/**' |
| 19 | - 'test/install-sh-*.test.sh' |
| 20 | - '.github/workflows/cli.test-installation.yml' |
| 21 | workflow_dispatch: |
| 22 | inputs: |
| 23 | version: |
| 24 | description: 'Version to test (e.g., 1.0.0 or @composio/cli@1.0.0)' |
| 25 | required: true |
| 26 | workflow_call: |
| 27 | inputs: |
| 28 | version: |
| 29 | description: 'Release tag or semver version to test' |
| 30 | required: false |
| 31 | default: 'latest' |
| 32 | type: string |
| 33 | windows: |
| 34 | description: "Set to 'false' when the release ships without the experimental Windows archive" |
| 35 | required: false |
| 36 | default: 'true' |
| 37 | type: string |
| 38 | |
| 39 | permissions: |
| 40 | contents: read |
| 41 | |
| 42 | jobs: |
| 43 | install-script-unit-tests: |
| 44 | name: Install Script Unit Tests |
| 45 | runs-on: ubuntu-latest |
| 46 | steps: |
| 47 | - name: Checkout |
| 48 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 49 | |
| 50 | - name: Test release resolution fallback |
| 51 | run: bash test/install-sh-release-resolution.test.sh |
| 52 | |
| 53 | - name: Test atomic install replacement |
| 54 | run: bash test/install-sh-atomic-replace.test.sh |
| 55 | |
| 56 | - name: Test documented uninstall snippet |
| 57 | run: bash test/install-sh-uninstall-snippet.test.sh |
| 58 | |
| 59 | - name: Lint POSIX install scripts |
| 60 | run: shellcheck -s sh install.sh install/*.sh |
| 61 | |
| 62 | test-install-script: |
| 63 | name: Test Install Script |
| 64 | needs: install-script-unit-tests |
| 65 | # The multi-OS matrix installs an already-published release, which a pull |
| 66 | # request cannot produce. Keep pull requests on the unit-test job only. |
| 67 | if: github.event_name != 'pull_request' |
| 68 | runs-on: ${{ matrix.os }} |
| 69 | strategy: |
| 70 | fail-fast: false |
| 71 | matrix: |
| 72 | include: |
| 73 | # Ubuntu x64 versions |
| 74 | - os: ubuntu-22.04 |
| 75 | name: 'Ubuntu 22.04 x64' |
| 76 | shell: bash |
| 77 | - os: ubuntu-22.04 |
| 78 | name: 'Ubuntu 22.04 x64 (zsh)' |
| 79 | shell: zsh |
| 80 | - os: ubuntu-latest |
| 81 | name: 'Ubuntu Latest x64' |
| 82 | shell: bash |
| 83 | |
| 84 | # Ubuntu ARM64 versions (using Depot) |
| 85 | - os: depot-ubuntu-24.04-arm |
| 86 | name: 'Ubuntu 24.04 ARM64' |
| 87 | shell: bash |
| 88 | - os: depot-ubuntu-22.04-arm |
| 89 | name: 'Ubuntu 22.04 ARM64' |
| 90 | shell: bash |
| 91 | - os: depot-ubuntu-22.04-arm |
| 92 | name: 'Ubuntu 22.04 ARM64 (zsh)' |
| 93 | shell: zsh |
| 94 | |
| 95 | # macOS versions |
| 96 | - os: macos-15-intel |
| 97 | name: 'macOS 15 (Intel)' |
| 98 | shell: bash |
| 99 | - os: macos-15-intel |
| 100 | name: 'macOS 15 (Intel, zsh)' |
| 101 | shell: zsh |
| 102 | - os: macos-26 |
| 103 | name: 'macOS 26 (Apple Silicon)' |
| 104 | shell: bash |
| 105 | - os: macos-15 |
| 106 | name: 'macOS 15 (Apple Silicon)' |
| 107 | shell: bash |
| 108 | - os: macos-15 |
| 109 | name: 'macOS 15 (Apple Silicon, zsh)' |
| 110 | shell: zsh |
| 111 | |
| 112 | steps: |
| 113 | - name: Checkout |
| 114 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 115 | |
| 116 | - name: Resolve and validate target release |
| 117 | id: release_target |
| 118 | shell: bash |
| 119 | env: |
| 120 | VERSION_INPUT: ${{ inputs.version }} |
| 121 | run: | |
| 122 | raw_input="$VERSION_INPUT" |
| 123 | if [[ -z "$raw_input" || "$raw_input" == "latest" ]]; then |
| 124 | echo "use_latest=true" >> "$GITHUB_OUTPUT" |
| 125 | echo "release_tag=" >> "$GITHUB_OUTPUT" |
| 126 | exit 0 |
| 127 | fi |
| 128 | |
| 129 | # For manual runs, accept a full package tag or semver and normalize to a package tag. |
| 130 | if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then |
| 131 | if [[ "$raw_input" =~ ^@composio/cli@ ]]; then |
| 132 | echo "use_latest=false" >> "$GITHUB_OUTPUT" |
| 133 | echo "release_tag=$raw_input" >> "$GITHUB_OUTPUT" |
| 134 | exit 0 |
| 135 | elif [[ "$raw_input" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then |
| 136 | echo "use_latest=false" >> "$GITHUB_OUTPUT" |
| 137 | echo "release_tag=@composio/cli@$raw_input" >> "$GITHUB_OUTPUT" |
| 138 | exit 0 |
| 139 | fi |
| 140 | echo "Invalid version: '$raw_input'" |
| 141 | echo "Expected format like: 1.2.3, 1.2.3-beta.1, 1.2.3+build.7, or @composio/cli@1.2.3" |
| 142 | exit 1 |
| 143 | fi |
| 144 | |
| 145 | # For workflow_call / push, accept a full package tag, semver, or legacy v* tag. |
| 146 | if [[ "$raw_input" =~ ^@composio/cli@ ]]; then |
| 147 | echo "use_latest=false" >> "$GITHUB_OUTPUT" |
| 148 | echo "release_tag=$raw_input" >> "$GITHUB_OUTPUT" |
| 149 | elif [[ "$raw_input" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then |
| 150 | echo "use_latest=false" >> "$GITHUB_OUTPUT" |
| 151 | echo "release_tag=@composio/cli@$raw_input" >> "$GITHUB_OUTPUT" |
| 152 | else |
| 153 | echo "use_latest=false" >> "$GITHUB_OUTPUT" |
| 154 | echo "release_tag=$raw_input" >> "$GITHUB_OUTPUT" |
| 155 | exit 0 |
| 156 | fi |
| 157 | |
| 158 | - name: Setup shell environment |
| 159 | run: | |
| 160 | if [[ "${{ matrix.shell }}" == "zsh" ]]; then |
| 161 | # Install zsh if not present |
| 162 | if ! command -v zsh &> /dev/null; then |
| 163 | if [[ "${{ runner.os }}" == "Linux" ]]; then |
| 164 | sudo apt-get update |
| 165 | sudo apt-get install -y zsh |
| 166 | elif [[ "${{ runner.os }}" == "macOS" ]]; then |
| 167 | # zsh is default on macOS |
| 168 | echo "zsh already available" |
| 169 | fi |
| 170 | fi |
| 171 | |
| 172 | # Create .zshrc if it doesn't exist |
| 173 | touch ~/.zshrc |
| 174 | |
| 175 | # Set zsh as the shell for this session |
| 176 | export SHELL=$(which zsh) |
| 177 | echo "SHELL=$(which zsh)" >> $GITHUB_ENV |
| 178 | else |
| 179 | # Ensure bash is available and create .bashrc |
| 180 | touch ~/.bashrc |
| 181 | export SHELL=$(which bash) |
| 182 | echo "SHELL=$(which bash)" >> $GITHUB_ENV |
| 183 | fi |
| 184 | |
| 185 | - name: Test install script |
| 186 | shell: bash |
| 187 | env: |
| 188 | # Empty exactly when the release target resolved to `use_latest=true`. |
| 189 | RELEASE_TAG: ${{ steps.release_target.outputs.release_tag }} |
| 190 | run: | |
| 191 | if [[ -n "$RELEASE_TAG" ]]; then |
| 192 | echo "Testing installation with version: ${RELEASE_TAG}" |
| 193 | sh install.sh "${RELEASE_TAG}" |
| 194 | else |
| 195 | echo "Testing installation with auto-detected latest CLI version..." |
| 196 | sh install.sh |
| 197 | fi |
| 198 | |
| 199 | # Verify installation |
| 200 | export PATH="$HOME/.local/bin:$PATH" |
| 201 | |
| 202 | # Check the bundle and entry point |
| 203 | if [[ -x "$HOME/.composio/composio" && -L "$HOME/.local/bin/composio" ]]; then |
| 204 | echo "✅ Bundle and entry point installed successfully" |
| 205 | ls -la "$HOME/.composio/composio" "$HOME/.local/bin/composio" |
| 206 | else |
| 207 | echo "❌ Bundle or entry point not found" |
| 208 | exit 1 |
| 209 | fi |
| 210 | |
| 211 | # Test binary execution |
| 212 | if "$HOME/.local/bin/composio" --version; then |
| 213 | echo "✅ Binary executes successfully" |
| 214 | else |
| 215 | echo "❌ Binary execution failed" |
| 216 | exit 1 |
| 217 | fi |
| 218 | |
| 219 | # The default (COMPOSIO_INSTALL_SHELL unset → auto) infers the target |
| 220 | # shell from $SHELL, which "Setup shell environment" exported for this |
| 221 | # matrix leg, so this no-argument install must persist a managed PATH |
| 222 | # block in that shell's startup file. |
| 223 | if [[ "${{ matrix.shell }}" == "zsh" ]]; then |
| 224 | config_file=~/.zshrc |
| 225 | else |
| 226 | config_file=~/.bashrc |
| 227 | fi |
| 228 | |
| 229 | if grep -Fqx '# Composio CLI' "$config_file" \ |
| 230 | && grep -Fqx 'export PATH="$HOME/.local/bin:$PATH"' "$config_file"; then |
| 231 | echo "✅ $config_file gained the managed Composio PATH block via automatic shell setup" |
| 232 | else |
| 233 | echo "❌ $config_file missing the managed Composio PATH block after the no-argument install" |
| 234 | echo "=== $config_file contents ===" |
| 235 | cat "$config_file" |
| 236 | exit 1 |
| 237 | fi |
| 238 | |
| 239 | - name: Test PATH integration |
| 240 | shell: bash |
| 241 | run: | |
| 242 | echo "Testing PATH integration with ${{ matrix.shell }}..." |
| 243 | |
| 244 | # The no-argument install above already configured this shell through |
| 245 | # the auto default; this exercises the CLI command directly and must |
| 246 | # stay idempotent on top of it. |
| 247 | COMPOSIO_BIN_DIR="$HOME/.local/bin" "$HOME/.composio/composio" install --shell "${{ matrix.shell }}" |
| 248 | |
| 249 | # Debug: Check what files exist and their contents |
| 250 | echo "=== DEBUGGING ===" |
| 251 | echo "Checking shell config files:" |
| 252 | ls -la ~/ | grep -E '\.(bash|zsh)' || echo "No shell config files found" |
| 253 | |
| 254 | if [[ -f ~/.bashrc ]]; then |
| 255 | echo "=== ~/.bashrc contents ===" |
| 256 | cat ~/.bashrc |
| 257 | fi |
| 258 | |
| 259 | if [[ -f ~/.zshrc ]]; then |
| 260 | echo "=== ~/.zshrc contents ===" |
| 261 | cat ~/.zshrc |
| 262 | fi |
| 263 | |
| 264 | echo "=== Installation directory ===" |
| 265 | ls -la ~/.composio/ || echo "~/.composio/ not found" |
| 266 | |
| 267 | echo "=== Current PATH before sourcing ===" |
| 268 | echo "$PATH" |
| 269 | |
| 270 | if [[ "${{ matrix.shell }}" == "zsh" ]]; then |
| 271 | if [[ -f ~/.zshrc ]]; then |
| 272 | echo "Testing interactive zsh startup..." |
| 273 | if zsh -ic 'echo "PATH after startup: $PATH"; command -v composio; composio --version; composio --help | head -5'; then |
| 274 | echo "✅ composio found in PATH via zsh" |
| 275 | else |
| 276 | echo "❌ composio not found in PATH via zsh" |
| 277 | exit 1 |
| 278 | fi |
| 279 | else |
| 280 | echo "❌ ~/.zshrc not found - install script failed to create it" |
| 281 | exit 1 |
| 282 | fi |
| 283 | else |
| 284 | if [[ -f ~/.bashrc ]]; then |
| 285 | echo "Testing interactive bash startup..." |
| 286 | if bash -ic 'echo "PATH after startup: $PATH"; command -v composio; composio --version; composio --help | head -5'; then |
| 287 | echo "✅ composio found in PATH via bash" |
| 288 | else |
| 289 | echo "❌ composio not found in PATH via bash" |
| 290 | exit 1 |
| 291 | fi |
| 292 | else |
| 293 | echo "❌ ~/.bashrc not found - install script failed to create it" |
| 294 | exit 1 |
| 295 | fi |
| 296 | fi |
| 297 | |
| 298 | - name: Test bundled support files |
| 299 | shell: bash |
| 300 | run: | |
| 301 | echo "Checking bundled support files..." |
| 302 | |
| 303 | install_dir="${COMPOSIO_INSTALL_DIR:-$HOME/.composio}" |
| 304 | release_tag=$(cat "$install_dir/release-tag.txt") |
| 305 | |
| 306 | platform=$(uname -ms) |
| 307 | case $platform in |
| 308 | 'Darwin x86_64') target=darwin-x64 ;; |
| 309 | 'Darwin arm64') target=darwin-aarch64 ;; |
| 310 | 'Linux aarch64' | 'Linux arm64') |
| 311 | target=linux-aarch64 ;; |
| 312 | 'Linux x86_64') target=linux-x64 ;; |
| 313 | *) echo "❌ Unsupported platform: $platform"; exit 1 ;; |
| 314 | esac |
| 315 | |
| 316 | if [[ $target = darwin-x64 ]]; then |
| 317 | if [[ $(sysctl -n sysctl.proc_translated 2>/dev/null) = 1 ]]; then |
| 318 | target=darwin-aarch64 |
| 319 | fi |
| 320 | fi |
| 321 | |
| 322 | archive_name="composio-$target.zip" |
| 323 | archive_url="https://github.com/ComposioHQ/composio/releases/download/$release_tag/$archive_name" |
| 324 | tmpdir="$(mktemp -d)" |
| 325 | trap 'rm -rf "$tmpdir"' EXIT |
| 326 | |
| 327 | curl --fail --silent --location --output "$tmpdir/$archive_name" "$archive_url" |
| 328 | |
| 329 | expected_paths="$( |
| 330 | unzip -Z1 "$tmpdir/$archive_name" \ |
| 331 | | grep -v '/$' \ |
| 332 | | sed "s#^composio-$target/##" \ |
| 333 | | grep -v '^composio$' \ |
| 334 | | sort |
| 335 | )" |
| 336 | |
| 337 | if [ -z "$expected_paths" ]; then |
| 338 | echo "❌ No bundled support files found in $archive_name" |
| 339 | exit 1 |
| 340 | fi |
| 341 | |
| 342 | missing="" |
| 343 | echo "$expected_paths" | while IFS= read -r relative_path; do |
| 344 | if [ -f "$install_dir/$relative_path" ]; then |
| 345 | echo "✅ Found $relative_path" |
| 346 | else |
| 347 | echo "MISSING:$relative_path" |
| 348 | fi |
| 349 | done > "$tmpdir/check_output" |
| 350 | |
| 351 | cat "$tmpdir/check_output" | grep -v '^MISSING:' || true |
| 352 | |
| 353 | missing="$(grep '^MISSING:' "$tmpdir/check_output" | sed 's/^MISSING://' || true)" |
| 354 | if [ -n "$missing" ]; then |
| 355 | printf '❌ Missing bundled support files after install:\n' >&2 |
| 356 | echo "$missing" | while IFS= read -r p; do |
| 357 | printf ' %s\n' "$p" >&2 |
| 358 | done |
| 359 | exit 1 |
| 360 | fi |
| 361 | |
| 362 | - name: Test shell config updates |
| 363 | run: | |
| 364 | # This assertion holds for every leg, whatever release it installs. |
| 365 | # install.sh always comes from this checkout, and it only trusts a |
| 366 | # delegated `composio install --shell` when delegated_setup_verified |
| 367 | # confirms the startup file byte-for-byte against its own rendering; |
| 368 | # otherwise it rewrites the block inline. An older published CLI can |
| 369 | # therefore never leave a legacy block behind. |
| 370 | echo "Checking shell configuration updates..." |
| 371 | |
| 372 | if [[ "${{ matrix.shell }}" == "zsh" ]]; then |
| 373 | config_file=~/.zshrc |
| 374 | else |
| 375 | config_file=~/.bashrc |
| 376 | fi |
| 377 | |
| 378 | if grep -Fqx '# Composio CLI' "$config_file"; then |
| 379 | echo "✅ $config_file updated with the Composio CLI marker" |
| 380 | else |
| 381 | echo "❌ $config_file not updated with the Composio CLI marker" |
| 382 | echo "=== $config_file contents ===" |
| 383 | cat "$config_file" |
| 384 | exit 1 |
| 385 | fi |
| 386 | |
| 387 | if grep -Fqx 'export PATH="$HOME/.local/bin:$PATH"' "$config_file"; then |
| 388 | echo "✅ $config_file updated with the installed binary directory" |
| 389 | else |
| 390 | echo "❌ $config_file PATH not updated" |
| 391 | echo "=== $config_file contents ===" |
| 392 | cat "$config_file" |
| 393 | exit 1 |
| 394 | fi |
| 395 | |
| 396 | # Automatic setup ran during the no-argument install and `composio |
| 397 | # install --shell` ran again afterwards: setup is idempotent, so the |
| 398 | # startup file must hold exactly one managed block. |
| 399 | marker_count=$(grep -Fcx '# Composio CLI' "$config_file" || true) |
| 400 | if [[ "$marker_count" == "1" ]]; then |
| 401 | echo "✅ $config_file contains exactly one managed Composio block" |
| 402 | else |
| 403 | echo "❌ $config_file contains $marker_count managed Composio blocks (expected 1)" |
| 404 | echo "=== $config_file contents ===" |
| 405 | cat "$config_file" |
| 406 | exit 1 |
| 407 | fi |
| 408 | |
| 409 | - name: Test custom install directory |
| 410 | shell: bash |
| 411 | env: |
| 412 | USE_LATEST: ${{ steps.release_target.outputs.use_latest }} |
| 413 | RELEASE_TAG: ${{ steps.release_target.outputs.release_tag }} |
| 414 | # Install-only step: it verifies custom install locations, so opt out |
| 415 | # of automatic shell setup instead of re-pointing the managed PATH |
| 416 | # block at the throwaway custom bin dir. |
| 417 | COMPOSIO_INSTALL_SHELL: none |
| 418 | run: | |
| 419 | echo "Testing custom install directory..." |
| 420 | |
| 421 | # Clean up previous installation |
| 422 | rm -rf ~/.composio /tmp/custom-composio /tmp/custom-composio-bin |
| 423 | |
| 424 | # Test with custom directory using the same version as the workflow |
| 425 | export COMPOSIO_INSTALL_DIR="/tmp/custom-composio" |
| 426 | export COMPOSIO_BIN_DIR="/tmp/custom-composio-bin" |
| 427 | if [[ "$USE_LATEST" == "true" ]]; then |
| 428 | sh install.sh |
| 429 | else |
| 430 | sh install.sh "${RELEASE_TAG}" |
| 431 | fi |
| 432 | |
| 433 | # Verify custom installation |
| 434 | if [[ -x "/tmp/custom-composio/composio" && -L "/tmp/custom-composio-bin/composio" ]]; then |
| 435 | echo "✅ Custom directory installation successful" |
| 436 | ls -la "/tmp/custom-composio/composio" "/tmp/custom-composio-bin/composio" |
| 437 | else |
| 438 | echo "❌ Custom directory installation failed" |
| 439 | exit 1 |
| 440 | fi |
| 441 | |
| 442 | # Test execution |
| 443 | if "/tmp/custom-composio-bin/composio" --version; then |
| 444 | echo "✅ Custom installation executes successfully" |
| 445 | else |
| 446 | echo "❌ Custom installation execution failed" |
| 447 | exit 1 |
| 448 | fi |
| 449 | |
| 450 | - name: Test uninstallation |
| 451 | run: | |
| 452 | echo "Testing uninstallation..." |
| 453 | |
| 454 | # Remove binary |
| 455 | rm -f ~/.local/bin/composio /tmp/custom-composio-bin/composio |
| 456 | rm -rf ~/.composio /tmp/custom-composio /tmp/custom-composio-bin |
| 457 | |
| 458 | # Check if binary is gone |
| 459 | if [[ ! -e "$HOME/.composio/composio" && ! -e "$HOME/.local/bin/composio" ]]; then |
| 460 | echo "✅ Bundle and entry point removed successfully" |
| 461 | else |
| 462 | echo "❌ Binary removal failed" |
| 463 | exit 1 |
| 464 | fi |
| 465 | |
| 466 | - name: Test error handling |
| 467 | shell: bash |
| 468 | run: | |
| 469 | echo "Testing error handling..." |
| 470 | |
| 471 | # Test with invalid version |
| 472 | if sh install.sh v999.999.999; then |
| 473 | echo "❌ Invalid version unexpectedly succeeded" |
| 474 | exit 1 |
| 475 | fi |
| 476 | echo "✅ Error handling works for invalid versions" |
| 477 | |
| 478 | test-architecture-detection: |
| 479 | name: Test Architecture Detection |
| 480 | # The multi-OS matrix installs an already-published release, which a pull |
| 481 | # request cannot produce. Keep pull requests on the unit-test job only. |
| 482 | if: github.event_name != 'pull_request' |
| 483 | runs-on: ${{ matrix.os }} |
| 484 | strategy: |
| 485 | fail-fast: false |
| 486 | matrix: |
| 487 | include: |
| 488 | - os: ubuntu-latest |
| 489 | arch: x64 |
| 490 | expected: 'Linux x64' |
| 491 | - os: depot-ubuntu-24.04-arm |
| 492 | arch: arm64 |
| 493 | expected: 'Linux ARM64' |
| 494 | - os: macos-15-intel |
| 495 | arch: x64 |
| 496 | expected: 'macOS x64' |
| 497 | - os: macos-15 |
| 498 | arch: arm64 |
| 499 | expected: 'macOS ARM64' |
| 500 | |
| 501 | steps: |
| 502 | - name: Checkout |
| 503 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 504 | |
| 505 | - name: Test architecture detection |
| 506 | run: | |
| 507 | echo "Testing architecture detection for: ${{ matrix.expected }}" |
| 508 | |
| 509 | platform=$(uname -ms) |
| 510 | echo "Detected platform: $platform" |
| 511 | |
| 512 | case $platform in |
| 513 | 'Darwin x86_64') |
| 514 | detected="macOS x64" |
| 515 | ;; |
| 516 | 'Darwin arm64') |
| 517 | detected="macOS ARM64" |
| 518 | ;; |
| 519 | 'Linux x86_64') |
| 520 | detected="Linux x64" |
| 521 | ;; |
| 522 | 'Linux aarch64'|'Linux arm64') |
| 523 | detected="Linux ARM64" |
| 524 | ;; |
| 525 | *) |
| 526 | echo "❌ Unknown platform: $platform" |
| 527 | exit 1 |
| 528 | ;; |
| 529 | esac |
| 530 | |
| 531 | if [[ "$detected" == "${{ matrix.expected }}" ]]; then |
| 532 | echo "✅ Correctly detected: $detected" |
| 533 | else |
| 534 | echo "❌ Detection mismatch: expected '${{ matrix.expected }}', got '$detected'" |
| 535 | exit 1 |
| 536 | fi |
| 537 | |
| 538 | test-prerequisites: |
| 539 | name: Test Prerequisites |
| 540 | # The multi-OS matrix installs an already-published release, which a pull |
| 541 | # request cannot produce. Keep pull requests on the unit-test job only. |
| 542 | if: github.event_name != 'pull_request' |
| 543 | runs-on: ${{ matrix.os }} |
| 544 | strategy: |
| 545 | fail-fast: false |
| 546 | matrix: |
| 547 | os: [ubuntu-latest, macos-15] |
| 548 | |
| 549 | steps: |
| 550 | - name: Checkout |
| 551 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 552 | |
| 553 | - name: Test required tools |
| 554 | run: | |
| 555 | echo "Testing required tools..." |
| 556 | |
| 557 | # Test curl |
| 558 | if command -v curl &> /dev/null; then |
| 559 | echo "✅ curl available" |
| 560 | curl --version | head -1 |
| 561 | else |
| 562 | echo "❌ curl not available" |
| 563 | exit 1 |
| 564 | fi |
| 565 | |
| 566 | # Test unzip |
| 567 | if command -v unzip &> /dev/null; then |
| 568 | echo "✅ unzip available" |
| 569 | unzip -v | head -1 |
| 570 | else |
| 571 | echo "❌ unzip not available" |
| 572 | exit 1 |
| 573 | fi |
| 574 | |
| 575 | - name: Test without prerequisites |
| 576 | run: | |
| 577 | echo "Testing error handling when prerequisites are missing..." |
| 578 | |
| 579 | # Create a version of the script that will fail prerequisite check |
| 580 | sed 's/command -v curl/command -v nonexistent-tool/' install.sh > test-install.sh |
| 581 | |
| 582 | if sh test-install.sh 2>&1 | grep -q "required to install"; then |
| 583 | echo "✅ Prerequisites check works" |
| 584 | else |
| 585 | echo "❌ Prerequisites check failed" |
| 586 | exit 1 |
| 587 | fi |
| 588 | |
| 589 | rm test-install.sh |
| 590 | |
| 591 | test-windows-installation: |
| 592 | name: Test Windows Installation |
| 593 | if: github.event_name != 'pull_request' && inputs.windows != 'false' |
| 594 | runs-on: windows-2025 |
| 595 | steps: |
| 596 | - name: Checkout |
| 597 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 598 | |
| 599 | - name: Install and verify published Windows release |
| 600 | shell: pwsh |
| 601 | env: |
| 602 | VERSION_INPUT: ${{ inputs.version || github.ref_name }} |
| 603 | COMPOSIO_CLI_TELEMETRY_DISABLED: '1' |
| 604 | COMPOSIO_GITHUB_API_TOKEN: ${{ github.token }} |
| 605 | run: | |
| 606 | $ErrorActionPreference = 'Stop' |
| 607 | if ($env:VERSION_INPUT -and $env:VERSION_INPUT -ne 'latest') { |
| 608 | $env:COMPOSIO_INSTALL_VERSION = $env:VERSION_INPUT |
| 609 | } |
| 610 | # The documented flow: pipe the script into Invoke-Expression. |
| 611 | Get-Content -Raw ./install.ps1 | Invoke-Expression |
| 612 | Remove-Item Env:COMPOSIO_GITHUB_API_TOKEN |
| 613 | $expectedVersion = (Get-Content -LiteralPath "$HOME/.composio/release-tag.txt" -Raw).Trim() -replace '^@composio/cli@', '' |
| 614 | $actualVersion = (& composio --version | Out-String).Trim() |
| 615 | if ($LASTEXITCODE -ne 0 -or $actualVersion -ne $expectedVersion) { |
| 616 | throw "Expected Windows CLI $expectedVersion, got $actualVersion" |
| 617 | } |
| 618 | & composio --help |
| 619 | if ($LASTEXITCODE -ne 0) { throw 'Installed Windows CLI help failed.' } |
| 620 | |
| 621 | summary: |
| 622 | name: Installation Test Summary |
| 623 | needs: |
| 624 | [ |
| 625 | install-script-unit-tests, |
| 626 | test-install-script, |
| 627 | test-architecture-detection, |
| 628 | test-prerequisites, |
| 629 | test-windows-installation, |
| 630 | ] |
| 631 | runs-on: ubuntu-latest |
| 632 | if: always() && github.event_name != 'pull_request' |
| 633 | |
| 634 | steps: |
| 635 | - name: Test Results Summary |
| 636 | run: | |
| 637 | echo "## Installation Test Results" >> $GITHUB_STEP_SUMMARY |
| 638 | echo "" >> $GITHUB_STEP_SUMMARY |
| 639 | |
| 640 | if [[ "${{ needs.install-script-unit-tests.result }}" == "success" ]]; then |
| 641 | echo "✅ **Install Script Unit Tests**: PASSED" >> $GITHUB_STEP_SUMMARY |
| 642 | else |
| 643 | echo "❌ **Install Script Unit Tests**: FAILED" >> $GITHUB_STEP_SUMMARY |
| 644 | fi |
| 645 | |
| 646 | if [[ "${{ needs.test-install-script.result }}" == "success" ]]; then |
| 647 | echo "✅ **Install Script Tests**: PASSED" >> $GITHUB_STEP_SUMMARY |
| 648 | else |
| 649 | echo "❌ **Install Script Tests**: FAILED" >> $GITHUB_STEP_SUMMARY |
| 650 | fi |
| 651 | |
| 652 | if [[ "${{ needs.test-architecture-detection.result }}" == "success" ]]; then |
| 653 | echo "✅ **Architecture Detection**: PASSED" >> $GITHUB_STEP_SUMMARY |
| 654 | else |
| 655 | echo "❌ **Architecture Detection**: FAILED" >> $GITHUB_STEP_SUMMARY |
| 656 | fi |
| 657 | |
| 658 | if [[ "${{ needs.test-prerequisites.result }}" == "success" ]]; then |
| 659 | echo "✅ **Prerequisites Check**: PASSED" >> $GITHUB_STEP_SUMMARY |
| 660 | else |
| 661 | echo "❌ **Prerequisites Check**: FAILED" >> $GITHUB_STEP_SUMMARY |
| 662 | fi |
| 663 | |
| 664 | echo "" >> $GITHUB_STEP_SUMMARY |
| 665 | echo "**Test Matrix Coverage:**" >> $GITHUB_STEP_SUMMARY |
| 666 | echo "- **Linux x64**: Ubuntu 22.04, Latest" >> $GITHUB_STEP_SUMMARY |
| 667 | echo "- **Linux ARM64**: Ubuntu 22.04, 24.04 (via Depot)" >> $GITHUB_STEP_SUMMARY |
| 668 | echo "- **macOS x64**: macOS 15 (Intel)" >> $GITHUB_STEP_SUMMARY |
| 669 | echo "- **macOS ARM64**: macOS 15, macOS 26 (Apple Silicon)" >> $GITHUB_STEP_SUMMARY |
| 670 | echo "- **Windows x64**: Windows Server 2025" >> $GITHUB_STEP_SUMMARY |
| 671 | echo "- **Shells**: Bash, Zsh, and PowerShell" >> $GITHUB_STEP_SUMMARY |
| 672 | |
| 673 | case "${{ needs.test-windows-installation.result }}" in |
| 674 | success) echo "✅ **Windows Installation**: PASSED" >> $GITHUB_STEP_SUMMARY ;; |
| 675 | skipped) echo "⏭️ **Windows Installation**: SKIPPED (release has no Windows archive)" >> $GITHUB_STEP_SUMMARY ;; |
| 676 | *) |
| 677 | echo "❌ **Windows Installation**: FAILED" >> $GITHUB_STEP_SUMMARY |
| 678 | exit 1 |
| 679 | ;; |
| 680 | esac |