Skip to content

Commit

Permalink
Merge pull request #105 from naveensrinivasan/feat/makefile
Browse files Browse the repository at this point in the history
Feat - Implemented Makefile and actions for PR
  • Loading branch information
inferno-chromium committed Dec 22, 2020
2 parents c308663 + a56f707 commit 2d348a7
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- master
- main
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.29
args: --timeout=5m
only-new-issues: true
23 changes: 23 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: build
on: [push, pull_request]
jobs:
validate:
name: Validate
runs-on: ubuntu-latest
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Clone the code
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '^1.15'
- name: fmt check
run: make fmt
- name: go mod tidy
run: make tidy
- name: Run tests
run: make test
- name: Build
run: make build
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ scorecard
# Output of the go coverage tool, specifically when used with LiteIDE.
*.out


# IDE directories.
.vscode/
*.iml

# tools
bin
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
build:
go build

fmt:
go fmt ./...

test:
go test -covermode atomic -coverprofile=profile.out ./...

tidy:
go mod tidy

GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
golangci-lint:
@[ -f $(GOLANGCI_LINT) ] || { \
set -e ;\
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.29.0 ;\
}

lint: golangci-lint ## Run golangci-lint linter
$(GOLANGCI_LINT) run

0 comments on commit 2d348a7

Please sign in to comment.