-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup project boilerplate.
- Loading branch information
0 parents
commit 04bc579
Showing
8 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: test | ||
runs-on: [ubuntu-latest] | ||
|
||
steps: | ||
- name: checkout the code | ||
uses: actions/checkout@v3 | ||
|
||
- name: setup go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.20.x' | ||
|
||
- name: unshallow | ||
run: git fetch --prune --unshallow | ||
|
||
- name: golanci-linter | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.53.3 | ||
|
||
- name: run unit tests | ||
run: make test | ||
|
||
- name: upload code coverage | ||
uses: codecov/codecov-action@v3.1.1 | ||
if: contains(github.ref, 'main') | ||
with: | ||
file: ./cover.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cover* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
run: | ||
timeout: "120s" | ||
|
||
output: | ||
format: "colored-line-number" | ||
|
||
linters: | ||
enable: | ||
- gocyclo | ||
- unconvert | ||
- goimports | ||
- unused | ||
- vetshadow | ||
- misspell | ||
- nakedret | ||
- errcheck | ||
- revive | ||
- ineffassign | ||
- goconst | ||
- vet | ||
- unparam | ||
- gofumpt | ||
- prealloc | ||
- gomnd | ||
- gocritic | ||
|
||
|
||
linters-settings: | ||
revive: | ||
rules: | ||
- name: package-comments | ||
disabled: true | ||
|
||
issues: | ||
exclude-use-default: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2023 Fábio da Silva Ribeiro | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.DEFAULT_GOAL := help | ||
|
||
clean: ## clean up files generated by coverage or go mod | ||
@rm -fR ./vendor/ ./cover.* | ||
.PHONY: clean | ||
|
||
cover: test ## run unit tests and generates the html coverage file | ||
@go tool cover -html=./cover.text -o ./cover.html | ||
@test -f ./cover.text && rm ./cover.text; | ||
.PHONY: cover | ||
|
||
help: ## display help screen | ||
@sed \ | ||
-e '/^[a-zA-Z0-9_\-]*:.*##/!d' \ | ||
-e 's/:.*##\s*/:/' \ | ||
-e 's/^\(.\+\):\(.*\)/$(shell tput setaf 6)\1$(shell tput sgr0):\2/' \ | ||
$(MAKEFILE_LIST) | column -c2 -t -s : | ||
@echo '' | ||
.PHONY: help | ||
|
||
lint: ## golangci linters | ||
@golangci-lint run ./... | ||
.PHONY: lint | ||
|
||
test: ## run unit tests | ||
@go test -v -race -coverprofile=./cover.text -covermode=atomic $(shell go list ./...) | ||
.PHONY: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Golang Movies API - Demo | ||
|
||
[![Codecov branch](https://img.shields.io/codecov/c/github/faabiosr/go-movies-demo/master.svg?style=flat-square)](https://codecov.io/gh/faabiosr/go-movies-demo) | ||
[![Go Report Card](https://goreportcard.com/badge/github.com/faabiosr/go-movies-demo?style=flat-square)](https://goreportcard.com/report/github.com/faabiosr/go-movies-demo) | ||
[![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://github.com/faabiosr/go-movies-demo/blob/master/LICENSE) | ||
|
||
Movies API | ||
|
||
## Development | ||
|
||
### Requirements | ||
|
||
The entire environment is based in Golang, and you need install the tools below: | ||
- Install [Go](https://golang.org) | ||
- Install [GolangCI-Lint](https://github.com/golangci/golangci-lint#install) - Linter | ||
|
||
### Makefile | ||
|
||
Please run the make target below to see the provided targets. | ||
|
||
```sh | ||
$ make help | ||
``` | ||
|
||
## License | ||
|
||
This project is released under the MIT licence. See [LICENSE](https://github.com/faabiosr/go-movies-demo/blob/master/LICENSE) for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
fmt.Println("It's work!") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/faabiosr/go-movies-demo | ||
|
||
go 1.20 |