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 6fc1b78
Show file tree
Hide file tree
Showing 32 changed files with 3,239 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 = 80
trim_trailing_whitespace = true

[*.md]
max_line_length = 0
trim_trailing_whitespace = false

[{Makefile,**.mk}]
indent_style = tab
34 changes: 34 additions & 0 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
- name: 'bump:major'
color: ef6bb4
description: 'Attach to PR to automatically bump major version on merge'
aliases: [ ]

- name: 'bump:minor'
color: ef6bb4
description: 'Attach to PR to automatically bump minor version on merge'
aliases: [ ]

- name: 'bump:patch'
color: ef6bb4
description: 'Attach to PR to automatically bump patch version on merge'
aliases: [ ]

- name: 'automation'
color: 3ddd1b
description: 'Removing manual tasks by automating them'
aliases: [ ]

- name: 'bug'
color: d73a4a
description: 'Something is not working'
aliases: [ ]

- name: 'documentation'
color: 0075ca
description: 'Improvements or additions to documentation'
aliases: [ ]

- name: 'enhancement'
color: a2eeef
description: 'New feature or request'
aliases: [ ]
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/[email protected]

#####################
# Run Terraform fmt #
#####################
- name: Terraform fmt
uses: dflook/[email protected]

##########
# TFLint #
##########
tf-lint:
name: TFLint
runs-on: ubuntu-latest
steps:
############################
# Checkout the source code #
############################
- name: Checkout Code
uses: actions/[email protected]

#################
# Cache plugins #
#################
- name: Cache plugin dir
uses: actions/[email protected]
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/[email protected]
with:
ref: ${{ github.event.pull_request.head.ref }}

####################
# Update README.md #
####################
- name: Terraform docs
uses: terraform-docs/[email protected]
with:
ref: ${{ github.event.pull_request.head.ref }}
config-file: .terraform-docs.yml
git-push: true
77 changes: 77 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
####################################
## Draft releases on Push to main ##
####################################

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

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

permissions:
contents: write

#################
# Start the job #
#################
jobs:
###############
# Steps below #
###############
create-release:
name: Create Release
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
############################
# Checkout the source code #
############################
- name: Checkout Code
uses: actions/[email protected]

###################################
# 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
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/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

#############################
# Add PR comment with error #
#############################
- name: Add PR error comment
uses: marocchino/[email protected]
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/[email protected]
if: ${{ steps.lint_pr_title.outputs.error_message == null }}
with:
header: pr-title-lint-error
delete: true
Loading

0 comments on commit 6fc1b78

Please sign in to comment.