Skip to content

Commit 10e1b5c

Browse files
mogrenoxzi
andauthored
Switch from Travis to GitHub Actions (#1)
Switch from Travis to GitHub Actions * Enable golangci-lint on Push and PRs * Add CI badge Co-authored-by: Alvar Penning <[email protected]>
1 parent 078464b commit 10e1b5c

File tree

7 files changed

+73
-29
lines changed

7 files changed

+73
-29
lines changed

.github/.golangci.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
issues:
2+
exclude-rules:
3+
# Some deterministic "pseudo random" data is needed in tests
4+
- path: _test\.go
5+
text: "G404:"
6+
linters:
7+
- gosec
8+
9+
linters:
10+
# In addition to the default
11+
enable:
12+
- gocyclo
13+
- gofmt
14+
- goimports
15+
- gosec
16+
- prealloc
17+
- unconvert

.github/workflows/ci.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
golang:
7+
name: Build and test cboring
8+
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
matrix:
13+
go: [ '1.13', '1.15' ]
14+
15+
steps:
16+
- name: Set up Go ${{ matrix.go }}
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: ${{ matrix.go }}
20+
21+
- name: Check out code
22+
uses: actions/checkout@v2
23+
24+
- name: Build on Go ${{ matrix.go }}
25+
run: go build ./...
26+
27+
- name: Test
28+
run: go test -v ./...
29+
30+
31+
golangci:
32+
name: Check golangci-lint
33+
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- name: Check out code
38+
uses: actions/checkout@v2
39+
40+
- name: golangci-lint
41+
uses: golangci/golangci-lint-action@v2
42+
with:
43+
version: v1.32
44+
args: --config .github/.golangci.yml

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.iml
2+
.idea

.travis.yml

-19
This file was deleted.

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# cboring [![Build Status](https://travis-ci.org/dtn7/cboring.svg?branch=master)](https://travis-ci.org/dtn7/cboring) [![GoDoc](https://godoc.org/github.com/dtn7/cboring?status.svg)](https://godoc.org/github.com/dtn7/cboring)
1+
# cboring [![CI](https://github.com/dtn7/cboring/workflows/CI/badge.svg)](https://github.com/dtn7/cboring/actions) [![GoDoc](https://godoc.org/github.com/dtn7/cboring?status.svg)](https://godoc.org/github.com/dtn7/cboring)
22

3-
Simple [CBOR][cbor] Go(lang) library for a selected subset of features,
3+
A simple [CBOR][cbor] Go(lang) library for a selected subset of features,
44
developed to be used in [`dtn7-go`][dtn7-go], an implementation of the
55
[Bundle Protocol Version 7][bpbis]. The name is based on the fact that
66
`cboring` is both boring to use and bored about the amount of data to handle.
@@ -17,10 +17,10 @@ developed to be used in [`dtn7-go`][dtn7-go], an implementation of the
1717
- Booleans
1818
- Small and clear codebase:
1919
- Only works on streams, Go's `io.Reader` or `io.Writer`
20-
- Does *not* use reflection or makes any strange assumptions
20+
- Does *not* use reflection or make any strange assumptions
2121
- Surprisingly fast
2222

2323

24-
[bpbis]: https://tools.ietf.org/html/draft-ietf-dtn-bpbis-14
24+
[bpbis]: https://tools.ietf.org/html/draft-ietf-dtn-bpbis-29
2525
[cbor]: https://tools.ietf.org/html/rfc7049
2626
[dtn7-go]: https://github.com/dtn7/dtn7-go

major_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ func TestReadMajorsBig(t *testing.T) {
5252
func TestReadMajorsError(t *testing.T) {
5353
tests := [][]byte{
5454
// Empty stream
55-
[]byte{},
55+
{},
5656
// Incomplete streams
57-
[]byte{0x18}, []byte{0x19, 0x03},
57+
{0x18}, {0x19, 0x03},
5858
}
5959

6060
for _, test := range tests {

primitives_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ func TestUInt(t *testing.T) {
5050
func TestReadUIntError(t *testing.T) {
5151
tests := [][]byte{
5252
// Wrong major type
53-
[]byte{0xFF},
53+
{0xFF},
5454
// Wrong additionals for major type 0
55-
[]byte{0x1F},
55+
{0x1F},
5656
// Empty stream
57-
[]byte{},
57+
{},
5858
// Incomplete streams
59-
[]byte{0x18}, []byte{0x1b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
59+
{0x18}, {0x1b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
6060
}
6161

6262
for _, test := range tests {

0 commit comments

Comments
 (0)