Skip to content

Simplify installation: use needlectl only, install to ~/.needle #2

Simplify installation: use needlectl only, install to ~/.needle

Simplify installation: use needlectl only, install to ~/.needle #2

name: Test Installation Scripts
on:
push:
branches: [main]
paths:
- 'scripts/*.sh'
- '.github/workflows/test-installation.yaml'
pull_request:
branches: [main]
paths:
- 'scripts/*.sh'
workflow_dispatch:
jobs:
test-install:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
config: [fast]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Docker (macOS)
if: runner.os == 'macOS'
run: |
brew install docker docker-compose
# Note: Docker daemon doesn't run on GitHub Actions macOS
# We'll skip Docker-dependent tests on macOS
- name: Test install script syntax
run: |
bash -n scripts/install.sh
bash -n scripts/install-oneliner.sh
bash -n scripts/uninstall.sh
echo "All scripts pass syntax check"
- name: Test dependency detection (Linux)
if: runner.os == 'Linux'
run: |
# Test the dependency checks in the install script
echo "Testing dependency detection..."
# Check Python
python3 --version
# Check Docker
docker --version
docker compose version
# Check Git
git --version
echo "All dependencies detected"
- name: Test dependency detection (macOS)
if: runner.os == 'macOS'
run: |
echo "Testing dependency detection on macOS..."
# Check Python
python3 --version
# Check Git
git --version
echo "Basic dependencies detected (Docker not available on macOS runners)"
- name: Test install script (Linux - full)
if: runner.os == 'Linux'
run: |
echo "Running full installation test on Linux..."
# Run the install script in fast mode
# Skip needlectl binary installation (requires sudo)
# and skip Docker services (will test separately)
./scripts/install.sh fast 2>&1 || true
# Check if key files were created
if [ -f "start-needle.sh" ]; then
echo "✓ start-needle.sh created"
else
echo "✗ start-needle.sh not created"
fi
if [ -f "stop-needle.sh" ]; then
echo "✓ stop-needle.sh created"
else
echo "✗ stop-needle.sh not created"
fi
if [ -f "status-needle.sh" ]; then
echo "✓ status-needle.sh created"
else
echo "✗ status-needle.sh not created"
fi
if [ -d "backend/venv" ]; then
echo "✓ Backend virtual environment created"
else
echo "✗ Backend virtual environment not created"
fi
- name: Test install script (macOS - partial)
if: runner.os == 'macOS'
run: |
echo "Running partial installation test on macOS..."
echo "Note: Docker is not available on GitHub Actions macOS runners"
echo "Testing script logic and Python environment setup..."
# Test that the script starts correctly and detects macOS
timeout 30 ./scripts/install.sh fast 2>&1 || true
# The script will fail at Docker check, but we can verify
# that it correctly detected macOS and Python
echo "macOS installation script test completed"
- name: Test one-liner script parsing
run: |
echo "Testing one-liner script can be parsed..."
# Test that the script can be sourced without the BASH_SOURCE error
# by simulating what happens when piped
cat scripts/install-oneliner.sh | bash -n
echo "One-liner script parsing test passed"
test-oneliner:
runs-on: ubuntu-latest
steps:
- name: Test one-liner download
run: |
echo "Testing one-liner script download..."
# Download the script
curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/main/scripts/install-oneliner.sh -o /tmp/install-needle.sh
# Check syntax
bash -n /tmp/install-needle.sh
echo "One-liner download and syntax check passed"