From 4db1522a3900074c40d8c4e816227dd83962fc11 Mon Sep 17 00:00:00 2001 From: KostLinux Date: Tue, 28 May 2024 20:23:32 +0300 Subject: [PATCH] Added templates --- .github/ISSUE_TEMPLATE/bug_report.md | 4 +- .github/ISSUE_TEMPLATE/feature_request.md | 4 +- .../ISSUE_TEMPLATE/hotfix-issue-template.md | 30 +++++++++ .github/dependabot.yml | 13 ++-- .github/linters/.golangci.yml | 61 ++++++++++++++++++ .github/pull_request_template.md | 40 ++++++++++++ .github/workflows/linter.yml | 64 +++++++++++++++++++ 7 files changed, 208 insertions(+), 8 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/hotfix-issue-template.md create mode 100644 .github/linters/.golangci.yml create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/linter.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 2d78a5f..e8c3036 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -3,7 +3,7 @@ name: Bug report about: Create a report to help us improve title: "[BUG] YOUR_TITLE" labels: bug -assignees: 'KostLinux' +assignees: '' --- @@ -30,4 +30,4 @@ If applicable, add screenshots to help explain your problem. - Version [e.g. 22] **Additional context** -Add any other context about the problem here. \ No newline at end of file +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 9b7c1dd..115d28e 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -3,7 +3,7 @@ name: Feature request about: Suggest an idea for this project title: "[FEATURE] YOUR_TITLE" labels: enhancement -assignees: 'KostLinux' +assignees: '' --- @@ -17,4 +17,4 @@ A clear and concise description of what you want to happen. A clear and concise description of any alternative solutions or features you've considered. **Additional context** -Add any other context or screenshots about the feature request here. \ No newline at end of file +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/hotfix-issue-template.md b/.github/ISSUE_TEMPLATE/hotfix-issue-template.md new file mode 100644 index 0000000..203cad3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/hotfix-issue-template.md @@ -0,0 +1,30 @@ +--- +name: Hotfix issue template +about: Describe this issue template's purpose here. +title: "[HOTFIX] YOUR_TITLE" +labels: hotfix +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what to fix. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Device (please complete the following information):** + - Device: [e.g. Mac, iPhone] + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a130155..8ebc54a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,8 +1,13 @@ +# Basic set up for three package managers version: 2 updates: + # Maintain dependencies for Composer - package-ecosystem: "gomod" - directory: "/" - schedule: - interval: "monthly" + directory: "./" reviewers: - - "KostLinux" \ No newline at end of file + - "KostLinux" + schedule: + interval: "weekly" + commit-message: + prefix: '[Go Modules]' + include: scope \ No newline at end of file diff --git a/.github/linters/.golangci.yml b/.github/linters/.golangci.yml new file mode 100644 index 0000000..f77e6fc --- /dev/null +++ b/.github/linters/.golangci.yml @@ -0,0 +1,61 @@ +run: + # Default concurrency is an available CPU number + concurrency: 4 + + # Timeout for analysis, e.g. 30s, 5m, default is 1m + deadline: 5m + + # Include test files or not, default is true + tests: true + +# Settings of specific linters +linters-settings: + gocyclo: + min-complexity: 20 + +linters: + # do not use `enable-all`: it's deprecated and will be removed soon. + disable-all: true + enable: + - asasalint + - asciicheck + - bidichk + - bodyclose + - dogsled + - durationcheck + - errcheck + - errchkjson + - execinquery + - exportloopref + - forbidigo + - gocognit + - goconst + - gocritic + - godox + - gofmt + - gofumpt + - goimports + - goprintffuncname + - gosimple + - govet + - ineffassign + - misspell + - nakedret + - nestif + - nilerr + - nonamedreturns + - prealloc + - predeclared + - revive + - staticcheck + - stylecheck + - tenv + - typecheck + - unconvert + - unparam + - unused + - usestdlibvars + - whitespace + +issues: + max-same-issues: 0 diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..ee19226 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,40 @@ +# Description + +Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. + +Fixes # (issue) + +## Dependencies + +- Dependency 1 +- Dependency 2 + +## Type of change + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update + +# How Has This Been Tested? + +Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration + +- [ ] Some Feature Test A ( for example - API Request against third party API point ) +- [ ] Some Feature Test B ( for example - API Data Response Check via Postman / Curl ) + +**Test Configuration**: +* Device: +* Tools (optional): +* SDK (optional): + +# Checklist: + +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my code +- [ ] I have commented my code, particularly in hard-to-understand areas (optional) +- [ ] I have made corresponding changes to the documentation (optional) +- [ ] My changes generate no new warnings +- [ ] I've performed/added tests/lints that prove my fix is effective or that my feature works (optional) + +Before creating pull request, look that all points under checklist are done! \ No newline at end of file diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..e46052a --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,64 @@ +name: Build +on: + pull_request: + types: + - opened + - edited + - closed + branches: + - main + +permissions: + contents: read + packages: read + statuses: write + pull-requests: write + +jobs: + read_changes: + runs-on: ubuntu-latest + outputs: + go: ${{ steps.changes.outputs.go }} + src: ${{ steps.changes.outputs.src }} + steps: + - uses: actions/checkout@v4 + + - uses: dorny/paths-filter@v2 + id: changes + with: + filters: | + go: + - 'main.go' + - 'go.mod' + - 'controller/**' + - 'middleware/**' + - 'model/**' + - 'repository/**' + - 'service/**' + src: + - '.github/**' + - 'doc/**' + + golangci: + needs: read_changes + if: needs.read_changes.outputs.go == 'true' + name: Lint Backend + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v4 + with: + go-version: '1.21' + cache: false + + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54 + working-directory: ./ + args: --timeout=30m --config=./.golangci.yml --issues-exit-code=0 + only-new-issues: true + skip-cache: true + skip-pkg-cache: true + \ No newline at end of file