Skip to content

Commit e2bd4d1

Browse files
authored
ci: add configuration release, precommit, licence and contributing guides (scaleway#2)
1 parent b4a343e commit e2bd4d1

File tree

8 files changed

+422
-0
lines changed

8 files changed

+422
-0
lines changed

.editorconfig

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
# Uses editorconfig to maintain consistent coding styles
3+
4+
# top-most EditorConfig file
5+
root = true
6+
7+
# Unix-style newlines with a newline ending every file
8+
[*]
9+
charset = utf-8
10+
end_of_line = lf
11+
indent_size = 2
12+
indent_style = space
13+
insert_final_newline = true
14+
max_line_length = 80
15+
trim_trailing_whitespace = true
16+
17+
[*.{tf,tfvars}]
18+
indent_size = 2
19+
indent_style = space
20+
21+
[*.md]
22+
max_line_length = 0
23+
trim_trailing_whitespace = false
24+
25+
[Makefile]
26+
tab_width = 2
27+
indent_style = tab
28+
29+
[COMMIT_EDITMSG]
30+
max_line_length = 0

.github/contributing.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Contributing
2+
3+
When contributing to this repository, please first discuss the change you wish to make via issue,
4+
email, or any other method with the owners of this repository before making a change.
5+
6+
Please note we have a code of conduct, please follow it in all your interactions with the project.
7+
8+
## Pull Request Process
9+
10+
1. Update the README.md with details of changes including example hcl blocks and [example files](./examples) if appropriate.
11+
2. Run pre-commit hooks `pre-commit run -a`.
12+
3. Once all outstanding comments and checklist items have been addressed, your contribution will be merged! Merged PRs will be included in the next release. The terraform-scaleway-vpc-module maintainers take care of updating the CHANGELOG as they merge.
13+
14+
## Checklists for contributions
15+
16+
- [ ] Add [semantics prefix](#semantic-pull-requests) to your PR or Commits (at least one of your commit groups)
17+
- [ ] CI tests are passing
18+
- [ ] README.md has been updated after any changes to variables and outputs.
19+
- [ ] Run pre-commit hooks `pre-commit run -a`
20+
21+
## Semantic Pull Requests
22+
23+
To generate changelog, Pull Requests or Commits must have semantic and must follow conventional specs below:
24+
25+
- `feat:` for new features
26+
- `fix:` for bug fixes
27+
- `improvement:` for enhancements
28+
- `docs:` for documentation and examples
29+
- `refactor:` for code refactoring
30+
- `test:` for tests
31+
- `ci:` for CI purpose
32+
- `chore:` for chores stuff
33+
34+
The `chore` prefix skipped during changelog generation. It can be used for `chore: update changelog` commit message by example.

.github/workflows/pre-commit.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Pre-Commit
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
env:
9+
TERRAFORM_DOCS_VERSION: v0.16.0
10+
TFLINT_VERSION: v0.44.1
11+
12+
jobs:
13+
collectInputs:
14+
name: Collect workflow inputs
15+
runs-on: ubuntu-latest
16+
outputs:
17+
directories: ${{ steps.dirs.outputs.directories }}
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
22+
- name: Get root directories
23+
id: dirs
24+
uses: clowdhaus/terraform-composite-actions/directories@v1.8.3
25+
26+
preCommitMinVersions:
27+
name: Min TF pre-commit
28+
needs: collectInputs
29+
runs-on: ubuntu-latest
30+
strategy:
31+
matrix:
32+
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v3
36+
37+
- name: Terraform min/max versions
38+
id: minMax
39+
uses: clowdhaus/terraform-min-max@v1.2.4
40+
with:
41+
directory: ${{ matrix.directory }}
42+
43+
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
44+
# Run only validate pre-commit check on min version supported
45+
if: ${{ matrix.directory != '.' }}
46+
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3
47+
with:
48+
terraform-version: ${{ steps.minMax.outputs.minVersion }}
49+
tflint-version: ${{ env.TFLINT_VERSION }}
50+
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'
51+
52+
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
53+
# Run only validate pre-commit check on min version supported
54+
if: ${{ matrix.directory == '.' }}
55+
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3
56+
with:
57+
terraform-version: ${{ steps.minMax.outputs.minVersion }}
58+
tflint-version: ${{ env.TFLINT_VERSION }}
59+
args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'
60+
61+
preCommitMaxVersion:
62+
name: Max TF pre-commit
63+
runs-on: ubuntu-latest
64+
needs: collectInputs
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@v3
68+
with:
69+
ref: ${{ github.event.pull_request.head.ref }}
70+
repository: ${{github.event.pull_request.head.repo.full_name}}
71+
72+
- name: Terraform min/max versions
73+
id: minMax
74+
uses: clowdhaus/terraform-min-max@v1.2.4
75+
76+
- name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}
77+
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3
78+
with:
79+
terraform-version: ${{ steps.minMax.outputs.maxVersion }}
80+
tflint-version: ${{ env.TFLINT_VERSION }}
81+
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}
82+
install-hcledit: true

.github/workflows/release.yml

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+
paths:
9+
- '**/*.tpl'
10+
- '**/*.py'
11+
- '**/*.tf'
12+
- '**/*.go'
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 == 'terraform-scaleway-vpc-module'
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
with:
25+
persist-credentials: false
26+
fetch-depth: 0
27+
28+
- name: Release
29+
uses: cycjimmy/semantic-release-action@v3
30+
with:
31+
semantic_version: 18.0.0
32+
extra_plugins: |
33+
@semantic-release/changelog@6.0.0
34+
@semantic-release/git@10.0.0
35+
conventional-changelog-conventionalcommits@4.6.3
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Local .terraform directories
2+
**/.terraform/*
3+
4+
# Terraform lockfile
5+
.terraform.lock.hcl
6+
7+
# .tfstate files
8+
*.tfstate
9+
*.tfstate.*
10+
11+
# Crash log files
12+
crash.log
13+
14+
# Exclude all .tfvars files, which are likely to contain sentitive data, such as
15+
# password, private keys, and other secrets. These should not be part of version
16+
# control as they are data points which are potentially sensitive and subject
17+
# to change depending on the environment.
18+
*.tfvars
19+
20+
# Ignore override files as they are usually used to override resources locally and so
21+
# are not checked in
22+
override.tf
23+
override.tf.json
24+
*_override.tf
25+
*_override.tf.json
26+
27+
# Ignore CLI configuration files
28+
.terraformrc
29+
terraform.rc

.pre-commit-config.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
repos:
2+
- repo: https://github.com/antonbabenko/pre-commit-terraform
3+
rev: v1.77.1
4+
hooks:
5+
- id: terraform_fmt
6+
- id: terraform_validate
7+
- id: terraform_docs
8+
args:
9+
- '--args=--lockfile=false'
10+
- id: terraform_tflint
11+
args:
12+
- '--args=--only=terraform_deprecated_interpolation'
13+
- '--args=--only=terraform_deprecated_index'
14+
- '--args=--only=terraform_unused_declarations'
15+
- '--args=--only=terraform_comment_syntax'
16+
- '--args=--only=terraform_documented_outputs'
17+
- '--args=--only=terraform_documented_variables'
18+
- '--args=--only=terraform_typed_variables'
19+
- '--args=--only=terraform_module_pinned_source'
20+
- '--args=--only=terraform_naming_convention'
21+
- '--args=--only=terraform_required_version'
22+
- '--args=--only=terraform_required_providers'
23+
- '--args=--only=terraform_standard_module_structure'
24+
- '--args=--only=terraform_workspace_remote'
25+
- repo: https://github.com/pre-commit/pre-commit-hooks
26+
rev: v4.4.0
27+
hooks:
28+
- id: check-merge-conflict
29+
- id: end-of-file-fixer

CODE_OF_CONDUCT.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Code of Conduct
2+
3+
HashiCorp Community Guidelines apply to you when interacting with the community here on GitHub and contributing code.
4+
5+
Please read the full text at https://www.hashicorp.com/community-guidelines

0 commit comments

Comments
 (0)