diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..768a529 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,81 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + validate-chezmoi: + name: Validate chezmoi configuration + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install chezmoi + run: | + sh -c "$(curl -fsLS get.chezmoi.io)" -- -b /usr/local/bin + chezmoi --version + + - name: Initialize chezmoi with test data + run: | + # Create a test config directory + export CHEZMOI_SOURCE_DIR="${{ github.workspace }}/home" + export CHEZMOI_DEST_DIR="/tmp/chezmoi-test-dest" + + # Create test .chezmoi.toml.yaml with all required variables + mkdir -p ~/.config/chezmoi + cat > ~/.config/chezmoi/chezmoi.toml << EOF + [data] + name = "CI Test User" + email = "ci@example.com" + editor = "vim" + installZsh = false + installPython = false + installNode = false + installNeovim = false + installCliTools = false + installTmux = false + installDirenv = false + installLspServers = false + installOpencode = false + installNerdFonts = false + installStarship = false + opencodeClaudeMax = false + opencodeClaude = false + opencodeChatgpt = false + opencodeGemini = false + pythonVersion = "3.12" + nodeVersion = "22" + secretsPath = "" + generateSshKey = false + sshKeyType = "ed25519" + + [git] + autoCommit = false + autoPush = false + EOF + + - name: Validate template syntax + run: | + # Initialize chezmoi with the source directory + chezmoi init --source="${{ github.workspace }}/home" + + # Try to apply in dry-run mode to validate all templates + echo "Running chezmoi apply --dry-run to validate configuration..." + chezmoi apply --dry-run --verbose + + - name: Verify chezmoi data + run: | + echo "Verifying chezmoi data variables..." + chezmoi data + + - name: Summary + run: | + echo "✅ All chezmoi configuration checks passed!"