Skip to content

Commit

Permalink
Merge pull request #4 from BrosSquad/feat/rework
Browse files Browse the repository at this point in the history
Refactor whole app
  • Loading branch information
CodeLieutenant authored Oct 31, 2023
2 parents b2919f5 + 15cc1bd commit 2ecfecb
Show file tree
Hide file tree
Showing 59 changed files with 1,194 additions and 1,680 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Build Base"

on:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.21"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: |
task build
20 changes: 20 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Build"

on:
push:
paths:
- "cmd/**"
- "pkg/**"
- "main.go"
branches:
- master
pull_request:
paths:
- "cmd/**"
- "pkg/**"
- "main.go"
branches:
- master
jobs:
build:
uses: "./.github/workflows/build-base.yml"
22 changes: 14 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
name: 'GolangCI Lint'

on:
pull_request:
push:
paths:
- 'pkg/**'
- 'main.go'
branches:
- master
- develop
workflow_call:
push:
pull_request:
paths:
- 'pkg/**'
- 'main.go'
branches:
- master
- develop
jobs:
golangci-lint:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
Expand Down
44 changes: 19 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,39 @@
name: 'Tests'
name: "Testing"

on:
push:
paths:
- "pkg/**"
- "main.go"
branches:
- master
- develop
pull_request:
paths:
- "pkg/**"
- "main.go"
branches:
- master
- develop

jobs:
unit-tests:
strategy:
matrix:
go: [ 1.20 ]
go: ["1.21"]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- uses: actions/cache@v3
- name: Install Task
uses: arduino/setup-task@v1
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set up gotestfmt
run: go install gotesttools/gotestfmt@latest
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: |
go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
cp config.example.yml config.yml
go test -covermode=atomic -coverprofile=coverage.txt -timeout 5m -json -v ./... | gotestfmt -showteststatus
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
flags: tests
name: codecov-umbrella
fail_ci_if_error: true
verbose: true
task test
97 changes: 97 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
run:
concurrency: 16
timeout: 5m
issues-exit-code: 1
tests: true

skip-dirs:
- docs/

skip-files:
- "*_gen\\.go$"

modules-download-mode: mod
allow-parallel-runners: true
go: '1.21'

output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
sort-results: true

linters:
disable-all: true
enable:
- asasalint
- bidichk
- bodyclose
- decorder
- dupl
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
- exportloopref
- forbidigo
- gofumpt
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoglobals
- gocognit
- goconst
- gocritic
- gocyclo
- godox
- goerr113
- goheader
- goimports
- gomodguard
- goprintffuncname
- gosec
- gosimple
- gosmopolitan
- govet
- grouper
- importas
- ineffassign
- interfacebloat
- loggercheck
- maintidx
- makezero
- mirror
- misspell
- nakedret
- nestif
- nilerr
- nilnil
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
- paralleltest
- prealloc
- predeclared
- promlinter
- reassign
- revive
- rowserrcheck
- sqlclosecheck
- staticcheck
- stylecheck
- tenv
- testableexamples
- testpackage
- thelper
- tparallel
- unconvert
- unparam
- unused
- usestdlibvars
- wastedassign
- whitespace
- zerologlint
- prealloc
- perfsprint
32 changes: 32 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"recommendations": [
"task.vscode-task",
"rogalmic.bash-debug",
"mads-hartmann.bash-ide-vscode",
"ms-vscode-remote.remote-containers",
"ms-azuretools.vscode-docker",
"p1c2u.docker-compose",
"usernamehw.errorlens",
"github.vscode-github-actions",
"eamodio.gitlens",
"golang.go",
"mongodb.mongodb-vscode",
"christian-kohler.path-intellisense",
"uniquevision.vscode-plpgsql-lsp",
"foxundermoon.shell-format",
"timonwong.shellcheck",
"mtxr.sqltools",
"JordanHury.sqltools-cassandra",
"mtxr.sqltools-driver-pg",
"wayou.vscode-todo-highlight",
"tooltitudeteam.tooltitude",
"pflannery.vscode-versionlens",
"zxh404.vscode-proto3",
"redhat.vscode-yaml",
"ms-vscode.test-adapter-converter",
"GitHub.vscode-pull-request-github",
"ms-vscode.remote-repositories",
"ms-vsliveshare.vsliveshare",
"aaron-bond.better-comments"
]
}
13 changes: 3 additions & 10 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "0.2.0",
"configurations": [
{
"name": "Debug Boilerplate Server",
"name": "Debug Server",
"type": "go",
"request": "attach",
"mode": "remote",
Expand All @@ -11,19 +11,12 @@
"host": "127.0.0.1"
},
{
"name": "Debug Boilerplate",
"name": "Debug",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "main.go",
"args": [
"serve",
"--env",
"development",
"--log-level",
"debug",
"--log-pretty-print"
]
"args": ["serve"]
},
{
"name": "Attach to Process",
Expand Down
Loading

0 comments on commit 2ecfecb

Please sign in to comment.