diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..a142f30 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,16 @@ +name: Tests +on: [push, pull_request] +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: "1.17.8" + - run: make fmt + - run: make race + - run: make test + # Enable when fixed (same as make lint) + # - name: golangci-lint + # uses: golangci/golangci-lint-action@v2 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 452601e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: go -go_import_path: go.etcd.io/bbolt - -sudo: false - -go: -- 1.15 - -before_install: -- go get -v golang.org/x/sys/unix -- go get -v honnef.co/go/tools/... -- go get -v github.com/kisielk/errcheck - -script: -- make fmt -- make test -- make race -# - make errcheck diff --git a/Makefile b/Makefile index 21ecf48..1623c84 100644 --- a/Makefile +++ b/Makefile @@ -10,17 +10,8 @@ race: fmt: !(gofmt -l -s -d $(shell find . -name \*.go) | grep '[a-z]') -# go get honnef.co/go/tools/simple -gosimple: - gosimple ./... - -# go get honnef.co/go/tools/unused -unused: - unused ./... - -# go get github.com/kisielk/errcheck -errcheck: - @errcheck -ignorepkg=bytes -ignore=os:Remove go.etcd.io/bbolt +lint: + golangci-lint run ./... test: TEST_FREELIST_TYPE=hashmap go test -timeout 20m -v -coverprofile cover.out -covermode atomic @@ -33,4 +24,4 @@ test: # Note: gets "program not an importable package" in out of path builds @TEST_FREELIST_TYPE=array go test -v ./cmd/bbolt -.PHONY: race fmt errcheck test gosimple unused +.PHONY: race fmt test lint diff --git a/db_test.go b/db_test.go index f6f7de2..a512a01 100644 --- a/db_test.go +++ b/db_test.go @@ -30,7 +30,7 @@ const pageHeaderSize = 16 // meta represents a simplified version of a database meta page for testing. type meta struct { - magic uint32 + _ uint32 version uint32 _ uint32 _ uint32 @@ -38,7 +38,7 @@ type meta struct { _ uint64 pgid uint64 _ uint64 - checksum uint64 + _ uint64 } // Ensure that a database can be opened without error.