Skip to content

Commit

Permalink
Merge 832ba36 into 1b1e2b1
Browse files Browse the repository at this point in the history
  • Loading branch information
aurc authored Jun 20, 2022
2 parents 1b1e2b1 + 832ba36 commit bdbc0cb
Show file tree
Hide file tree
Showing 8 changed files with 225 additions and 14 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Feature_CI

on:
push:
branches:
- feature/*
pull_request:
branches:
- feature/*
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

- name: Tags
run: |
git fetch --prune --unshallow
git describe --tags
CURV=$(git describe --tags --abbrev=0)
IFS='.' read -ra VR <<< "$CURV"
INC=`expr ${VR[2]} + 1`
FV="${VR[0]}.${VR[1]}.$INC"
shell: bash
80 changes: 80 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Go

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18

# - name: Install dependencies
# run: |
# go version
# go get -u golang.org/x/lint/golint

- name: Build
run: go build -v ./...

# - name: Test With Coverage
# run: go test -v -coverprofile=coverage.txt -covermode=atomic ./...

# - name: Upload coverage to Codecov
# run: bash <(curl -s https://codecov.io/bash)

tag:
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18

- name: Tag and Deploy
run: |
git fetch --prune --unshallow
CURV=$(git describe --tags --abbrev=0)
IFS='.' read -ra VR <<< "$CURV"
INC=`expr ${VR[2]} + 1`
FV="${VR[0]}.${VR[1]}.$INC"
eval "git tag $FV && git push origin $FV"
eval "GOPROXY=proxy.golang.org go list -m github.com/aurc/loggo@$FV"
shell: bash
release:
needs: tag
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_LOGGO_GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ main
.idea
loggo
testdata/log.txt
dist/
# Test binary, built with `go test -c`
*.test

Expand Down
64 changes: 64 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
project_name: loggo
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
nfpms:
- maintainer: Aurelio Calegari ([email protected])
description: Rich Terminal User Interface for JSON logs
homepage: https://github.com/aurc/loggo
license: MIT
formats:
- deb
- rpm
- apk
brews:
-
name: loggo
# GOARM to specify which 32-bit arm version to use if there are multiple versions
# from the build section. Brew formulas support atm only one 32-bit version.
# Default is 6 for all artifacts or each id if there a multiple versions.
goarm: 6

tap:
owner: aurc
name: homebrew-loggo
branch: main
# # Optionally a token can be provided, if it differs from the token provided to GoReleaser
# token: "{{ .Env.HOMEBREW_LOGGO_GITHUB_TOKEN }}"

url_template: "https://github.com/aurc/loggo/releases/download/{{ .Tag }}/{{ .ArtifactName }}"

commit_author:
name: aurc_bot
email: [email protected]

# The project name and current git tag are used in the format string.
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"

# Folder inside the repository to put the formula.
# Default is the root folder.
folder: Formula

# Caveats for the user of your binary.
# Default is empty.
caveats: "How to use this binary"

# Your app's homepage.
# Default is empty.
homepage: "https://github.com/aurc/homebrew-loggo"

# Template of your app's description.
# Default is empty.
description: "Rich Terminal User Interface for JSON logs"

# SPDX identifier of your app's license.
# Default is empty.
license: "MIT"

14 changes: 13 additions & 1 deletion config-sample/gcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ keys:
- name: timestamp
type: datetime
layout: 2006-01-02T15:04:05-0700
color:
foreground: purple
background: black
- name: severity
type: string
color:
Expand All @@ -26,7 +29,16 @@ keys:
background: black
- name: resource/labels/container_name
type: string
color:
foreground: darkgreen
background: black
- name: trace
type: string
color:
foreground: white
background: black
- name: jsonPayload/message
type: string
type: string
color:
foreground: white
background: black
Binary file added img/loggo_short.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions internal/char/canvas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ func TestCanvas_BlankCanvasAsString(t *testing.T) {
name: "Test l`oGGo",
words: LoggoLogo,
wants: `╔╦╦╦╦╦╦╦╦▓▓░╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╗
╠▓▓▓░╬╬╬╬▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓░╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓░╬╬╬╬▓▓░╬╬╬╬╬▓▓▓░╬╬╬╬▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬▓▓░╬╬╬╬╬╬▓▓▓▓▓░╬╬╬╬╬▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓░╬╬╬╬╬▓▓▓▓▓░╬╬╬╬╬╬╣
╠╬╬▓▓░╬╬╬╬▓▓░╬╬╬╬▓▓░╬╬▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓░╬╬▓▓░╬╬╬╬▓▓░╬╬╬╬╣
╠╬╬▓▓░╬╬╬▓▓░╬╬╬╬╬╬▓▓░╬▓▓░╬╬╬╬╬╬╬▓▓▓▓▓░╬▓▓▓▓▓░╬╬╬╬╬╬╬▓▓░╬▓▓░╬╬╬╬╬╬▓▓░╬╬╬╣
╠╬╬▓▓░╬╬╬▓▓░╬╬╬╬╬╬▓▓░╬▓▓░╬╬╬╬╬╬╬╬╬▓▓░╬╬╬▓▓░╬╬╬╬╬╬╬╬╬▓▓░╬▓▓░╬╬╬╬╬╬▓▓░╬╬╬╣
╠╬╬▓▓░╬╬╬╬▓▓░╬╬╬╬▓▓░╬╬╬╬▓▓░╬╬╬╬╬╬▓▓░╬╬╬▓▓▓░╬╬╬╬╬╬▓▓░╬╬╬╬▓▓░╬╬╬╬▓▓░╬╬╬╬╣
╠▓▓▓░╬╬╬╬▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓░╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓░╬╬╬╬▓▓░╬╬╬╬╬╬╬▓▓░╬╬╬╬▓▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓░╬╬╬╬╬▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬▓▓░╬╬╬╬╬╬▓▓▓▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓░╬╬╬▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓░╬╬╬╬╬╬╣
╠╬╬▓▓░╬╬╬╬▓▓░╬╬╬╬▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓░╬▓▓░╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓░╬╬╬╬▓▓░╬╬╬╬╣
╠╬╬▓▓░╬╬╬▓▓░╬╬╬╬╬╬▓▓░╬▓▓▓▓▓░╬╬╬╬╬╬╬▓▓░╬▓▓░╬╬╬╬╬╬╬▓▓▓▓▓░╬▓▓░╬╬╬╬╬╬▓▓░╬╬╬╣
╠╬╬▓▓░╬╬╬▓▓░╬╬╬╬╬╬▓▓░╬▓▓░╬╬╬╬╬╬╬╬╬▓▓░╬▓▓░╬╬╬╬╬╬╬╬╬▓▓░╬▓▓░╬╬╬╬╬╬▓▓░╬╬╬╣
╠╬╬▓▓░╬╬╬╬▓▓░╬╬╬╬▓▓░╬╬╬▓▓▓░╬╬╬╬╬╬▓▓░╬╬╬╬╬▓▓░╬╬╬╬╬╬▓▓▓░╬╬╬▓▓░╬╬╬╬▓▓░╬╬╬╬╣
╠╬╬╬▓▓▓░╬╬╬╬▓▓▓▓▓░╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓░╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓░╬╬╬╬╬╬╬╬▓▓▓▓▓░╬╬╬╬╬╬╣
╚╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╝`,
},
Expand Down
27 changes: 22 additions & 5 deletions internal/config/log_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func TestMakeConfig(t *testing.T) {
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
test.wants.LastSavedName = test.givenFile
c, err := MakeConfig(test.givenFile)
if test.wantsError {
assert.Error(t, err)
Expand Down Expand Up @@ -121,6 +122,10 @@ var defConfig = Config{
Name: "timestamp",
Type: TypeDateTime,
Layout: "2006-01-02T15:04:05-0700",
Color: Color{
Foreground: "purple",
Background: "black",
},
},
{
Name: "severity",
Expand All @@ -140,37 +145,49 @@ var defConfig = Config{
{
MatchValue: "INFO",
Color: Color{
Foreground: "white",
Foreground: "green",
Background: "black",
},
},
{
MatchValue: "WARN",
Color: Color{
Foreground: "red",
Background: "yellow",
Foreground: "yellow",
Background: "black",
},
},
{
MatchValue: "DEBUG",
Color: Color{
Foreground: "white",
Background: "blue",
Foreground: "blue",
Background: "black",
},
},
},
},
{
Name: "resource/labels/container_name",
Type: TypeString,
Color: Color{
Foreground: "darkgreen",
Background: "black",
},
},
{
Name: "trace",
Type: TypeString,
Color: Color{
Foreground: "white",
Background: "black",
},
},
{
Name: "jsonPayload/message",
Type: TypeString,
Color: Color{
Foreground: "white",
Background: "black",
},
},
},
}

0 comments on commit bdbc0cb

Please sign in to comment.