fix: add shell and pm tests #141
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 | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| name: Tests (${{ matrix.os }}) | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/[email protected] | |
| - name: Set node version to 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org/ | |
| cache: 'pnpm' | |
| - name: Install deps | |
| run: pnpm install | |
| - name: Run core tests (excluding shell integration) | |
| run: pnpm vitest run --exclude "**/shell-integration.test.ts" | |
| shell-tests: | |
| name: Shell Tests (${{ matrix.shell }} on ${{ matrix.os }}) | |
| strategy: | |
| matrix: | |
| shell: [bash, zsh, fish, powershell] | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| exclude: | |
| # PowerShell installation can be flaky on macOS in CI | |
| - shell: powershell | |
| os: macos-latest | |
| # Some shells are not easily available on Windows | |
| - shell: zsh | |
| os: windows-latest | |
| - shell: fish | |
| os: windows-latest | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install shell dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| case "${{ matrix.shell }}" in | |
| bash) | |
| sudo apt-get install -y bash-completion | |
| ;; | |
| zsh) | |
| sudo apt-get install -y zsh | |
| ;; | |
| fish) | |
| sudo apt-get install -y fish | |
| ;; | |
| powershell) | |
| wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb | |
| sudo dpkg -i packages-microsoft-prod.deb | |
| sudo apt-get update | |
| sudo apt-get install -y powershell | |
| ;; | |
| esac | |
| - name: Install shell dependencies (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| case "${{ matrix.shell }}" in | |
| bash) | |
| brew install bash-completion@2 | |
| ;; | |
| zsh) | |
| # zsh is already installed on macOS | |
| echo "zsh already available" | |
| ;; | |
| fish) | |
| brew install fish | |
| ;; | |
| powershell) | |
| # Skip PowerShell on macOS for now due to CI flakiness | |
| echo "PowerShell skipped on macOS" | |
| ;; | |
| esac | |
| - name: Install shell dependencies (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| # Windows specific shell setup | |
| switch ("${{ matrix.shell }}") { | |
| "bash" { | |
| # Git for Windows includes bash | |
| if (!(Get-Command git -ErrorAction SilentlyContinue)) { | |
| choco install git -y | |
| } | |
| Write-Host "Bash available via Git for Windows" | |
| } | |
| "powershell" { | |
| # PowerShell is already installed on Windows | |
| Write-Host "PowerShell already available" | |
| } | |
| default { | |
| Write-Host "Shell ${{ matrix.shell }} not supported on Windows" | |
| } | |
| } | |
| - name: Verify shell installation (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| case "${{ matrix.shell }}" in | |
| bash) | |
| bash --version | |
| ;; | |
| zsh) | |
| zsh --version | |
| ;; | |
| fish) | |
| fish --version | |
| ;; | |
| powershell) | |
| pwsh --version | |
| ;; | |
| esac | |
| - name: Verify shell installation (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| switch ("${{ matrix.shell }}") { | |
| "bash" { | |
| bash --version | |
| } | |
| "powershell" { | |
| pwsh --version | |
| } | |
| default { | |
| Write-Host "Verification not needed for ${{ matrix.shell }} on Windows" | |
| } | |
| } | |
| - name: Install pnpm | |
| uses: pnpm/[email protected] | |
| - name: Set node version to 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org/ | |
| cache: 'pnpm' | |
| - name: Install deps | |
| run: pnpm install | |
| - name: Run shell-specific tests | |
| run: pnpm test tests/shell-integration.test.ts | |
| env: | |
| TEST_SHELL: ${{ matrix.shell }} | |
| typecheck: | |
| name: Lint and Type Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/[email protected] | |
| - name: Set node version to 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org/ | |
| cache: pnpm | |
| - name: Install deps | |
| run: pnpm install | |
| - name: Lint | |
| run: pnpm lint | |
| - name: Type-check | |
| run: pnpm type-check | |
| benchmark: | |
| name: Benchmarks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/[email protected] | |
| - name: Set node version to 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org/ | |
| cache: pnpm | |
| - name: Install deps | |
| run: pnpm install | |
| - name: Run benchmarks | |
| run: pnpm benchmark |