ci: test+lint workflow, goreleaser release pipeline, Homebrew cask
- ci.yml: gofmt/vet/build/test -race + golangci-lint on push and PR - release.yml: goreleaser on v* tags (tests gate the release) - goreleaser: CGO-free darwin/linux amd64+arm64, version ldflags, conventional-commit changelog, cask published to qf-studio/homebrew-tap (quarantine hook for the unsigned binary)
This commit is contained in:
1 parent
e95546cb45
commit
2c2317187d
4 files changed
+110
-1
No files matched your search
@@ -0,0 +1,31 @@
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- name: gofmt
|
||||
run: test -z "$(gofmt -l .)"
|
||||
- run: go vet ./...
|
||||
- run: go build ./...
|
||||
- run: go test -race ./...
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
version: latest
|
||||
@@ -0,0 +1,28 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["v*"]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # full history for the changelog
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- run: go test -race ./...
|
||||
- uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
version: "~> v2"
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# PAT with write access to qf-studio/homebrew-tap (formula push).
|
||||
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,48 @@
|
||||
version: 2
|
||||
|
||||
project_name: grot
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
|
||||
builds:
|
||||
- main: ./cmd/grot
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos: [darwin, linux]
|
||||
goarch: [amd64, arm64]
|
||||
ldflags:
|
||||
- -s -w
|
||||
- -X main.version={{.Version}}
|
||||
- -X main.buildTime={{.Date}}
|
||||
|
||||
archives:
|
||||
- formats: [tar.gz]
|
||||
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
|
||||
|
||||
checksum:
|
||||
name_template: checksums.txt
|
||||
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- "^docs"
|
||||
- "^chore"
|
||||
- "^test"
|
||||
|
||||
homebrew_casks:
|
||||
- repository:
|
||||
owner: qf-studio
|
||||
name: homebrew-tap
|
||||
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
|
||||
homepage: https://github.com/qf-studio/grot
|
||||
description: btop-style terminal dashboards for Prometheus & Grafana
|
||||
# Unsigned binary: strip the quarantine bit so Gatekeeper doesn't block it.
|
||||
hooks:
|
||||
post:
|
||||
install: |
|
||||
if system_command("/usr/bin/xattr", args: ["-h"]).exit_status == 0
|
||||
system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/grot"]
|
||||
end
|
||||
@@ -21,10 +21,12 @@ Grafana dashboard JSON and get the same layout in your terminal.
|
||||
## Install
|
||||
|
||||
```bash
|
||||
brew install --cask qf-studio/tap/grot # macOS / Linux
|
||||
go install github.com/qf-studio/grot/cmd/grot@latest
|
||||
```
|
||||
|
||||
Homebrew tap lands with v0.1.0.
|
||||
Prebuilt binaries for darwin/linux (amd64 + arm64) on the
|
||||
[releases page](https://github.com/qf-studio/grot/releases).
|
||||
|
||||
## Quick start
|
||||
|
||||
|
||||
Reference in new issue
Block a user