From 77b4cfeee1c804b53caebca3106b1fe7c2c20d9a Mon Sep 17 00:00:00 2001 From: Christian Rebischke Date: Sat, 18 Dec 2021 14:01:43 +0100 Subject: [PATCH] fix: update Go and CI / tests --- .github/workflows/test.yaml | 33 +++++++++++++++++++++++++++++++++ .golangci.yaml | 17 +++++++++++++++++ README.md | 6 ++---- go.mod | 2 +- 4 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/test.yaml create mode 100644 .golangci.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..e5a1bf0 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,33 @@ +name: test +on: [push, pull_request] +jobs: + test: + strategy: + matrix: + go-version: [1.16.x, 1.17.x] + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - name: Download test data + run: curl -L https://raw.githubusercontent.com/package-url/purl-spec/master/test-suite-data.json -o testdata/test-suite-data.json + - name: Test go fmt + run: test -z $(go fmt ./...) + - name: Golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + only-new-issues: true + - name: Test coverage + run: go test -covermode atomic -coverprofile='profile.cov' ./... + - name: Send coverage + if: runner.os == 'Linux' + env: + COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + GO111MODULE=off go get github.com/mattn/goveralls + $(go env GOPATH)/bin/goveralls -coverprofile=profile.cov -service=github \ No newline at end of file diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..73a5741 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,17 @@ +# individual linter configs go here +linters-settings: + +# default linters are enabled `golangci-lint help linters` +linters: + disable-all: true + enable: + - deadcode + - errcheck + - gosimple + - govet + - ineffassign + - staticcheck + - structcheck + - typecheck + - unused + - varcheck \ No newline at end of file diff --git a/README.md b/README.md index 68b42ac..11a8c1e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # packageurl-go -Go implementation of the package url spec - -[![Build Status](https://travis-ci.com/package-url/packageurl-go.svg)](https://travis-ci.com/package-url/packageurl-go) +Go implementation of the package url spec. ## Install @@ -55,7 +53,7 @@ func main() { ## Test -Testing using the normal ``go test`` command. Using ``make test`` will pull down the test fixtures shared between all package-url projects and then execute the tests. +Testing using the normal ``go test`` command. Using ``make test`` will pull the test fixtures shared between all package-url projects and then execute the tests. ``` $ make test diff --git a/go.mod b/go.mod index a9aeaf8..3c8d0ad 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/package-url/packageurl-go -go 1.12 +go 1.17