Skip to content

Commit

Permalink
feat: add CI scripts and linters
Browse files Browse the repository at this point in the history
  • Loading branch information
freak12techno committed Jul 16, 2022
1 parent a1f893d commit 9aeeb47
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: test
on: [push]
jobs:
go-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-go@v2
with:
go-version: '^1.18.0'
- run: go version
- run: go mod download
- run: go build
go-vet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-go@v2
with:
go-version: '^1.18.0'
- run: go version
- run: go mod download
- run: go vet
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
args: --timeout 300s
34 changes: 34 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: goreleaser

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Fetch all tags
run: git fetch --force --tags

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
linters-settings:
gocritic:
disabled-checks:
- ifElseChain
gosec:
excludes:
- G402
- G404
revive:
rules:
- name: var-declaration
disabled: true

linters:
enable-all: true
disable:
- prealloc
- lll
- dupl
- funlen
- wsl
- gomnd
- unparam
- goerr113
- nestif
- errcheck
- golint
- scopelint
- maligned
- interfacer
- wrapcheck
- varnamelen
- tagliatelle
- exhaustivestruct
- gomoddirectives
- ireturn
- nlreturn
- cyclop
- errorlint
- noctx
- gocognit
- gochecknoglobals
- gosec
- exportloopref
- stylecheck
- exhaustruct
27 changes: 27 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

0 comments on commit 9aeeb47

Please sign in to comment.