diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..9f1633c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,31 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[ BUG ] - " +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**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. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - Version [e.g. 22] + - OS + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..e1925d2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "[ Feature ] -" +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +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. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2e45a46 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + commit-message: + prefix: "workflows:" + schedule: + interval: weekly diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..75cc7cd --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,65 @@ +name: Go Tests +on: [push, pull_request] +jobs: + build-1_22: + name: Build 1.22 + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.22 + uses: actions/setup-go@v5 + with: + go-version: '1.22' + check-latest: true + cache: false + id: go + - name: Disable cgo + run: | + echo "CGO_ENABLED=0" >> $GITHUB_ENV + - name: Show version + run: go version + - name: Check out code + uses: actions/checkout@v4 + - name: Build + run: go build -v . + + build-1_23: + name: Build 1.23 + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.23 + uses: actions/setup-go@v5 + with: + go-version: '1.23' + check-latest: true + cache: false + id: go + - name: Disable cgo + run: | + echo "CGO_ENABLED=0" >> $GITHUB_ENV + - name: Show version + run: go version + - name: Check out code + uses: actions/checkout@v4 + - name: Build + run: go build -v . + + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.23 + uses: actions/setup-go@v5 + with: + go-version: '1.23' + check-latest: true + cache: false + id: go + - name: Disable cgo + run: | + echo "CGO_ENABLED=0" >> $GITHUB_ENV + - name: Show version + run: go version + - name: Check out code + uses: actions/checkout@v4 + - name: Test + run: go test -v ./... diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 0000000..c6c3f6d --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,76 @@ +name: Linters +on: [push, pull_request] +jobs: + golangci-lint: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.23 + uses: actions/setup-go@v5 + with: + go-version: '1.23' + check-latest: true + id: go + - name: Disable cgo + run: | + echo "CGO_ENABLED=0" >> $GITHUB_ENV + - name: Check out code + uses: actions/checkout@v4 + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.62.0 + args: -c .golangci.yml -v + skip-cache: true + + markdown-lint: + name: markdown-lint + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Markdown files linting + uses: avto-dev/markdown-lint@v1 + with: + args: '.' + + terrafmt: + name: terrafmt + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.23 + uses: actions/setup-go@v5 + with: + go-version: '1.23' + check-latest: true + skip-cache: true + id: go + - name: Show version + run: go version + - name: Check out code + uses: actions/checkout@v4 + - name: Check out terrafmt code + uses: actions/checkout@v4 + with: + repository: katbyte/terrafmt + ref: v0.5.2 + path: terrafmt + skip-cache: true + - name: Build terrafmt bin + run: cd terrafmt && go install ./... && cd ${GITHUB_WORKSPACE} + - name: Detect resource/data-source blocks without double quote on type and name (blocks not detected by terrafmt) + run: | + ! egrep -i '((resource|data)\s+[-a-z0-9_"]+)\s+[-a-z0-9_"]+\s+\{' bastion/*_test.go docs/*.md docs/*/*.md | egrep -i -v '((resource|data)\s+"[-a-z0-9_]+")\s+"[-a-z0-9_]+"\s+\{' + - name: Terrafmt diff on docs markdown + run: find docs | egrep "md$" | sort | while read f; do terrafmt diff $f; done >> /tmp/results.md + - name: Terrafmt diff on _test.go + run: find bastion | egrep "_test.go" | sort | while read f; do terrafmt diff $f; done >> /tmp/results.test.go + - name: Generate error if results not empty + run: | + if [[ -s /tmp/results.md || -s /tmp/results.test.go ]] ; then + cat /tmp/results.md + cat /tmp/results.test.go + echo "terraform blocks in docs/test-go files not being properly formatted" + exit 1 + fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1d75099..931d1a5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,15 +20,15 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v4 - name: Unshallow run: git fetch --prune --unshallow - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: - go-version: 1.14 + go-version: 1. - name: Import GPG key id: import_gpg diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..7b8accb --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,43 @@ +run: + timeout: 5m + +linters: + enable-all: true + disable: + # deprecated + - execinquery # deprecated 1.58.0 + - gomnd # deprecated 1.58.0 + - exportloopref # deprecated 1.60.2 + # unwanted + - cyclop + - depguard + - dupl + - err113 + - exhaustruct + - forcetypeassert + - funlen + - gomoddirectives + - mnd + - nestif + - paralleltest + - tagliatelle + - varnamelen + - wsl + +linters-settings: + gci: + custom-order: true + sections: + - standard + - localModule + - default + govet: + enable-all: true + disable: + - fieldalignment + gocognit: + # minimal code complexity to report, 30 by default + min-complexity: 30 + gocyclo: + # minimal code complexity to report, 30 by default + min-complexity: 30 diff --git a/.markdownlint.yml b/.markdownlint.yml new file mode 100644 index 0000000..1e657d5 --- /dev/null +++ b/.markdownlint.yml @@ -0,0 +1,5 @@ +MD013: + code_blocks: false + line_length: 250 +MD014: false +MD034: false