Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CI working again #86

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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 }}
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

19 changes: 9 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,23 @@ install:
.PHONY: install

install-dependencies:
go mod vendor
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I am not sure why go mod vendor is used here. But it's useless without either -mod=vendor flag for all go commands or GOFLAGS=-mod=vendor env variable.

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:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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