Skip to content

Commit

Permalink
Updated github action and workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
bsimonWallix committed Dec 17, 2024
1 parent 0934c7d commit 517ef45
Show file tree
Hide file tree
Showing 8 changed files with 251 additions and 3 deletions.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -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.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
commit-message:
prefix: "workflows:"
schedule:
interval: weekly
65 changes: 65 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -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 ./...
76 changes: 76 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 43 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
MD013:
code_blocks: false
line_length: 250
MD014: false
MD034: false

0 comments on commit 517ef45

Please sign in to comment.