Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
janvt committed May 26, 2023
0 parents commit aeab71d
Show file tree
Hide file tree
Showing 23 changed files with 939 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true

[*.md]
max_line_length = 0
trim_trailing_whitespace = false

[{Makefile,**.mk}]
indent_style = tab
9 changes: 9 additions & 0 deletions .github/.templatesyncignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
README.md
.github/workflows/*
.terraform-docs.yml
docs/20-badges.md
docs/assets/logo.svg
*.tf
test/*
go.mod
go.sum
21 changes: 21 additions & 0 deletions .github/pull_request-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- Please ensure your PR title is brief and descriptive for a good changelog entry -->
<!-- Link to issue if there is one -->

## What it solves

...

## How this PR fixes it

...

## Readiness Checklist

### Author/Contributor
- [ ] If documentation is needed for this change, has that been included in this pull request
- [ ] Pull request title is brief and descriptive (for a changelog entry)

### Reviewing Maintainer
- [ ] Label as `breaking` if this is a large fundamental change
- [ ] Label as either `automation`, `bug`, `documentation`, or `enhancement`
- [ ] Label as `bump:patch`, `bump:minor`, or `bump:major` if this PR should create a new release
122 changes: 122 additions & 0 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
################
## Run linter ##
################

#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#

name: Lint
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

##########################
# Prevent duplicate jobs #
##########################
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

###############
# Run the job #
###############
jobs:
##########
# TF fmt #
##########
tf-fmt:
name: FMT
runs-on: ubuntu-latest
steps:
############################
# Checkout the source code #
############################
- name: Checkout Code
uses: actions/checkout@v3.1.0

#####################
# Run Terraform fmt #
#####################
- name: Terraform fmt
uses: dflook/terraform-fmt-check@v1.29.1

##########
# TFLint #
##########
tf-lint:
name: TFLint
runs-on: ubuntu-latest
steps:
############################
# Checkout the source code #
############################
- name: Checkout Code
uses: actions/checkout@v3.1.0

#################
# Cache plugins #
#################
- name: Cache plugin dir
uses: actions/cache@v3.0.11
with:
path: ~/.tflint.d/plugins
key: ${{ matrix.os }}-tflint-${{ hashFiles('.tflint.hcl') }}

################
# Setup TFLint #
################
- name: Setup TFLint
uses: terraform-linters/setup-tflint@v2
with:
tflint_version: v0.42.2

###############
# Init TFLint #
###############
- name: Init TFLint
run: tflint --init

##############
# Run TFLint #
##############
- name: Run TFLint
run: tflint -f compact

###########
# TF docs #
###########
tf-docs:
name: Docs
if: ${{ github.event_name == 'pull_request' }}
permissions:
contents: write
pull-requests: write

runs-on: ubuntu-latest
steps:
############################
# Checkout the source code #
############################
- name: Checkout Code
uses: actions/checkout@v3.1.0
with:
ref: ${{ github.event.pull_request.head.ref }}

####################
# Update README.md #
####################
- name: Terraform docs
uses: terraform-docs/gh-actions@v1.0.0
with:
ref: ${{ github.event.pull_request.head.ref }}
config-file: .terraform-docs.yml
git-push: true
96 changes: 96 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
#####################
## Create releases ##
#####################

#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#

name: Release
on:
push:
branches: [ main ]
tags: [ 'v*.*.*' ]
pull_request:
types: [ labeled ]

#################
# Start the job #
#################
jobs:
###############
# Steps below #
###############
create-release:
name: Create Release
if: github.event.action != 'labeled'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
############################
# Checkout the source code #
############################
- name: Checkout Code
uses: actions/checkout@v3.1.0

###################################
# Bump version depending on label #
###################################
- name: Bump version
if: "!startsWith(github.ref, 'refs/tags/')"
id: bumpr
uses: haya14busa/action-bumpr@v1

###################
# Update the tags #
###################
- name: Update tag
if: "!steps.bumpr.outputs.skip"
uses: haya14busa/action-update-semver@v1
with:
tag: ${{ steps.bumpr.outputs.next_version }}

################
# Get tag name #
################
- name: Get tag name
id: tag
uses: haya14busa/action-cond@v1
with:
cond: "${{ startsWith(github.ref, 'refs/tags/') }}"
if_true: ${{ github.ref }}
if_false: ${{ steps.bumpr.outputs.next_version }}

##################
# Create release #
##################
- name: Create release
uses: softprops/action-gh-release@v1
if: "steps.tag.outputs.value != ''"
with:
name: Release ${{ steps.tag.outputs.value }}
body: ${{ steps.bumpr.outputs.message }}
tag_name: ${{ steps.tag.outputs.value }}
draft: false
prerelease: false

###########################
# Release preview comment #
###########################
release-check:
if: github.event.action == 'labeled'
runs-on: ubuntu-latest
steps:
############################
# Checkout the source code #
############################
- name: Checkout Code
uses: actions/checkout@v3.1.0

#######################
# Post status comment #
#######################
- name: Post bumpr status comment
uses: haya14busa/action-bumpr@v1
73 changes: 73 additions & 0 deletions .github/workflows/semantic-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
#####################
## Run Semantic PR ##
#####################

#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#

name: Semantic PR
on:
pull_request:
types: [ opened, edited, synchronize ]

##########################
# Prevent duplicate jobs #
##########################
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

###############
# Run the job #
###############
jobs:
###############
# Semantic PR #
###############
semantic-pr:
name: Validate PR
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
############
# Check PR #
############
- name: Check PR
id: lint-pr-title
uses: amannn/action-semantic-pull-request@v5.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

#############################
# Add PR comment with error #
#############################
- name: Add PR error comment
uses: marocchino/sticky-pull-request-comment@v2.3.0
if: always() && (steps.lint-pr-title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
Details:
```
${{ steps.lint-pr-title.outputs.error_message }}
```
################################
# Delete PR comment with error #
################################
- name: Delete PR error comment
uses: marocchino/sticky-pull-request-comment@v2.3.0
if: ${{ steps.lint_pr_title.outputs.error_message == null }}
with:
header: pr-title-lint-error
delete: true
Loading

0 comments on commit aeab71d

Please sign in to comment.