Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 138 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
test:
name: Tests
name: Tests (${{ matrix.os }})
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
Expand All @@ -33,8 +33,143 @@ jobs:
- name: Install deps
run: pnpm install

- name: Run tests
run: pnpm test
- 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)
# PowerShell Core is pre-installed on GitHub Actions runners
echo "PowerShell Core already available"
;;
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: powershell
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 Core is pre-installed on GitHub Actions runners
Write-Host "PowerShell Core 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: powershell
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/action-setup@v4.0.0

- 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
Expand Down
1 change: 1 addition & 0 deletions src/bash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,6 @@ __${nameForVar}_complete() {

# Register completion function
complete -F __${nameForVar}_complete ${name}

`;
}
Loading
Loading