Skip to content
Open
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
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
workspace: [".", "setup"]
steps:
- uses: actions/checkout@v5

Expand All @@ -16,13 +19,18 @@ jobs:
bun-version: 1.2.12

- name: Install dependencies
working-directory: ${{ matrix.workspace }}
run: bun install

- name: Run tests
working-directory: ${{ matrix.workspace }}
run: bun test

prettier:
runs-on: ubuntu-latest
strategy:
matrix:
workspace: [".", "setup"]
steps:
- uses: actions/checkout@v5

Expand All @@ -31,13 +39,18 @@ jobs:
bun-version: latest

- name: Install dependencies
working-directory: ${{ matrix.workspace }}
run: bun install

- name: Run prettier check
working-directory: ${{ matrix.workspace }}
run: bun run format:check

typecheck:
runs-on: ubuntu-latest
strategy:
matrix:
workspace: [".", "setup"]
steps:
- uses: actions/checkout@v5

Expand All @@ -46,7 +59,48 @@ jobs:
bun-version: 1.2.12

- name: Install dependencies
working-directory: ${{ matrix.workspace }}
run: bun install

- name: Run TypeScript type check
working-directory: ${{ matrix.workspace }}
run: bun run typecheck

setup-build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: setup
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.12

- name: Install dependencies (setup)
run: bun install

- name: Build setup action
run: bun run build

- name: Verify dist files exist
run: |
if [ ! -f dist/index.js ]; then
echo "Error: dist/index.js not found"
exit 1
fi
if [ ! -f dist/index.js.map ]; then
echo "Error: dist/index.js.map not found"
exit 1
fi

- name: Check for uncommitted dist changes
run: |
if [ -n "$(git status --porcelain dist)" ]; then
echo "Error: Uncommitted changes in setup/dist/"
echo "Please run 'cd setup && bun run build' and commit the changes"
git status dist
git diff dist
exit 1
fi
206 changes: 206 additions & 0 deletions .github/workflows/test-setup-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
name: Test Setup Action

on:
pull_request:
paths:
- "setup/**"
- ".github/workflows/test-setup-action.yml"
push:
branches:
- main
paths:
- "setup/**"
- ".github/workflows/test-setup-action.yml"
workflow_dispatch:

jobs:
test-basic-install:
name: Test Basic Installation
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
version: [stable, latest, "2.0.1"]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Claude Code
id: setup
uses: ./setup
with:
version: ${{ matrix.version }}

- name: Verify Installation
run: |
echo "Cache hit: ${{ steps.setup.outputs.cache-hit }}"
echo "Version: ${{ steps.setup.outputs.version }}"
echo "Path: ${{ steps.setup.outputs.claude-path }}"

# Verify claude is in PATH
which claude

# Verify version command works
claude --version

# Verify the output path exists
if [ ! -f "${{ steps.setup.outputs.claude-path }}" ]; then
echo "Error: Claude executable not found at output path"
exit 1
fi

- name: Test Claude Code
run: |
# Test that Claude Code actually works
claude --help

test-with-plugins:
name: Test Plugin Installation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Claude Code with Plugins
id: setup
uses: ./setup
with:
version: stable
marketplaces: pleaseai/claude-code-plugins
plugins: nanobanana@pleaseai

- name: Verify Outputs
run: |
echo "Cache hit: ${{ steps.setup.outputs.cache-hit }}"
echo "Version: ${{ steps.setup.outputs.version }}"
echo "Marketplaces added: ${{ steps.setup.outputs.marketplaces_added }}"
echo "Plugins installed: ${{ steps.setup.outputs.plugins_installed }}"

# Verify at least one marketplace was added
if [ "${{ steps.setup.outputs.marketplaces_added }}" -lt 1 ]; then
echo "Error: No marketplaces were added"
exit 1
fi

# Verify plugin was installed
if [ -z "${{ steps.setup.outputs.plugins_installed }}" ]; then
echo "Error: No plugins were installed"
exit 1
fi

- name: List Installed Plugins
run: |
claude plugin list || true

test-cache:
name: Test Cache Functionality
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: First Installation (should miss cache)
id: first-install
uses: ./setup
with:
version: "2.0.1"

- name: Verify First Install
run: |
echo "First install cache hit: ${{ steps.first-install.outputs.cache-hit }}"
if [ "${{ steps.first-install.outputs.cache-hit }}" == "true" ]; then
echo "Warning: Expected cache miss on first install, but got cache hit"
fi

- name: Remove Claude from PATH
run: |
# Clear the installation to simulate fresh run
rm -rf ~/.local/bin/claude ~/.claude

- name: Second Installation (should hit cache)
id: second-install
uses: ./setup
with:
version: "2.0.1"

- name: Verify Second Install
run: |
echo "Second install cache hit: ${{ steps.second-install.outputs.cache-hit }}"

# Verify Claude still works after cache restore
claude --version

echo "Cache test completed successfully"

test-multiple-plugins:
name: Test Multiple Plugins
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup with Multiple Plugins
id: setup
uses: ./setup
with:
version: stable
marketplaces: |
pleaseai/claude-code-plugins
passionfactory
plugins: |
nanobanana@pleaseai
dev-tools@passionfactory

- name: Verify Multiple Plugins
run: |
echo "Marketplaces added: ${{ steps.setup.outputs.marketplaces_added }}"
echo "Plugins installed: ${{ steps.setup.outputs.plugins_installed }}"

# Should have added 2 marketplaces
if [ "${{ steps.setup.outputs.marketplaces_added }}" -lt 2 ]; then
echo "Error: Expected at least 2 marketplaces"
exit 1
fi

# Should have installed 2 plugins
plugin_count=$(echo "${{ steps.setup.outputs.plugins_installed }}" | tr ',' '\n' | wc -l)
if [ "$plugin_count" -lt 2 ]; then
echo "Error: Expected at least 2 plugins, got $plugin_count"
exit 1
fi

test-error-handling:
name: Test Error Handling
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Test Invalid Version (should fail gracefully)
id: invalid-version
uses: ./setup
continue-on-error: true
with:
version: "999.999.999"

- name: Verify Error Handling
run: |
if [ "${{ steps.invalid-version.outcome }}" == "success" ]; then
echo "Error: Invalid version should have failed"
exit 1
fi
echo "Error handling test passed"

- name: Test Invalid Plugin (should continue)
id: invalid-plugin
uses: ./setup
with:
version: stable
marketplaces: pleaseai/claude-code-plugins
plugins: nonexistent-plugin-that-does-not-exist@pleaseai

- name: Verify Installation Still Works
run: |
# Even if plugin install fails, Claude Code should be installed
claude --version
echo "Partial failure handling test passed"
3 changes: 3 additions & 0 deletions setup/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
*.log
.DS_Store
1 change: 1 addition & 0 deletions setup/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading