diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 9172556..0000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,47 +0,0 @@ -name: build-and-test -on: [push, pull_request] -jobs: - build: - strategy: - matrix: - version: [1.21] - os: [ubuntu-latest, windows-latest, macos-latest] - name: Build - runs-on: ${{ matrix.os }} - steps: - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.version }} - id: go - - - name: checkout - uses: actions/checkout@v3 - - - name: build - run: go build - - - name: test - run: make test - - - name: Update coverage report - uses: ncruces/go-coverage-report@main - with: - report: true - chart: true - amend: true - if: | - matrix.os == 'ubuntu-latest' && - github.event_name == 'push' - continue-on-error: true - - golangci: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v3 - with: - go-version: 1.21 - - uses: actions/checkout@v3 - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..3dcb5ac --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,65 @@ +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 2 + +before: + hooks: + - go mod tidy + +gitea_urls: + api: https://codeberg.org/api/v1 + download: https://codeberg.org + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - freebsd + +archives: + - formats: [tar.gz] + # this name template makes the OS and Arch compatible with the results of `uname`. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }}_{{ .Tag }} + # use zip for windows archives + format_overrides: + - goos: windows + formats: [zip] + - goos: linux + formats: [tar.gz,binary] + files: + - src: "*.md" + strip_parent: true + - src: Makefile.dist + dst: Makefile + wrap_in_directory: true + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + groups: + - title: Improved + regexp: '^.*?(feat|add|new)(\([[:word:]]+\))??!?:.+$' + order: 0 + - title: Fixed + regexp: '^.*?(bug|fix)(\([[:word:]]+\))??!?:.+$' + order: 1 + - title: Changed + order: 999 + +release: + header: "# Release Notes" + footer: >- + + --- + + Full Changelog: [{{ .PreviousTag }}...{{ .Tag }}](https://codeberg.org/scip/yadu/compare/{{ .PreviousTag }}...{{ .Tag }}) diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml new file mode 100644 index 0000000..e20cc6f --- /dev/null +++ b/.woodpecker/build.yaml @@ -0,0 +1,36 @@ +matrix: + platform: + - linux/amd64 + goversion: + - 1.24 + +labels: + platform: ${platform} + +steps: + build: + when: + event: [push] + image: golang:${goversion} + commands: + - go get + - go build + + linter: + when: + event: [push] + image: golang:${goversion} + commands: + - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.5.0 + - golangci-lint --version + - golangci-lint run ./... + depends_on: [build] + + test: + when: + event: [push] + image: golang:${goversion} + commands: + - go get + - go test -v -cover + depends_on: [build,linter] diff --git a/Makefile.dist b/Makefile.dist new file mode 100644 index 0000000..55d2f38 --- /dev/null +++ b/Makefile.dist @@ -0,0 +1,18 @@ +# -*-make-*- + +.PHONY: install all + +tool = rpn +PREFIX = /usr/local +UID = root +GID = 0 + +all: + @echo "Type 'sudo make install' to install the tool." + @echo "To change prefix, type 'sudo make install PREFIX=/opt'" + +install: + install -d -o $(UID) -g $(GID) $(PREFIX)/bin + install -d -o $(UID) -g $(GID) $(PREFIX)/share/doc + install -o $(UID) -g $(GID) -m 555 $(tool) $(PREFIX)/sbin/ + install -o $(UID) -g $(GID) -m 444 *.md $(PREFIX)/share/doc/ diff --git a/README.md b/README.md index 4b48209..e4c971f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ -[![Go Report Card](https://goreportcard.com/badge/github.com/tlinden/yadu)](https://goreportcard.com/report/github.com/tlinden/yadu) -[![Actions](https://github.com/tlinden/yadu/actions/workflows/ci.yaml/badge.svg)](https://github.com/tlinden/yadu/actions) -[![Go Coverage](https://github.com/tlinden/yadu/wiki/coverage.svg)](https://raw.githack.com/wiki/tlinden/yadu/coverage.html) -![GitHub License](https://img.shields.io/github/license/tlinden/yadu) +[![status-badge](https://ci.codeberg.org/api/badges/15686/status.svg)](https://ci.codeberg.org/repos/15686) +[![Go Report Card](https://goreportcard.com/badge/github.com/tlinden/yadu)](https://goreportcard.com/report/github.com/tlinden/yadu) +[![License](https://img.shields.io/badge/license-GPL-blue.svg)](https://codeberg.org/scip/yadu/raw/branch/main/LICENSE) [![GoDoc](https://godoc.org/github.com/tlinden/yadu?status.svg)](https://godoc.org/github.com/tlinden/yadu) # yadu - a human readable yaml based slog.Handler @@ -74,7 +73,7 @@ See `example/example.go` for usage. Execute this to add the module to your project: ```sh -go get github.com/tlinden/yadu +go get github.com/tlinden/yadu/v2 ``` ## Configuration diff --git a/example/example.go b/example/example.go index ff25a2d..75474dd 100644 --- a/example/example.go +++ b/example/example.go @@ -4,7 +4,7 @@ import ( "log/slog" "os" - "github.com/tlinden/yadu" + "github.com/tlinden/yadu/v2" ) type body string diff --git a/go.mod b/go.mod index 7333b76..108fad3 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/tlinden/yadu +module github.com/tlinden/yadu/v2 go 1.21 @@ -8,7 +8,7 @@ require ( ) require ( - github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.29.0 // indirect ) diff --git a/go.sum b/go.sum index d6e3f4f..f9e5959 100644 --- a/go.sum +++ b/go.sum @@ -2,13 +2,19 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/tlinden/yadu v0.1.3 h1:5cRCUmj+l5yvlM2irtpFBIJwVV2DPEgYSaWvF19FtcY= +github.com/tlinden/yadu v0.1.3/go.mod h1:l3bRmHKL9zGAR6pnBHY2HRPxBecf7L74BoBgOOpTcUA= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/handler.go b/handler.go index 4830ff1..9533613 100644 --- a/handler.go +++ b/handler.go @@ -42,7 +42,7 @@ type Handler struct { /* This is being used in Postprocess() to fix https://github.com/go-yaml/yaml/issues/1020 and - https://github.com/TLINDEN/yadu/issues/12 respectively. + https://github.com/tlinden/yadu/issues/12 respectively. yaml.v3 follows the YAML standard and quotes all keys and values matching this regex (see https://yaml.org/type/bool.html): diff --git a/handler_test.go b/handler_test.go index f55686c..1775c5b 100644 --- a/handler_test.go +++ b/handler_test.go @@ -8,7 +8,7 @@ import ( "time" "github.com/fatih/color" - "github.com/tlinden/yadu" + "github.com/tlinden/yadu/v2" ) type body string