diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3049e90..ed227e2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,3 +48,28 @@ jobs: test -L ~/.gitconfig - name: Verify vim-plug run: test -f ~/.vim/autoload/plug.vim + + opensuse: + runs-on: ubuntu-latest + container: + image: opensuse/tumbleweed + steps: + - uses: actions/checkout@v4 + - name: Install prerequisites + run: zypper install -y curl sudo tar gzip + - name: Install dotfiles + run: yes "" 2>/dev/null | CI=true LOCAL_INSTALL=1 SKIP_DOCKER=1 MISE_HTTP_TIMEOUT=120 bash install.sh || true + - name: Verify mise + run: | + eval "$(~/.local/bin/mise activate bash)" + mise current ruby + mise current node + - name: Verify symlinks + run: | + test -L ~/.aliases + test -L ~/.zshrc + test -L ~/.vimrc + test -L ~/.tmux.conf + test -L ~/.gitconfig + - name: Verify vim-plug + run: test -f ~/.vim/autoload/plug.vim diff --git a/install.sh b/install.sh index 4f123ba..b5c9e86 100755 --- a/install.sh +++ b/install.sh @@ -17,14 +17,35 @@ if [ -z "${LOCAL_INSTALL:-}" ]; then if ! command -v git > /dev/null 2>&1; then case "$(uname -s)" in Linux) - sudo apt-get update - sudo apt-get install -y git + if grep -q "^ID=ubuntu" /etc/os-release 2>/dev/null; then + sudo apt-get update + sudo apt-get install -y git + elif grep -qE "^ID.*opensuse" /etc/os-release 2>/dev/null; then + sudo zypper refresh + sudo zypper install -y git + fi ;; esac fi git clone --depth=10 https://github.com/campuscode/cc_dotfiles.git "$HOME/.cc_dotfiles" else echo "Installing from local source" + if ! command -v rsync > /dev/null 2>&1; then + case "$(uname -s)" in + Linux) + if grep -q "^ID=ubuntu" /etc/os-release 2>/dev/null; then + sudo apt-get update + sudo apt-get install -y rsync + elif grep -qE "^ID.*opensuse" /etc/os-release 2>/dev/null; then + sudo zypper refresh + sudo zypper install -y rsync + fi + ;; + Darwin) + # rsync is pre-installed on macOS + ;; + esac + fi rsync -a --no-perms --exclude='.vagrant' --exclude='tags' --exclude='vim/autoload' --exclude='vim/bundle' --exclude='vim/backups' . "$HOME/.cc_dotfiles" curl -fLo "$HOME/.cc_dotfiles/vim/autoload/plug.vim" --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim @@ -32,7 +53,14 @@ fi case "$(uname -s)" in Linux) - bash "$HOME/.cc_dotfiles/ubuntu.sh" + if grep -q "^ID=ubuntu" /etc/os-release 2>/dev/null; then + bash "$HOME/.cc_dotfiles/ubuntu.sh" + elif grep -qE "^ID.*opensuse" /etc/os-release 2>/dev/null; then + bash "$HOME/.cc_dotfiles/opensuse.sh" + else + echo "Linux distribution not supported. Supported: Ubuntu, OpenSUSE" + exit 1 + fi ;; Darwin) bash "$HOME/.cc_dotfiles/mac.sh" diff --git a/opensuse.sh b/opensuse.sh new file mode 100644 index 0000000..86bdab0 --- /dev/null +++ b/opensuse.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +install_system_deps() { + echo " - Installing system dependencies" + + sudo zypper refresh + + # Install basic tools + sudo zypper install -y \ + dconf \ + util-linux \ + git \ + xclip \ + zsh \ + vim \ + tmux \ + fontconfig + + # Add Base:System repo for libpcre1 and utilities repo for silver searcher + sudo zypper addrepo https://download.opensuse.org/repositories/Base:/System/openSUSE_Tumbleweed/Base:System.repo || true + sudo zypper addrepo https://download.opensuse.org/repositories/utilities/openSUSE_Factory/utilities.repo || true + sudo zypper --gpg-auto-import-keys refresh + + # Install PCRE library (required by silver searcher) and silver searcher + sudo zypper install -y libpcre1 the_silver_searcher || true + + # Install development tools + sudo zypper install -y \ + patterns-devel-base-devel_basis \ + gcc \ + gcc-c++ + + # Install development libraries for Ruby/Node.js + sudo zypper install -y \ + libevent-devel \ + ncurses-devel \ + bison \ + pkg-config \ + libopenssl-devel \ + readline-devel \ + zlib-devel \ + libyaml-devel \ + libffi-devel +} + +install_gnome_terminal_colors() { + if [[ -z "${TERMINAL}" ]]; then + TERMINAL=gnome-terminal bash -c "$(curl -sSLo- https://raw.githubusercontent.com/Mayccoll/Gogh/master/gogh.sh)" + else + bash -c "$(curl -sSLo- https://raw.githubusercontent.com/Mayccoll/Gogh/master/gogh.sh)" + fi +} + +install_docker() { + # Remove old Docker versions + sudo zypper remove -y docker docker-engine + + # Add Docker repository + # OpenSUSE uses the SLES Docker repository + sudo zypper addrepo https://download.docker.com/linux/sles/docker-ce.repo + sudo zypper refresh + + # Install Docker packages + sudo zypper install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin + + # Enable and start Docker service + sudo systemctl enable docker + sudo systemctl start docker + + # Add user to docker group + sudo usermod -aG docker "$(whoami)" +} + +install_system_deps + +if [ -z "${CI:-}" ]; then + install_gnome_terminal_colors +fi + +if [ "${SKIP_DOCKER:-}" != "1" ]; then + install_docker +fi + +sudo zypper clean diff --git a/tests/test_opensuse.sh b/tests/test_opensuse.sh new file mode 100755 index 0000000..dcfd091 --- /dev/null +++ b/tests/test_opensuse.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# Test cc_dotfiles installation on OpenSUSE using Docker +# +# Requires: Docker (https://www.docker.com) +# +# Usage: +# ./tests/test_opensuse.sh # run tests in OpenSUSE container +# ./tests/test_opensuse.sh interactive # run interactive shell in container + +set -eu + +PROJECT_DIR="$(cd "$(dirname "$0")/.." && pwd)" +IMAGE="opensuse/tumbleweed" + +if [ "${1:-}" = "interactive" ]; then + echo "Starting interactive OpenSUSE container..." + echo "Run: cd /workspace && LOCAL_INSTALL=1 CI=true bash install.sh" + docker run -it --rm -v "$PROJECT_DIR":/workspace -w /workspace "$IMAGE" /bin/bash + exit 0 +fi + +echo "Testing cc_dotfiles on OpenSUSE Tumbleweed..." +echo "Project directory: $PROJECT_DIR" +echo "" + +docker run --rm -v "$PROJECT_DIR":/workspace -w /workspace "$IMAGE" /bin/bash -c ' + set -eu + echo "=== Installing prerequisites ===" + zypper install -y curl sudo + + echo "" + echo "=== Running dotfiles installation ===" + # Use yes to auto-answer any prompts (like vim errors) + yes "" 2>/dev/null | LOCAL_INSTALL=1 CI=true SKIP_DOCKER=1 bash install.sh || true + + echo "" + echo "=== Verifying installation ===" + + # Check symlinks + test -L ~/.aliases && echo "✓ ~/.aliases symlink created" || echo "✗ ~/.aliases missing" + test -L ~/.zshrc && echo "✓ ~/.zshrc symlink created" || echo "✗ ~/.zshrc missing" + test -L ~/.vimrc && echo "✓ ~/.vimrc symlink created" || echo "✗ ~/.vimrc missing" + test -L ~/.tmux.conf && echo "✓ ~/.tmux.conf symlink created" || echo "✗ ~/.tmux.conf missing" + test -L ~/.gitconfig && echo "✓ ~/.gitconfig symlink created" || echo "✗ ~/.gitconfig missing" + + # Check vim-plug + test -f ~/.vim/autoload/plug.vim && echo "✓ vim-plug installed" || echo "✗ vim-plug missing" + + # Check mise + test -f ~/.local/bin/mise && echo "✓ mise installed" || echo "✗ mise missing" + + # Check tools + command -v git >/dev/null && echo "✓ git installed" || echo "✗ git missing" + command -v tmux >/dev/null && echo "✓ tmux installed" || echo "✗ tmux missing" + command -v vim >/dev/null && echo "✓ vim installed" || echo "✗ vim missing" + command -v ag >/dev/null && echo "✓ ag (silver searcher) installed" || echo "✗ ag missing" + command -v zsh >/dev/null && echo "✓ zsh installed" || echo "✗ zsh missing" + + # Check vim clipboard support + vim --version | grep -q "+clipboard" && echo "✓ vim has clipboard support" || echo "✗ vim missing clipboard support" + + echo "" + echo "=== Test completed ===" +' + +echo "" +echo "Done! All tests completed." +echo "" +echo "To run an interactive test session, use:" +echo " ./tests/test_opensuse.sh interactive"