Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wesen authored Dec 15, 2024
0 parents commit e341e79
Show file tree
Hide file tree
Showing 12 changed files with 389 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# this is copied over from goreleaser/goreleaser/.github/workflows/lint.yml
name: golangci-lint
on:
push:
tags:
- v*
branches:
- main
pull_request:
permissions:
contents: read

jobs:
golangci:
permissions:
contents: read
pull-requests: read
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v3
with:
go-version: '>=1.19.5'
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.1.0
with:
args: --timeout=5m
23 changes: 23 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: golang-pipeline

on:
push:
branches:
- 'main'
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v3
with:
go-version: '>=1.19.5'
cache: true
-
name: Run unit tests
run: go test ./...
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
on:
push:
# run only against tags
tags:
- '*'

permissions:
contents: write
# packages: write
# issues: write


jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v3
with:
go-version: '>=1.19.5'
cache: true

- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GO_GO_GOLEMS_SIGN_KEY }}
passphrase: ${{ secrets.GO_GO_GOLEMS_SIGN_PASSPHRASE }}
fingerprint: "6EBE1DF0BDF48A1BBA381B5B79983EF218C6ED7E"

- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_PWD: ${{ secrets.COSIGN_PWD }}
TAP_GITHUB_TOKEN: ${{ secrets.RELEASE_ACTION_PAT }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
dist/

# misc files and directories
.env
.envrc
.history
22 changes: 22 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
linters:
disable-all: false
enable:
# defaults
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
# stuff I'm adding
- exhaustive
# - gochecknoglobals
# - gochecknoinits
- gofmt
- nonamedreturns
- predeclared
fast: false
issues:
exclude:
- 'SA1019: cli.CreateProcessorLegacy'
91 changes: 91 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
version: 2
project_name: XXX

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
main: ./cmd/XXX
binary: XXX
goos:
- linux
# I am not able to test windows at the time
# - windows
- darwin
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

signs:
- artifacts: checksum
# setup for github actions according to https://goreleaser.com/ci/actions/
args: [ "--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}" ]

brews:
- name: XXX
description: "XXX is a tool"
homepage: "https://github.com/go-go-golems/XXX"
repository:
owner: go-go-golems
name: homebrew-go-go-go
token: "{{ .Env.TAP_GITHUB_TOKEN }}"

nfpms:
-
id: packages

vendor: GO GO GOLEMS
homepage: https://github.com/go-go-golems/
maintainer: Manuel Odendahl <wesen@ruinwesen.com>

description: |-
XXX is a tool
license: MIT

# Formats to be generated.
formats:
# - apk
- deb
- rpm

# Version Release.
release: 1

# Section.
section: default

# Priority.
priority: extra

# Custom configuration applied only to the Deb packager.
deb:
# Lintian overrides
lintian_overrides:
- statically-linked-binary
- changelog-file-missing-in-native-package

publishers:
- name: fury.io
# by specifying `packages` id here goreleaser will only use this publisher
# with artifacts identified by this id
ids:
- packages
dir: "{{ dir .ArtifactPath }}"
cmd: curl -F package=@{{ .ArtifactName }} https://{{ .Env.FURY_TOKEN }}@push.fury.io/go-go-golems/

# modelines, feel free to remove those if you don't want/use them:
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Manuel Odendahl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
48 changes: 48 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.PHONY: gifs

all: gifs

VERSION=v0.1.14

TAPES=$(shell ls doc/vhs/*tape)
gifs: $(TAPES)
for i in $(TAPES); do vhs < $$i; done

docker-lint:
docker run --rm -v $(shell pwd):/app -w /app golangci/golangci-lint:v1.50.1 golangci-lint run -v

lint:
golangci-lint run -v

test:
go test ./...

build:
go generate ./...
go build ./...

goreleaser:
goreleaser release --skip=sign --snapshot --clean

tag-major:
git tag $(shell svu major)

tag-minor:
git tag $(shell svu minor)

tag-patch:
git tag $(shell svu patch)

release:
git push --tags
GOPROXY=proxy.golang.org go list -m github.com/go-go-golems/XXX@$(shell svu current)

bump-glazed:
go get github.com/go-go-golems/glazed@latest
go get github.com/go-go-golems/clay@latest
go mod tidy

XXX_BINARY=$(shell which XXX)
install:
go build -o ./dist/XXX ./cmd/XXX && \
cp ./dist/XXX $(XXX_BINARY)
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# GO GO TEMPLATE

```
_______ _______ _______ _______
| || | | || |
| ___|| _ | | ___|| _ |
| | __ | | | | | | __ | | | |
| || || |_| | | || || |_| |
| |_| || | | |_| || |
|_______||_______| |_______||_______|
_______ _______ __ __ _______ ___ _______ _______ _______
| || || |_| || || | | _ || || |
|_ _|| ___|| || _ || | | |_| ||_ _|| ___|
| | | |___ | || |_| || | | | | | | |___
| | | ___|| || ___|| |___ | | | | | ___|
| | | |___ | ||_|| || | | || _ | | | | |___
|___| |_______||_| |_||___| |_______||__| |__| |___| |_______|
```

---

```
_______ _______ _______ _______
| || | | || |
| ___|| _ | | ___|| _ |
| | __ | | | | | | __ | | | |
| || || |_| | | || || |_| |
| |_| || | | |_| || |
|_______||_______| |_______||_______|
_______ _______ ___ _______ __ __ _______
| || || | | || |_| || |
| ___|| _ || | | ___|| || _____|
| | __ | | | || | | |___ | || |_____
| || || |_| || |___ | ___|| ||_____ |
| |_| || || || |___ | ||_|| | _____| |
|_______||_______||_______||_______||_| |_||_______|
__ __ _______ ___ _ _______ __ __ _______ ______ _______
| |_| || _ || | | || | | |_| || || _ | | |
| || |_| || |_| || ___| | || _ || | || | ___|
| || || _|| |___ | || | | || |_|| | |___
| || || |_ | ___| | || |_| || __ || ___|
| ||_|| || _ || _ || |___ | ||_|| || || | ||| |___
|_| |_||__| |__||___| |_||_______| |_| |_||_______||___| |||_______|
_______ _______ _______ _______
| || | | || |
| ___|| _ | | ___|| _ |
| | __ | | | | | | __ | | | |
| || || |_| | | || || |_| |
| |_| || | | |_| || |
|_______||_______| |_______||_______|
_______ _______ ___ _______ __ __ _______
| || || | | || |_| || |
| ___|| _ || | | ___|| || _____|
| | __ | | | || | | |___ | || |_____
| || || |_| || |___ | ___|| ||_____ |
| |_| || || || |___ | ||_|| | _____| |
|_______||_______||_______||_______||_| |_||_______|
```
5 changes: 5 additions & 0 deletions cmd/XXX/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package main

func main() {

}
19 changes: 19 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
pre-commit:
commands:
lint:
glob: '*.go'
run: make lint
test:
glob: '*.go'
run: make test
parallel: true

pre-push:
commands:
release:
run: make goreleaser
lint:
run: make lint
test:
run: make test
parallel: true
Loading

0 comments on commit e341e79

Please sign in to comment.