From 4b8a986bc944042abb3e7d732a1363dbae7f16e8 Mon Sep 17 00:00:00 2001 From: Henrique Holanda Date: Mon, 19 Aug 2024 15:34:04 -0300 Subject: [PATCH] ci: creating github actions config (#22) * ci: creating github actions config * ci: bump setup-go version * ci: add lint pipeline * ci: fix go version --- .github/workflows/actions.yml | 26 ++++++++++++++++++++++++++ .github/workflows/golangci-lint.yml | 25 +++++++++++++++++++++++++ .travis.yml | 15 --------------- Makefile | 22 +--------------------- README.md | 2 +- go.mod | 3 +++ go.sum | 0 7 files changed, 56 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/actions.yml create mode 100644 .github/workflows/golangci-lint.yml delete mode 100644 .travis.yml create mode 100644 go.mod create mode 100644 go.sum diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 0000000..82d4c76 --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,26 @@ +name: pipeline + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22' + + - name: Install dependencies + run: make depend + + - name: Run tests + run: make test diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..09fdc89 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,25 @@ +name: golangci-lint +on: + push: + branches: + - main + - master + pull_request: + +permissions: + contents: read + pull-requests: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: '1.22' + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: latest \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2e39581..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: go - -go: - - "1.11" - - master - -install: - - make depend - -script: - - make test - - make lint - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/Makefile b/Makefile index fbc0d7b..9ae9413 100644 --- a/Makefile +++ b/Makefile @@ -12,8 +12,7 @@ cover: test # Download dependencies depend: - @go get -u gopkg.in/alecthomas/gometalinter.v2 - @gometalinter.v2 --install + go mod tidy .PHONY: depend # Format all go files @@ -21,25 +20,6 @@ fmt: gofmt -s -w -l $(shell go list -f {{.Dir}} ./...) .PHONY: fmt -# Run linters -lint: - @gometalinter.v2 \ - --disable-all \ - --exclude=vendor \ - --deadline=180s \ - --enable=gofmt \ - --linter='errch:errcheck {path}:PATH:LINE:MESSAGE' \ - --enable=errch \ - --enable=vet \ - --enable=gocyclo \ - --cyclo-over=15 \ - --enable=golint \ - --min-confidence=0.85 \ - --enable=ineffassign \ - --enable=misspell \ - ./.. -.PHONY: lint - # Run tests test: @go test -v -race -coverprofile=./coverage.text -covermode=atomic $(shell go list ./...) diff --git a/README.md b/README.md index b505e4a..a6d58d8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Brazanation Documents - Golang -[![Build Status](https://img.shields.io/travis/brazanation/go-documents/master.svg?style=flat-square)](https://travis-ci.org/brazanation/go-documents) +![Build status]((https://github.com/brazanation/go-documents/actions/workflows/actions.yml/badge.svg)) [![Codecov branch](https://img.shields.io/codecov/c/github/brazanation/go-documents/master.svg?style=flat-square)](https://codecov.io/gh/brazanation/go-documents) [![GoDoc](https://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](https://godoc.org/github.com/brazanation/go-documents) [![Go Report Card](https://goreportcard.com/badge/github.com/brazanation/go-documents?style=flat-square)](https://goreportcard.com/report/github.com/brazanation/go-documents) diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..34c2e3f --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/brazanation/go-documents + +go 1.22 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..e69de29