Skip to content

Commit

Permalink
Add golinter to master and pr
Browse files Browse the repository at this point in the history
  • Loading branch information
arminc committed May 23, 2020
1 parent a716762 commit fd078e1
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 34 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Install golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.27.0

- name: Run test steps
run: ./test.sh -a

Expand All @@ -38,3 +41,8 @@ jobs:

- name: Go report card
uses: creekorful/goreportcard-action@v1.0

- name: Release drafter
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_REPO }}
7 changes: 6 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ jobs:
uses: actions/checkout@v2

- name: Run test steps
run: ./test.sh -a
run: ./test.sh -d -t -b

- name: golangci-lint
uses: reviewdog/action-golangci-lint@v1
with:
github_token: ${{ secrets.TOKEN_REPO }}
14 changes: 0 additions & 14 deletions .github/workflows/release-drafter.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflows/reviewdog.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: go-mod-tidy-pr
name: Weekly schedule

on:
schedule:
- cron: "0 0 * * 1" # Weekly build
- cron: "0 0 * * 1"

jobs:
go-mod-tidy-pr:
name: go-mod-tidy-pr
weekly:
name: Golang mod tidy check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Run go-mod-tidy-pr
uses: sue445/go-mod-tidy-pr@master
with:
Expand Down
10 changes: 9 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ RUNALL=false
DEPENDENCIES=false
TESTS=false
BUILD=false
LINTER=false

print_usage() {
echo "Program usage: [./script.sh flags]
Expand All @@ -14,19 +15,21 @@ print_usage() {
Flag: -d [Get dependencies]
Flag: -t [Run tests with coverage]
Flag: -b [Run a build as test]
Flag: -l [Run golangci-lint]
Flag: -h [Print help message]
"
}

while getopts 'hadtb' flag; do
while getopts 'hadtbl' flag; do
case "${flag}" in
h) print_usage
exit 0 ;;
a) RUNALL=true ;;
d) DEPENDENCIES=true ;;
t) TESTS=true ;;
b) BUILD=true ;;
l) LINTER=true ;;
*) print_usage
exit 1 ;;
esac
Expand All @@ -37,6 +40,11 @@ if [[ ${DEPENDENCIES} == true || ${RUNALL} == true ]]; then
go get -v -t -d ./...
fi

if [[ ${LINTER} == true || ${RUNALL} == true ]]; then
echo "Run golangci-lint"
golangci-lint run
fi

if [[ ${TESTS} == true || ${RUNALL} == true ]]; then
echo "Run test with coverage"
go test -v ./... -race -coverprofile=coverage.txt -covermode=atomic
Expand Down

0 comments on commit fd078e1

Please sign in to comment.