diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..981dce2 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,61 @@ +name: Tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + tests: + name: Test code + runs-on: ${{ matrix.os }} + strategy: + matrix: + go: + - ^1.14 + - ^1.15 + - ^1.16 + - ^1 + os: + - ubuntu-latest + - macos-latest + steps: + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + + - name: Check out code + uses: actions/checkout@v2 + + - name: Checkout to the latest tag + run: | + # Fetch all tags + git fetch --depth=1 --tags + # Get the latest tag + VERS=$(git tag -l | sort -Vr | head -n1) + # Fetch everything to the latest tag + git fetch --shallow-since=$(git log $VERS -1 --format=%at) + if: ${{ github.event_name == 'push' }} # only when built from master + + - name: Install dependencies + run: | + make install-dependencies + make install-tools + make install + + - name: Linting + run: make lint + + - name: Testing + run: | + make test-verbose-with-coverage + gover + + - name: Coverage + run: goveralls -coverprofile=gover.coverprofile -service=github + env: + COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3a77dcf..0000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: go - -os: - - linux - - osx - -go: - - 1.11.x - - 1.12.x - -env: - global: - - GO111MODULE: "on" - -install: - - make install-dependencies - - make install-tools - - make install - -script: - - make lint - - make test-verbose-with-coverage - - gover - - if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then goveralls -coverprofile=gover.coverprofile -service=travis-ci; fi diff --git a/Makefile b/Makefile index e35747d..7bb9aed 100644 --- a/Makefile +++ b/Makefile @@ -36,24 +36,23 @@ install: .PHONY: install install-dependencies: - go mod vendor - go test -i -v $(PKG)/... + go get .PHONY: install-dependencies install-tools: # generation - go get golang.org/x/tools/cmd/stringer + go install golang.org/x/tools/cmd/stringer # linting - go get golang.org/x/lint/golint/... - go get github.com/kisielk/errcheck/... - go get honnef.co/go/tools/... + go install golang.org/x/lint/golint/... + go install github.com/kisielk/errcheck/... + go install honnef.co/go/tools/... # code coverage - go get golang.org/x/tools/cmd/cover - go get github.com/onsi/ginkgo/ginkgo/... - go get github.com/modocache/gover/... - go get github.com/mattn/goveralls/... + go install golang.org/x/tools/cmd/cover + go install github.com/onsi/ginkgo/ginkgo/... + go install github.com/modocache/gover/... + go install github.com/mattn/goveralls/... .PHONY: install-tools lint: diff --git a/README.md b/README.md index b5873a1..19c8ea0 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Mutation testing is also especially interesting for comparing automatically gene go-mutesting includes a binary which is go-getable. ```bash -go get -t -v github.com/zimmski/go-mutesting/... +go install github.com/zimmski/go-mutesting/cmd/go-mutesting@latest ``` The binary's help can be invoked by executing the binary without arguments or with the `--help` argument. diff --git a/scripts/lint.sh b/scripts/lint.sh index 26c27ff..5b767a2 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -4,23 +4,23 @@ if [ -z ${PKG+x} ]; then echo "PKG is not set"; exit 1; fi if [ -z ${ROOT_DIR+x} ]; then echo "ROOT_DIR is not set"; exit 1; fi echo "gofmt:" -OUT=$(gofmt -l -s $ROOT_DIR 2>&1 | grep --invert-match -E "(/(example|vendor))") +OUT=$(gofmt -l -s "$ROOT_DIR" 2>&1 | grep --invert-match -E "(/(example|vendor))") if [ -n "$OUT" ]; then echo "$OUT"; PROBLEM=1; fi echo "errcheck:" -OUT=$(errcheck $PKG/... 2>&1 | grep --invert-match -E "(/(example|vendor))") +OUT=$(errcheck "$PKG/..." 2>&1 | grep --invert-match -E "(/(example|vendor))") if [ -n "$OUT" ]; then echo "$OUT"; PROBLEM=1; fi echo "go vet:" -OUT=$(go vet -all=true $ROOT_DIR 2>&1 | grep --invert-match -E "(Checking file|\%p of wrong type|can't check non-constant format|/example|/vendor)") +OUT=$(go vet -all=true "$ROOT_DIR" 2>&1 | grep --invert-match -E "(Checking file|\%p of wrong type|can't check non-constant format|/example|/vendor)") if [ -n "$OUT" ]; then echo "$OUT"; PROBLEM=1; fi echo "golint:" -OUT=$(golint $PKG/... 2>&1 | grep --invert-match -E "(/(example|vendor))") +OUT=$(golint ./... 2>&1 | grep --invert-match -E "(^(example|vendor))") if [ -n "$OUT" ]; then echo "$OUT"; PROBLEM=1; fi echo "staticcheck:" -OUT=$(staticcheck $PKG/... 2>&1 | grep --invert-match -E "((example|vendor)/)") +OUT=$(staticcheck "$PKG/..." 2>&1 | grep --invert-match -E "((example|vendor)/)") if [ -n "$OUT" ]; then echo "$OUT"; PROBLEM=1; fi if [ -n "$PROBLEM" ]; then exit 1; fi