feat: cross-account session continuation (closes #3) (#4) #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| # The important one: prove that a clean machine can install multi-cli from | |
| # scratch and immediately run its core commands. This is the check that would | |
| # have caught the install failure (missing jq / broken launcher). | |
| install-smoke: | |
| name: install + run (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Force the installer's own jq-resolution path: both runner images ship | |
| # jq pre-installed, so we remove it first. The installer must put jq back | |
| # (apt-get on Linux, brew on macOS) or the whole CLI is dead on arrival. | |
| - name: Remove pre-installed jq so the installer must provide it | |
| run: | | |
| if command -v apt-get >/dev/null 2>&1; then | |
| sudo apt-get remove -y jq || true | |
| elif command -v brew >/dev/null 2>&1; then | |
| brew uninstall --ignore-dependencies --force jq || true | |
| fi | |
| hash -r | |
| if command -v jq >/dev/null 2>&1; then | |
| echo "WARNING: jq still present at $(command -v jq); installer will detect-and-skip." | |
| else | |
| echo "jq removed; installer must reinstall it." | |
| fi | |
| - name: Install multi-cli from the working tree | |
| run: bash scripts/install.sh --local | |
| - name: jq is available after install | |
| run: | | |
| command -v jq | |
| jq --version | |
| # The launcher lands in ~/.local/bin (see install.sh BIN_LINK default). | |
| - name: doctor / tools / new must all exit 0 | |
| run: | | |
| export PATH="$HOME/.local/bin:$PATH" | |
| multi-cli doctor | |
| multi-cli tools | |
| multi-cli new codex/ciprofile | |
| # Shell correctness for every .sh and the main launcher. Run at error | |
| # severity: the current tree has only style-level warnings (SC2155 "declare | |
| # and assign separately" x24, SC2115 x1 in `multi-cli`) and zero errors, so | |
| # error severity keeps CI green while still failing on real bugs (parse | |
| # errors, undefined behavior, CRLF/SC1017, bad redirects, etc.). | |
| shellcheck: | |
| name: shellcheck | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install shellcheck | |
| run: sudo apt-get update -y && sudo apt-get install -y shellcheck | |
| - name: Lint shell scripts | |
| run: shellcheck --severity=error multi-cli scripts/install.sh scripts/uninstall.sh | |
| # PowerShell static analysis for the Windows scripts. Run at Error severity | |
| # and exclude the rules that flag accepted design choices, not bugs: | |
| # PSAvoidUsingConvertToSecureStringWithPlainText (Error-severity, fires on | |
| # multi-cli.ps1's credential handling) and PSUseShouldProcessForStateChanging- | |
| # Functions. Excluding these keeps CI green while still catching genuine | |
| # parse/syntax failures and other error-severity rules. | |
| pwsh-lint: | |
| name: PSScriptAnalyzer | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install PSScriptAnalyzer | |
| shell: pwsh | |
| run: | | |
| Set-PSRepository -Name PSGallery -InstallationPolicy Trusted | |
| Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser | |
| - name: Analyze PowerShell scripts | |
| shell: pwsh | |
| run: | | |
| $targets = @( | |
| 'scripts/install.ps1', | |
| 'scripts/uninstall.ps1', | |
| 'multi-cli.ps1' | |
| ) | |
| $excludedRules = @( | |
| 'PSAvoidUsingConvertToSecureStringWithPlainText', | |
| 'PSUseShouldProcessForStateChangingFunctions' | |
| ) | |
| $findings = foreach ($target in $targets) { | |
| Invoke-ScriptAnalyzer -Path $target -Severity Error -ExcludeRule $excludedRules | |
| } | |
| if ($findings) { | |
| $findings | Format-Table -AutoSize | Out-String | Write-Host | |
| throw "PSScriptAnalyzer reported $($findings.Count) error-severity finding(s)." | |
| } | |
| Write-Host "No error-severity findings." | |
| # The bash session-continuation suite (bats). Runs the REAL launcher against | |
| # real fixture trees on both Linux and macOS. bats-core and jq are fetched | |
| # fresh by the runner (never committed): jq via the system package manager, | |
| # bats-core via the system package manager when available, otherwise | |
| # tests/run-bats.sh clones the pinned v1.11.0 into tests/vendor on demand. | |
| bats: | |
| name: bats (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install bats + jq | |
| run: | | |
| if command -v apt-get >/dev/null 2>&1; then | |
| sudo apt-get update -y | |
| sudo apt-get install -y bats jq | |
| elif command -v brew >/dev/null 2>&1; then | |
| brew install bats-core jq | |
| else | |
| echo "no supported package manager (apt-get/brew) on this runner" >&2 | |
| exit 1 | |
| fi | |
| bats --version | |
| jq --version | |
| - name: Run the bats suite | |
| run: bash tests/run-bats.sh | |
| # The PowerShell session-continuation suite (Pester). Uses the Pester 3.4 | |
| # shipped with Windows PowerShell 5.1 (the suite is 3.4-compatible). The | |
| # PowerShell launcher parses JSON natively, so this suite needs no jq. | |
| pester: | |
| name: pester (windows-latest) | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Pester 3.4.0 (matches the 3.x-compatible suite) | |
| shell: powershell | |
| run: | | |
| Set-PSRepository -Name PSGallery -InstallationPolicy Trusted | |
| Install-PackageProvider -Name NuGet -Force -Scope CurrentUser | |
| Install-Module -Name Pester -RequiredVersion 3.4.0 -Force -SkipPublisherCheck -Scope CurrentUser | |
| - name: Run the Pester suite | |
| shell: powershell | |
| run: powershell -NoProfile -ExecutionPolicy Bypass -File tests/run-pester.ps1 |