Skip to content

Commit

Permalink
Switch from Travis to GitHub Actions (#1)
Browse files Browse the repository at this point in the history
Switch from Travis to GitHub Actions

* Enable golangci-lint on Push and PRs
* Add CI badge

Co-authored-by: Alvar Penning <[email protected]>
  • Loading branch information
mogren and oxzi authored Nov 20, 2020
1 parent 078464b commit 10e1b5c
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 29 deletions.
17 changes: 17 additions & 0 deletions .github/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
issues:
exclude-rules:
# Some deterministic "pseudo random" data is needed in tests
- path: _test\.go
text: "G404:"
linters:
- gosec

linters:
# In addition to the default
enable:
- gocyclo
- gofmt
- goimports
- gosec
- prealloc
- unconvert
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on: [push, pull_request]

jobs:
golang:
name: Build and test cboring

runs-on: ubuntu-latest

strategy:
matrix:
go: [ '1.13', '1.15' ]

steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Check out code
uses: actions/checkout@v2

- name: Build on Go ${{ matrix.go }}
run: go build ./...

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


golangci:
name: Check golangci-lint

runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v2

- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.32
args: --config .github/.golangci.yml
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.iml
.idea
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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)
# 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)

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


[bpbis]: https://tools.ietf.org/html/draft-ietf-dtn-bpbis-14
[bpbis]: https://tools.ietf.org/html/draft-ietf-dtn-bpbis-29
[cbor]: https://tools.ietf.org/html/rfc7049
[dtn7-go]: https://github.com/dtn7/dtn7-go
4 changes: 2 additions & 2 deletions major_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ func TestReadMajorsBig(t *testing.T) {
func TestReadMajorsError(t *testing.T) {
tests := [][]byte{
// Empty stream
[]byte{},
{},
// Incomplete streams
[]byte{0x18}, []byte{0x19, 0x03},
{0x18}, {0x19, 0x03},
}

for _, test := range tests {
Expand Down
8 changes: 4 additions & 4 deletions primitives_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ func TestUInt(t *testing.T) {
func TestReadUIntError(t *testing.T) {
tests := [][]byte{
// Wrong major type
[]byte{0xFF},
{0xFF},
// Wrong additionals for major type 0
[]byte{0x1F},
{0x1F},
// Empty stream
[]byte{},
{},
// Incomplete streams
[]byte{0x18}, []byte{0x1b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
{0x18}, {0x1b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
}

for _, test := range tests {
Expand Down

0 comments on commit 10e1b5c

Please sign in to comment.