diff --git a/Formula/glint.rb b/Formula/glint.rb new file mode 100644 index 0000000..7aa2efb --- /dev/null +++ b/Formula/glint.rb @@ -0,0 +1,29 @@ +class Glint < Formula + desc "Local linter and validator for .gitlab-ci.yml pipelines" + homepage "https://git.k3nny.fr/k3nny/glint" + url "https://git.k3nny.fr/k3nny/glint/archive/v0.3.1.tar.gz" + # Update sha256 on each release: sha256sum glint-vX.Y.Z.tar.gz + sha256 "" + license "Apache-2.0" + head "https://git.k3nny.fr/k3nny/glint.git", branch: "main" + + depends_on "go" => :build + + def install + system "go", "build", + "-ldflags", "-X main.version=#{version}", + "-o", bin/"glint", + "./cmd/glint/..." + end + + test do + assert_match version.to_s, shell_output("#{bin}/glint --version") + (testpath/".gitlab-ci.yml").write <<~YAML + stages: [build] + build-job: + stage: build + script: echo ok + YAML + system bin/"glint", "check", ".gitlab-ci.yml" + end +end diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..f86a371 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,139 @@ +# Installing glint + +## Requirements + +- Go 1.21 or later (for building from source) +- Any 64-bit Linux, macOS, or Windows system (for pre-built binaries) + +--- + +## Option 1 — Build from source + +```bash +git clone https://git.k3nny.fr/k3nny/glint +cd glint +go build -o glint ./cmd/glint/... +sudo mv glint /usr/local/bin/ +``` + +Or with [Task](https://taskfile.dev): + +```bash +task build +sudo mv glint /usr/local/bin/ +``` + +--- + +## Option 2 — Download a pre-built binary + +Pre-built binaries are attached to each [release](https://git.k3nny.fr/k3nny/glint/releases). + +| Platform | File | +|----------|------| +| Linux x86-64 | `glint-vX.Y.Z-linux-amd64` | +| Linux ARM64 | `glint-vX.Y.Z-linux-arm64` | +| macOS Intel | `glint-vX.Y.Z-darwin-amd64` | +| macOS Apple Silicon | `glint-vX.Y.Z-darwin-arm64` | +| Windows x86-64 | `glint-vX.Y.Z-windows-amd64.exe` | + +### Linux (amd64) + +```bash +VERSION=v0.3.1 +curl -Lo glint https://git.k3nny.fr/k3nny/glint/releases/download/${VERSION}/glint-${VERSION}-linux-amd64 +chmod +x glint +sudo mv glint /usr/local/bin/ +``` + +### Linux (ARM64 — Raspberry Pi 4, AWS Graviton, …) + +```bash +VERSION=v0.3.1 +curl -Lo glint https://git.k3nny.fr/k3nny/glint/releases/download/${VERSION}/glint-${VERSION}-linux-arm64 +chmod +x glint +sudo mv glint /usr/local/bin/ +``` + +### macOS (Apple Silicon — M1/M2/M3) + +```bash +VERSION=v0.3.1 +curl -Lo glint https://git.k3nny.fr/k3nny/glint/releases/download/${VERSION}/glint-${VERSION}-darwin-arm64 +chmod +x glint +sudo mv glint /usr/local/bin/ +``` + +### macOS (Intel) + +```bash +VERSION=v0.3.1 +curl -Lo glint https://git.k3nny.fr/k3nny/glint/releases/download/${VERSION}/glint-${VERSION}-darwin-amd64 +chmod +x glint +sudo mv glint /usr/local/bin/ +``` + +### Verify the installation + +```bash +glint --version +``` + +--- + +## Option 3 — Homebrew (macOS and Linux) + +A Homebrew tap is available at `k3nny/glint`. + +> **First-time setup:** create a GitHub repository named `homebrew-glint` +> under your account and copy [`Formula/glint.rb`](Formula/glint.rb) into it. +> Users then install via the tap as shown below. + +```bash +brew tap k3nny/glint https://github.com/k3nny/homebrew-glint +brew install glint +``` + +To upgrade: + +```bash +brew upgrade glint +``` + +The formula builds glint from source using Go, which Homebrew provides +automatically as a build dependency. No pre-built binary download is needed. + +### Updating the formula on a new release + +After tagging a new release, update `Formula/glint.rb`: + +1. Compute the tarball checksum: + ```bash + curl -sL https://git.k3nny.fr/k3nny/glint/archive/vX.Y.Z.tar.gz | sha256sum + ``` +2. Update `url` and `sha256` in the formula. +3. Commit and push to `homebrew-glint`. + +--- + +## Option 4 — Go install + +If you already have Go 1.21+: + +```bash +go install git.k3nny.fr/k3nny/glint/cmd/glint@latest +``` + +The binary is placed in `$(go env GOPATH)/bin/`. Add that directory to your +`PATH` if it is not already there: + +```bash +export PATH="$PATH:$(go env GOPATH)/bin" +``` + +--- + +## Integrations + +For editor and CI integrations (pre-commit hook, GitLab CI component, GitHub +Actions, VS Code extension) see [README.md](README.md#integrations). diff --git a/README.md b/README.md index 4486f6f..8dbe5b0 100644 --- a/README.md +++ b/README.md @@ -27,25 +27,30 @@ A local tool to validate and lint `.gitlab-ci.yml` pipelines without needing a G See [FEATURES.md](FEATURES.md) for the complete feature reference and lint rules table, and [ROADMAP.md](ROADMAP.md) for planned improvements. -## Requirements - -- Go 1.21 or later -- [Task](https://taskfile.dev) (optional, for development tasks) - ## Installation +See [INSTALL.md](INSTALL.md) for all options: pre-built binaries (Linux amd64/arm64, macOS Intel/Apple Silicon, Windows), Homebrew tap, and building from source. + +Quick start (Linux/macOS, building from source): + ```bash git clone https://git.k3nny.fr/k3nny/glint cd glint go build -o glint ./cmd/glint/... +sudo mv glint /usr/local/bin/ ``` -Or with Task: +Homebrew: ```bash -task build +brew tap k3nny/glint https://github.com/k3nny/homebrew-glint +brew install glint ``` +## Requirements + +Go 1.21 or later (when building from source). Pre-built binaries have no runtime dependencies. + ## Usage ``` @@ -148,8 +153,12 @@ task changelog-next # preview unreleased section (dry-run, no file written) task ext-install # install VS Code extension npm dependencies task ext-compile # compile the VS Code extension TypeScript source task ext-package # package the VS Code extension as a .vsix -task build-windows # cross-compile for Windows x64 (requires a tagged commit → glint-.exe) -task build-linux # cross-compile for Linux x64 (requires a tagged commit → glint--linux-amd64) +task build-linux-amd64 # cross-compile for Linux x86-64 (requires a tagged commit) +task build-linux-arm64 # cross-compile for Linux ARM64 (requires a tagged commit) +task build-darwin-amd64 # cross-compile for macOS Intel (requires a tagged commit) +task build-darwin-arm64 # cross-compile for macOS Apple Silicon (requires a tagged commit) +task build-windows # cross-compile for Windows x86-64 (requires a tagged commit) +task build-release # build all platform binaries at once (requires a tagged commit) task clean # remove build artifacts ``` diff --git a/Taskfile.yml b/Taskfile.yml index d645a4e..9158d0d 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -145,30 +145,15 @@ tasks: - task: build - task: validate - build-windows: - desc: Build the glint binary for Windows x64 (requires a tagged commit) + build-linux-amd64: + desc: Build the glint binary for Linux x86-64 (requires a tagged commit) + aliases: [build-linux] vars: TAG: sh: git describe --tags --exact-match preconditions: - sh: git describe --tags --exact-match - msg: "Current commit is not tagged — Windows build requires a git tag" - cmds: - - "GOOS=windows GOARCH=amd64 {{.GO}} build -ldflags \"-X main.version={{.TAG}}\" -o {{.BINARY}}-{{.TAG}}.exe ./cmd/glint/..." - sources: - - "**/*.go" - - go.mod - generates: - - "{{.BINARY}}-{{.TAG}}.exe" - - build-linux: - desc: Build the glint binary for Linux x64 (requires a tagged commit) - vars: - TAG: - sh: git describe --tags --exact-match - preconditions: - - sh: git describe --tags --exact-match - msg: "Current commit is not tagged — Linux build requires a git tag" + msg: "Current commit is not tagged — release build requires a git tag" cmds: - "GOOS=linux GOARCH=amd64 {{.GO}} build -ldflags \"-X main.version={{.TAG}}\" -o {{.BINARY}}-{{.TAG}}-linux-amd64 ./cmd/glint/..." sources: @@ -177,6 +162,79 @@ tasks: generates: - "{{.BINARY}}-{{.TAG}}-linux-amd64" + build-linux-arm64: + desc: Build the glint binary for Linux ARM64 (requires a tagged commit) + vars: + TAG: + sh: git describe --tags --exact-match + preconditions: + - sh: git describe --tags --exact-match + msg: "Current commit is not tagged — release build requires a git tag" + cmds: + - "GOOS=linux GOARCH=arm64 {{.GO}} build -ldflags \"-X main.version={{.TAG}}\" -o {{.BINARY}}-{{.TAG}}-linux-arm64 ./cmd/glint/..." + sources: + - "**/*.go" + - go.mod + generates: + - "{{.BINARY}}-{{.TAG}}-linux-arm64" + + build-darwin-amd64: + desc: Build the glint binary for macOS Intel (requires a tagged commit) + vars: + TAG: + sh: git describe --tags --exact-match + preconditions: + - sh: git describe --tags --exact-match + msg: "Current commit is not tagged — release build requires a git tag" + cmds: + - "GOOS=darwin GOARCH=amd64 {{.GO}} build -ldflags \"-X main.version={{.TAG}}\" -o {{.BINARY}}-{{.TAG}}-darwin-amd64 ./cmd/glint/..." + sources: + - "**/*.go" + - go.mod + generates: + - "{{.BINARY}}-{{.TAG}}-darwin-amd64" + + build-darwin-arm64: + desc: Build the glint binary for macOS Apple Silicon (requires a tagged commit) + vars: + TAG: + sh: git describe --tags --exact-match + preconditions: + - sh: git describe --tags --exact-match + msg: "Current commit is not tagged — release build requires a git tag" + cmds: + - "GOOS=darwin GOARCH=arm64 {{.GO}} build -ldflags \"-X main.version={{.TAG}}\" -o {{.BINARY}}-{{.TAG}}-darwin-arm64 ./cmd/glint/..." + sources: + - "**/*.go" + - go.mod + generates: + - "{{.BINARY}}-{{.TAG}}-darwin-arm64" + + build-windows: + desc: Build the glint binary for Windows x86-64 (requires a tagged commit) + vars: + TAG: + sh: git describe --tags --exact-match + preconditions: + - sh: git describe --tags --exact-match + msg: "Current commit is not tagged — release build requires a git tag" + cmds: + - "GOOS=windows GOARCH=amd64 {{.GO}} build -ldflags \"-X main.version={{.TAG}}\" -o {{.BINARY}}-{{.TAG}}-windows-amd64.exe ./cmd/glint/..." + sources: + - "**/*.go" + - go.mod + generates: + - "{{.BINARY}}-{{.TAG}}-windows-amd64.exe" + + build-release: + desc: Build release binaries for all supported platforms (requires a tagged commit) + cmds: + - task: build-linux-amd64 + - task: build-linux-arm64 + - task: build-darwin-amd64 + - task: build-darwin-arm64 + - task: build-windows + fuzz: desc: "Run all fuzz targets (set FUZZ_TIME=60s to control per-target duration, default 30s)" cmds: