diff --git a/.github/workflows/freebsd-test.yml b/.github/workflows/freebsd-test.yml new file mode 100644 index 00000000..ede9e6bc --- /dev/null +++ b/.github/workflows/freebsd-test.yml @@ -0,0 +1,82 @@ +name: FreeBSD Config Test + +on: + push: + branches: [ master, main ] + pull_request: + branches: [ master, main ] + +jobs: + test-freebsd: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Check Lua syntax + run: | + # Check if init.lua has valid Lua syntax + lua -l init.lua 2>&1 | head -20 || true + + - name: Validate shell scripts + run: | + # Validate shell scripts + sh -n install-freebsd.sh + sh -n check-freebsd.sh + sh -n uninstall-freebsd.sh + + - name: Check file structure + run: | + # Verify essential files exist + test -f README.md && echo "✓ README.md exists" + test -f init.lua && echo "✓ init.lua exists" + test -f install-freebsd.sh && echo "✓ install-freebsd.sh exists" + test -f check-freebsd.sh && echo "✓ check-freebsd.sh exists" + test -f uninstall-freebsd.sh && echo "✓ uninstall-freebsd.sh exists" + test -f Makefile && echo "✓ Makefile exists" + test -f lazy-lock.json && echo "✓ lazy-lock.json exists" + + - name: Check README format + run: | + # Verify README has essential sections + grep -q "kickstart.nvim-FreeBSD" README.md && echo "✓ README has correct title" + grep -q "FreeBSD" README.md && echo "✓ README mentions FreeBSD" + grep -q "install-freebsd.sh" README.md && echo "✓ README references install script" + + - name: Validate Makefile + run: | + # Check if Makefile syntax is valid + make -n help > /dev/null && echo "✓ Makefile is valid" + + config-validation: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Check for common config issues + run: | + # Check that treesitter config doesn't have hard-coded compiler paths + if grep -q "gcc" init.lua; then + echo "⚠ Warning: init.lua contains hardcoded 'gcc' reference" + fi + + # Check that Mason auto-install is disabled + if grep -q "lua_ls.*ensure_installed" init.lua; then + echo "✓ lua_ls auto-install is properly handled" + fi + + # Check treesitter build is disabled + if grep -q "build = false" init.lua; then + echo "✓ Treesitter build is disabled" + else + echo "⚠ Warning: Treesitter build might not be disabled" + fi + + - name: Lint shell scripts + run: | + # Simple shell script linting + for script in install-freebsd.sh check-freebsd.sh uninstall-freebsd.sh; do + echo "Checking $script..." + head -1 "$script" | grep -q "^#!/" && echo "✓ $script has shebang" + done diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..a02534a3 --- /dev/null +++ b/Makefile @@ -0,0 +1,36 @@ +.PHONY: help install check sync clean uninstall + +help: + @echo "kickstart.nvim-FreeBSD Makefile" + @echo "" + @echo "Available targets:" + @echo " make install - Install FreeBSD dependencies" + @echo " make check - Check if all dependencies are installed" + @echo " make sync - Start Neovim and sync plugins" + @echo " make clean - Clean Neovim cache and swap files" + @echo " make uninstall - Remove Neovim configuration" + @echo " make help - Show this help message" + +install: + @echo "Installing FreeBSD dependencies..." + sudo sh install-freebsd.sh + +check: + @echo "Checking dependencies..." + sh check-freebsd.sh + +sync: + @echo "Starting Neovim and syncing plugins..." + nvim +Lazy sync +q + +clean: + @echo "Cleaning Neovim cache..." + rm -rf ~/.local/share/nvim/swap + rm -rf ~/.local/state/nvim + @echo "Clean complete" + +uninstall: + @echo "Uninstalling Neovim configuration..." + sh uninstall-freebsd.sh + +.DEFAULT_GOAL := help diff --git a/check-freebsd.sh b/check-freebsd.sh new file mode 100644 index 00000000..c9984422 --- /dev/null +++ b/check-freebsd.sh @@ -0,0 +1,89 @@ +#!/bin/sh +# FreeBSD Health Check Script for kickstart.nvim +# Validates that all dependencies are properly installed + +set -e + +echo "=== FreeBSD Neovim Dependencies Health Check ===" +echo "" + +# Colors +GREEN='\033[0;32m' +RED='\033[0;31m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +check_cmd() { + local cmd=$1 + local name=$2 + + if command -v "$cmd" &> /dev/null; then + echo "${GREEN}✓${NC} $name is installed" + return 0 + else + echo "${RED}✗${NC} $name is NOT installed" + return 1 + fi +} + +check_pkg() { + local pkg=$1 + local name=$2 + + if pkg info -e "$pkg" > /dev/null 2>&1; then + echo "${GREEN}✓${NC} $name is installed" + return 0 + else + echo "${RED}✗${NC} $name is NOT installed" + return 1 + fi +} + +failed=0 + +echo "Checking core tools..." +check_cmd "nvim" "Neovim" || failed=$((failed+1)) +check_cmd "git" "Git" || failed=$((failed+1)) +check_cmd "gmake" "GNU Make (gmake)" || failed=$((failed+1)) +check_cmd "unzip" "Unzip" || failed=$((failed+1)) + +echo "" +echo "Checking development tools..." +check_pkg "llvm" "LLVM/Clang" || failed=$((failed+1)) +check_cmd "rg" "Ripgrep" || failed=$((failed+1)) +check_cmd "fd" "Fd" || failed=$((failed+1)) + +echo "" +echo "Checking syntax highlighting..." +check_cmd "tree-sitter" "Tree-sitter" || failed=$((failed+1)) + +echo "" +echo "Checking formatters..." +check_cmd "stylua" "Stylua" || failed=$((failed+1)) + +echo "" +echo "Checking optional tools..." +check_cmd "base64" "Base64" || echo "${YELLOW}!${NC} Base64 (optional) not found" +check_cmd "xclip" "Xclip (clipboard)" || echo "${YELLOW}!${NC} Xclip (optional) not found" + +echo "" +echo "Checking Neovim config..." +if [ -f "$HOME/.config/nvim/init.lua" ]; then + echo "${GREEN}✓${NC} Neovim config found at ~/.config/nvim/init.lua" +else + echo "${RED}✗${NC} Neovim config NOT found" + failed=$((failed+1)) +fi + +echo "" +if [ $failed -eq 0 ]; then + echo "${GREEN}All dependencies are installed!${NC}" + echo "" + echo "You can start Neovim with: nvim" + exit 0 +else + echo "${RED}$failed dependency/dependencies are missing.${NC}" + echo "" + echo "Install missing dependencies with: sudo sh install-freebsd.sh" + exit 1 +fi diff --git a/uninstall-freebsd.sh b/uninstall-freebsd.sh new file mode 100644 index 00000000..3be5cd99 --- /dev/null +++ b/uninstall-freebsd.sh @@ -0,0 +1,63 @@ +#!/bin/sh +# FreeBSD Uninstall Script for kickstart.nvim +# Cleanly removes the Neovim configuration + +set -e + +echo "=== Uninstalling kickstart.nvim-FreeBSD ===" +echo "" + +# Colors +RED='\033[0;31m' +YELLOW='\033[1;33m' +GREEN='\033[0;32m' +NC='\033[0m' # No Color + +# Confirmation +echo "${YELLOW}WARNING: This will delete your Neovim configuration!${NC}" +echo "The following will be removed:" +echo " - ~/.config/nvim" +echo " - ~/.local/share/nvim" +echo "" +read -p "Are you sure? (type 'yes' to confirm): " confirm + +if [ "$confirm" != "yes" ]; then + echo "Uninstall cancelled." + exit 0 +fi + +echo "" +echo "Uninstalling..." + +# Backup option +if [ -d "$HOME/.config/nvim" ]; then + echo "" + read -p "Create a backup before deleting? (y/n): " backup + if [ "$backup" = "y" ] || [ "$backup" = "Y" ]; then + backup_dir="$HOME/nvim-backup-$(date +%Y%m%d-%H%M%S)" + echo "Creating backup at $backup_dir..." + cp -r "$HOME/.config/nvim" "$backup_dir" + echo "${GREEN}✓ Backup created${NC}" + fi +fi + +# Remove config +echo "Removing ~/.config/nvim..." +rm -rf "$HOME/.config/nvim" + +# Remove plugin data +echo "Removing ~/.local/share/nvim..." +rm -rf "$HOME/.local/share/nvim" + +# Remove state +echo "Removing ~/.local/state/nvim..." +rm -rf "$HOME/.local/state/nvim" + +echo "" +echo "${GREEN}✓ Uninstall complete!${NC}" +echo "" +echo "To reinstall, run:" +echo " git clone https://github.com/YOUR_USERNAME/kickstart.nvim-freebsd.git ~/.config/nvim" +echo " cd ~/.config/nvim" +echo " sudo sh install-freebsd.sh" +echo " nvim +Lazy sync +q"