Skip to content

Commit

Permalink
add github action workflow files and linter settings
Browse files Browse the repository at this point in the history
  • Loading branch information
gulumser.aslan committed Nov 5, 2022
1 parent 433c817 commit cf1ff79
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 🔨 Build And Test

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Install dependencies
run: go get .

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.50
args: -c .golangci.yml -v

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 🎉 Release

on:
pull_request:
push:
tags:
- 'v*.*.*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40 changes: 40 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
linters-settings:
lll:
line-length: 140
funlen:
lines: 70

linters:
disable-all: true
enable:
- bodyclose
- depguard
- errcheck
- dupl
- exhaustive
- funlen
- goconst
- gocritic
- gocyclo
- revive
- gosimple
- govet
- gosec
- ineffassign
- lll
- misspell
- nakedret
- gofumpt
- nolintlint
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- whitespace

service:
golangci-lint-version: 1.50.x # use the fixed version to not introduce new linters unexpectedly
prepare:
- echo "here I can run custom commands, but no preparation needed for this repo"
49 changes: 49 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
env:
- CGO_ENABLED=0
- GOFLAGS=-mod=vendor
- GO111MODULE=auto

before:
hooks:
- go mod download
- go mod vendor

builds:
- id: binary
main: ./example/main.go
goos:
- linux
- darwin
- windows
goarch:
- amd64
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=GoReleaser

archives:
- builds:
- binary
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: x86
amd64: x86_64
format_overrides:
- goos: windows
format: zip
files: ["README.md"]

checksum:
name_template: 'checksums.txt'
algorithm: sha256

snapshot:
name_template: "{{ .Tag }}-next"

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package godcpclient

import "fmt"

func main() {
fmt.Print("Hello world")
}

0 comments on commit cf1ff79

Please sign in to comment.