Skip to content

Commit b94c365

Browse files
authored
feat: initial prototype (#1)
1 parent 66f78f4 commit b94c365

27 files changed

+970
-105
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: PR Conventional Commit Validation
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, edited]
6+
7+
jobs:
8+
validate-pr-title:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: PR Conventional Commit Validation
12+
uses: ytanikin/[email protected]
13+
with:
14+
task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert"]'
15+
custom_labels: '{"feat": "feature", "fix": "fix", "docs": "documentation", "test": "test", "ci": "CI/CD", "refactor": "refactor", "perf": "performance", "chore": "chore", "revert": "revert", "wip": "WIP"}'

.github/workflows/coverage.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Coverage
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
- main
7+
jobs:
8+
coverage:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- uses: actions/setup-python@v6
15+
with:
16+
python-version: '3.12'
17+
18+
- name: Install dependencies
19+
run: pip install -r requirements.txt
20+
21+
- name: Get Coverage
22+
run: pytest --cov=src/ --cov-report=xml:coverage.xml --disable-warnings -q
23+
24+
- name: Get Cover
25+
uses: orgoro/[email protected]
26+
with:
27+
coverageFile: coverage.xml
28+
token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Generate terraform docs
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
docs:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
with:
12+
ref: ${{ github.event.pull_request.head.ref }}
13+
14+
- name: Render terraform docs and push changes back to PR
15+
uses: terraform-docs/gh-actions@main
16+
with:
17+
working-dir: .,./examples/complete,./examples/shared-table
18+
output-file: README.md
19+
output-method: inject
20+
git-push: "true"

.github/workflows/release.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- master
9+
paths:
10+
- '**/*.tpl'
11+
- '**/*.py'
12+
- '**/*.tf'
13+
- '.github/workflows/release.yml'
14+
15+
jobs:
16+
release:
17+
name: Release
18+
runs-on: ubuntu-latest
19+
# Skip running release workflow on forks
20+
if: github.repository_owner == 'GiamPy5'
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
persist-credentials: false
26+
fetch-depth: 0
27+
28+
- name: Release
29+
uses: cycjimmy/semantic-release-action@v4
30+
with:
31+
semantic_version: 23.0.2
32+
extra_plugins: |
33+
@semantic-release/[email protected]
34+
@semantic-release/[email protected]
35+
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.SEMANTIC_VERSIONING_ACCESS_TOKEN }}

.github/workflows/test.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Test
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
- main
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- uses: actions/setup-python@v6
15+
with:
16+
python-version: '3.12'
17+
18+
- name: Install dependencies
19+
run: pip install -r requirements.txt
20+
21+
- name: Run tests
22+
run: pytest -q --maxfail=1 --disable-warnings -ras

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Local .terraform directories
22
.terraform/
3+
examples/**/builds
34

45
# .tfstate files
56
*.tfstate
@@ -26,6 +27,9 @@ override.tf.json
2627
# Ignore transient lock info files created by terraform apply
2728
.terraform.tfstate.lock.info
2829

30+
# Terraform state locks
31+
.terraform.lock.hcl
32+
2933
# Include override files you do wish to add to version control using negated pattern
3034
# !example_override.tf
3135

@@ -39,5 +43,6 @@ terraform.rc
3943
**/__pycache__/
4044
**.egg-info/
4145
.coverage
46+
coverage.xml
4247
.pytest_cache/
4348
.DS_Store

.terraform-docs.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
formatter: "" # this is required
2+
3+
version: ""
4+
5+
header-from: main.tf
6+
footer-from: ""
7+
8+
recursive:
9+
enabled: false
10+
path: modules
11+
include-main: true
12+
13+
sections:
14+
hide: []
15+
show: []
16+
17+
content: ""
18+
19+
output:
20+
file: ""
21+
mode: inject
22+
template: |-
23+
<!-- BEGIN_TF_DOCS -->
24+
{{ .Content }}
25+
<!-- END_TF_DOCS -->
26+
27+
output-values:
28+
enabled: false
29+
from: ""
30+
31+
sort:
32+
enabled: true
33+
by: name
34+
35+
settings:
36+
anchor: true
37+
color: true
38+
default: true
39+
description: false
40+
escape: true
41+
hide-empty: false
42+
html: true
43+
indent: 2
44+
lockfile: true
45+
read-comments: true
46+
required: true
47+
sensitive: true
48+
type: true

.terraform-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.13.4

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @GiamPy5

Makefile

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
1-
.PHONY: test coverage
1+
PWD=$(shell pwd)
2+
USERID=$(shell id -u)
3+
4+
.PHONY: test coverage all
5+
6+
all: lint docs tfsec test
27

38
test: ## Run pytest locally
49
@echo "🧪 Running pytest locally..."
510
@pyenv exec pytest -q --maxfail=1 --disable-warnings -ras
611

712
coverage: ## Run tests with coverage report
813
@echo "📊 Running tests with coverage..."
9-
@pyenv exec pytest --cov=src/ --cov-report=term-missing --disable-warnings -q
14+
@pyenv exec pytest --cov=src/ --cov-report=xml:coverage.xml --disable-warnings -q
15+
16+
docs:
17+
@echo "Running terraform docs..."
18+
@docker run --rm --volume "${PWD}:/terraform-docs" -u ${USERID} quay.io/terraform-docs/terraform-docs:0.20.0 markdown --output-file README.md --output-mode inject /terraform-docs
19+
@docker run --rm --volume "${PWD}/examples/complete:/terraform-docs" -u ${USERID} quay.io/terraform-docs/terraform-docs:0.20.0 markdown --output-file README.md --output-mode inject /terraform-docs
20+
@docker run --rm --volume "${PWD}/examples/shared-table:/terraform-docs" -u ${USERID} quay.io/terraform-docs/terraform-docs:0.20.0 markdown --output-file README.md --output-mode inject /terraform-docs
21+
22+
lint:
23+
@echo "Running terraform fmt..."
24+
@terraform fmt --recursive
25+
26+
tfsec:
27+
@echo "Running tfsec..."
28+
@docker run --rm -it -v "${PWD}/examples/complete:/src" aquasec/tfsec /src

0 commit comments

Comments
 (0)