Skip to content

Commit

Permalink
migrate to GitHub Actions from travis
Browse files Browse the repository at this point in the history
  • Loading branch information
Songmu committed May 21, 2022
1 parent 3c87dbc commit 42e8939
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 31 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: reviewdog
on: [pull_request]
jobs:
staticcheck:
name: staticcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: reviewdog/action-staticcheck@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
fail_on_error: true
46 changes: 46 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: test
on:
push:
branches:
- "**"
pull_request: {}
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macOS-latest
- windows-latest
steps:
- name: setup go
uses: actions/setup-go@v3
with:
go-version: 1.x
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
if: "matrix.os == 'windows-latest'"
- name: checkout
uses: actions/checkout@v3
- name: test
run: go test -coverprofile coverage.out -covermode atomic ./...
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
github-token: ${{ secrets.github_token }}
path-to-profile: coverage.out
parallel: true
job-number: ${{ strategy.job-index }}
finish:
runs-on: ubuntu-latest
needs: test
steps:
- name: finish coverage report
uses: shogo82148/actions-goveralls@v1
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.*
!.gitignore
!.travis.yml
!.goxc.json
!.github
dist/
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

24 changes: 13 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
test: deps
go test
u := $(if $(update),-u)

.PHONY: deps
deps:
go get -d -v -t ./...
go get golang.org/x/lint/golint
go get github.com/mattn/goveralls
go get ${u} -d
go mod tidy

lint: deps
go vet
golint -set_exit_status
.PHONY: devel-deps
devel-deps:
go install github.com/Songmu/godzil/cmd/godzil@latest

cover: deps
goveralls
.PHONY: test
test:
go test

.PHONY: test deps lint cover
.PHONY: release
release: devel-deps
godzil release
59 changes: 49 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,62 @@
go-ltsv
=======

[![Build Status](https://travis-ci.org/Songmu/go-ltsv.png?branch=master)][travis]
[![Coverage Status](https://coveralls.io/repos/Songmu/go-ltsv/badge.png?branch=master)][coveralls]
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)][license]
[![GoDoc](https://godoc.org/github.com/Songmu/go-ltsv?status.svg)][godoc]

[travis]: https://travis-ci.org/Songmu/go-ltsv
[coveralls]: https://coveralls.io/r/Songmu/go-ltsv?branch=master
[license]: https://github.com/Songmu/go-ltsv/blob/master/LICENSE
[godoc]: https://godoc.org/github.com/Songmu/go-ltsv
[![Test Status](https://github.com/Songmu/go-ltsv/workflows/test/badge.svg?branch=main)][actions]
[![Coverage Status](https://codecov.io/gh/Songmu/go-ltsv/branch/main/graph/badge.svg)][codecov]
[![MIT License](https://img.shields.io/github/license/Songmu/go-ltsv)][license]
[![PkgGoDev](https://pkg.go.dev/badge/github.com/Songmu/go-ltsv)][PkgGoDev]

[actions]: https://github.com/Songmu/go-ltsv/actions?workflow=test
[codecov]: https://codecov.io/gh/Songmu/go-ltsv
[license]: https://github.com/Songmu/go-ltsv/blob/main/LICENSE
[PkgGoDev]: https://pkg.go.dev/github.com/Songmu/go-ltsv

LTSV library to map ltsv to struct.

## Synopsis

```go
import (
"net"

"github.com/Songmu/go-ltsv"
)

type log struct {
Host net.IP
Req string
Status int
Size int
UA string
ReqTime float64
AppTime *float64
VHost string
}

func main() {
ltsvLog := "time:2016-07-13T00:00:04+09:00\t" +
"host:192.0.2.1\t" +
"req:POST /api/v0/tsdb HTTP/1.1\t" +
"status:200\t" +
"size:36\t" +
"ua:ua:mackerel-agent/0.31.2 (Revision 775fad2)\t" +
"reqtime:0.087\t" +
"vhost:mackerel.io"
l := &log{}
ltsv.Unmarshal([]byte(ltsvLog), l)
...
}
```

## Description

LTSV parser and encoder for Go with reflection

## Installation

% go get github.com/Songmu/go-ltsv
```console
% go get github.com/Songmu/go-ltsv
```

## Author

Expand Down
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment: false

0 comments on commit 42e8939

Please sign in to comment.