Skip to content

Commit a9b6dc8

Browse files
authored
use GitHub Actions (#19)
* fix to use GitHub Actions * use Go 1.21 * disable Reviewdog
1 parent 2c8e7c9 commit a9b6dc8

File tree

9 files changed

+87
-258
lines changed

9 files changed

+87
-258
lines changed

.circleci/config.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: main
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
jobs:
7+
test:
8+
permissions:
9+
contents: read
10+
runs-on: ubuntu-latest
11+
defaults:
12+
run:
13+
shell: bash -eu -o pipefail {0}
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
- name: Setup go
18+
id: setup-go
19+
uses: actions/setup-go@v4
20+
with:
21+
go-version-file: "go.mod"
22+
- name: Download dependencies
23+
if: ${{ steps.setup-go.outputs.cache-hit != 'true' }}
24+
run: |
25+
go mod download
26+
- name: Run test
27+
run: |
28+
make test
29+
lint:
30+
permissions:
31+
contents: read
32+
runs-on: ubuntu-latest
33+
defaults:
34+
run:
35+
shell: bash -eu -o pipefail {0}
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v3
39+
- name: Setup go
40+
id: setup-go
41+
uses: actions/setup-go@v4
42+
with:
43+
go-version-file: "go.mod"
44+
- name: Download dependencies
45+
if: ${{ steps.setup-go.outputs.cache-hit != 'true' }}
46+
run: |
47+
go mod download
48+
- name: Run lint tools
49+
run: |
50+
make lint

.reviewdog.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
runner:
22
# https://golang.org/cmd/vet/
33
govet:
4-
cmd: go vet $(go list ./...)
5-
6-
# https://github.com/golang/lint
7-
golint:
8-
cmd: golint $(go list ./...)
9-
errorformat:
10-
- "%f:%l:%c: %m"
4+
format: govet
115

126
# https://github.com/client9/misspell
137
misspell:
@@ -17,7 +11,7 @@ runner:
1711

1812
# https://github.com/kisielk/errcheck
1913
errcheck:
20-
cmd: errcheck -exclude .errcheck_excludes -ignore 'fmt:.*,io:.*,ioutil:.*,net/http:.*' -ignoretests $(go list ./...)
14+
cmd: errcheck -ignore 'fmt:.*,io:.*,ioutil:.*,net/http:.*' -ignoretests $(go list ./...)
2115
errorformat:
2216
- "%f:%l:%c:%m"
2317

Makefile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@ export GO111MODULE = on
22

33
REPOSITORY = go.mercari.io/go-emv-code
44
PACKAGES ?= $(shell go list ./...)
5-
ifneq ($(CIRCLECI),)
6-
PACKAGES=$(shell go list ./... | circleci tests split)
7-
endif
85

96
GO_TEST ?= go test
107
GO_TEST_TARGET ?= .
118

12-
REVIEWDOG_ARG ?= -diff="git diff master"
13-
149
LINT_TOOLS=$(shell cat tools/tools.go | egrep '^\s_ ' | awk '{ print $$2 }')
1510

1611
GOPATH := $(shell go env GOPATH)
@@ -28,14 +23,15 @@ bootstrap-lint-tools:
2823
test: ## Run go test
2924
${GO_TEST} -v -race -mod=readonly -run=$(GO_TEST_TARGET) $(PACKAGES)
3025

26+
.PHONY: lint
27+
lint: bootstrap-lint-tools ## Run lint tools
28+
go vet ./...
29+
staticcheck ./...
30+
3131
.PHONY: coverage
3232
coverage: ## Collect test coverage
3333
${GO_TEST} -v -race -mod=readonly -run=$(GO_TEST_TARGET) -covermode=atomic -coverpkg=${REPOSITORY}/... -coverprofile=$@.out $(PACKAGES)
3434

35-
.PHONY: reviewdog
36-
reviewdog: bootstrap-lint-tools ## Run reviewdog
37-
reviewdog -conf=.reviewdog.yml $(REVIEWDOG_ARG)
38-
3935
.PHONY: help
4036
help: ## Show this help
4137
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[33m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z\/_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)

README.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# go-emv-code [![CircleCI][circleci-badge]][circleci] [![GoDoc][godoc-badge]][godoc] [![Go Report Card][goreport-badge]][goreport]
1+
# go-emv-code [![GitHub Actions][gh-actions-badge]][gh-actions] [![GoDoc][godoc-badge]][godoc] [![Go Report Card][goreport-badge]][goreport]
22

3-
[circleci]: https://circleci.com/gh/mercari/go-emv-code/tree/master
4-
[circleci-badge]: https://circleci.com/gh/mercari/go-emv-code/tree/master.svg?style=svg
3+
[gh-actions]: https://github.com/mercari/go-emv-code/actions/workflows/main.yml
4+
[gh-actions-badge]: https://github.com/mercari/go-emv-code/actions/workflows/main.yml/badge.svg
55
[godoc]: https://godoc.org/go.mercari.io/go-emv-code
66
[godoc-badge]: https://godoc.org/go.mercari.io/go-emv-code?status.svg
77
[goreport]: https://goreportcard.com/report/go.mercari.io/go-emv-code
@@ -29,21 +29,15 @@ https://www.mercari.com/cla/
2929
* requirements
3030
* Go version must be at least 1.12 (Modules)
3131

32-
1. Testing in local
32+
Testing in local
3333

3434
```
3535
$ make test
3636
```
3737

38-
2. Testing with [Circle CI CLI](https://circleci.com/docs/2.0/local-jobs/)
39-
40-
```
41-
$ circleci build --job test
42-
```
43-
4438
## License
4539

46-
Copyright 2019 Mercari, Inc.
40+
Copyright 2019-2023 Mercari, Inc.
4741

4842
Licensed under the MIT License.
4943

crc16/crc16.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (d *digest) Sum16() uint16 { return d.crc }
8282

8383
func (d *digest) Sum(in []byte) []byte {
8484
s := d.Sum16()
85-
return append(in, byte(s>>16), byte(s>>8), byte(s))
85+
return append(in, 0, byte(s>>8), byte(s))
8686
}
8787

8888
// Hash16 is the common interface implemented by all 16-bit hash functions.

go.mod

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
module go.mercari.io/go-emv-code
22

3-
go 1.12
3+
go 1.21
4+
5+
require honnef.co/go/tools v0.4.3
46

57
require (
6-
github.com/client9/misspell v0.3.4
7-
github.com/kisielk/errcheck v1.2.0
8-
github.com/reviewdog/reviewdog v0.9.12
9-
golang.org/x/lint v0.0.0-20190409202823-959b441ac422
10-
golang.org/x/tools v0.0.0-20190918214516-5a1a30219888
11-
gotest.tools/gotestsum v0.3.5
12-
honnef.co/go/tools v0.0.0-2019.2.1
8+
github.com/BurntSushi/toml v1.2.1 // indirect
9+
golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a // indirect
10+
golang.org/x/mod v0.8.0 // indirect
11+
golang.org/x/sync v0.3.0 // indirect
12+
golang.org/x/sys v0.9.0 // indirect
13+
golang.org/x/tools v0.6.0 // indirect
1314
)

0 commit comments

Comments
 (0)