Skip to content

Commit

Permalink
Refactoring first part of the library
Browse files Browse the repository at this point in the history
Signed-off-by: Dusan Malusev <dusan@dusanmalusev.dev>
  • Loading branch information
CodeLieutenant committed Apr 16, 2024
1 parent ba54e0c commit 7f45376
Show file tree
Hide file tree
Showing 43 changed files with 479 additions and 5,628 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@ on:
- 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
- uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-tests-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-tests-${{ hashFiles('**/go.sum') }}
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_flags: "--tests=false"
golangci_lint_flags: "--config=.golangci.yml"
cache: true
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: 'Create Release'

on:
push:
tags:
- 'v*'

jobs:
create_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Get Tag
if: startsWith(github.ref, 'refs/tags/v')
uses: olegtarasov/get-tag@v2.1.3
id: version_tag
with:
tagRegex: "v(.*)"
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
id: release
with:
name: "v${{ steps.version_tag.outputs.tag }}"
tag_name: "v${{ steps.version_tag.outputs.tag }}"
generate_release_notes: true
append_body: true
prerelease: false
fail_on_unmatched_files: true
- name: "Generate release changelog"
uses: heinrichreimer/action-github-changelog-generator@v2.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
author: true
releaseUrl: ${{ steps.release.outputs.url }}
issues: false
pullRequests: true
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Update CHANGELOG.md"
branch: master
commit_options: '--no-verify --signoff'
file_pattern: CHANGELOG.md
13 changes: 13 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
on: [push, pull_request]
name: Security
jobs:
Gosec:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Gosec
uses: securego/gosec@master
with:
args: ./...
41 changes: 32 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,48 @@
name: 'Tests'
name: 'Testing'

on:
workflow_call:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
jobs:
tests:
test:
strategy:
matrix:
go: [ '1.20' ]
runs-on: ubuntu-latest
os: ['ubuntu-latest']
go: [ '1.22' ]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-tests-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-tests-${{ hashFiles('**/go.sum') }}
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Set up gotestfmt
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: go test -covermode=atomic -coverprofile=coverage.txt -timeout 5m -json -v ./... | gotestfmt -showteststatus
run: |
go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
task test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: nano-interactive/go-amqp
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

68 changes: 67 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,71 @@
"debug.allowBreakpointsEverywhere": true,
"debug.console.historySuggestions": true,
"debug.console.collapseIdenticalLines": true,
"ansible.python.interpreterPath": "/bin/python"
"ansible.python.interpreterPath": "/bin/python",
"files.associations": {
"*main.yml": "ansible",
"string_view": "cpp",
"istream": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"set": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"format": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"limits": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"span": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"text_encoding": "cpp",
"thread": "cpp",
"typeinfo": "cpp",
"variant": "cpp"
}
}
File renamed without changes.
31 changes: 0 additions & 31 deletions Makefile

This file was deleted.

43 changes: 43 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: '3'

tasks:
fmt:
cmds:
- gofumpt -l -w .
lint:
cmds:
- golangci-lint run --color "always" -v -j 8
sec:
cmds:
- gosec ./...
tidy:
cmds:
- rm -f go.sum
- go mod tidy
update:
cmds:
- go get -u ./... # Updates regular packages
- go get -u -t ./... # Updates Test packages
cli-tools:
cmds:
- go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- go install github.com/securego/gosec/v2/cmd/gosec@latest
- go install github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest
- go install github.com/ramya-rao-a/go-outline@latest
- go install github.com/cweill/gotests/gotests@latest
- go install github.com/fatih/gomodifytags@latest
- go install github.com/daixiang0/gci@latest
- go install github.com/josharian/impl@latest
- go install github.com/haya14busa/goplay/cmd/goplay@latest
- go install github.com/go-delve/delve/cmd/dlv@latest
- go install mvdan.cc/gofumpt@latest
- go install github.com/swaggo/swag/cmd/swag@latest
- go install github.com/cosmtrek/air@latest
- go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
- go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
test:
cmds:
- go test -covermode=atomic -race -coverprofile=coverage.txt -timeout 5m -json -v ./... | gotestfmt -showteststatus
env:
GOMAXPROCS: 4
Loading

0 comments on commit 7f45376

Please sign in to comment.