Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2 Refactor (BREAKING CHANGES) #46

Merged
merged 19 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# EditorConfig is awesome: http://EditorConfig.org
# Uses editorconfig to maintain consistent coding styles

# 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 = 300
trim_trailing_whitespace = true

[*.{tf,tfvars}]
indent_size = 2
indent_style = space

[*.md]
max_line_length = 0
trim_trailing_whitespace = false

[Makefile]
tab_width = 2
indent_style = tab

[COMMIT_EDITMSG]
max_line_length = 0
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
name: "Tests: TF Examples"
name: "Tests: E2E"
concurrency: # This need to ensure that only a single job or workflow using the same concurrency group will run at a time.
group: ${{ github.workflow }}
cancel-in-progress: false

defaults:
run:
shell: bash
Expand Down Expand Up @@ -53,16 +57,16 @@ jobs:
- name: IZE create AWS Profile
run: ize gen aws-profile

- name: IZE gen tfenv
- name: IZE gen tfenv
run: ize gen tfenv

- name: Copy generated files
run: |
cp -R .ize/env/${{ env.ENV }}/*.* examples/${{ github.job }}/

- name: Go TF Test
run: |
cd test/src
cd test
go mod tidy
go test -v -timeout 60m -run TestExamplesCompleteWorker

Expand Down Expand Up @@ -105,16 +109,16 @@ jobs:
- name: IZE create AWS Profile
run: ize gen aws-profile

- name: IZE gen tfenv
- name: IZE gen tfenv
run: ize gen tfenv

- name: Copy generated files
run: |
cp -R .ize/env/${{ env.ENV }}/*.* examples/${{ github.job }}/

- name: Go TF Test
run: |
cd test/src
cd test
go mod tidy
go test -v -timeout 60m -run TestExamplesWorkerSchedule

Expand Down Expand Up @@ -158,16 +162,16 @@ jobs:
- name: IZE create AWS Profile
run: ize gen aws-profile

- name: IZE gen tfenv
- name: IZE gen tfenv
run: ize gen tfenv

- name: Copy generated files
run: |
cp -R .ize/env/${{ env.ENV }}/*.* examples/${{ github.job }}/

- name: Go TF Test
run: |
cd test/src
cd test
go mod tidy
go test -v -timeout 60m -run TestExamplesCompleteWeb

Expand Down Expand Up @@ -208,16 +212,16 @@ jobs:
- name: IZE create AWS Profile
run: ize gen aws-profile

- name: IZE gen tfenv
- name: IZE gen tfenv
run: ize gen tfenv

- name: Copy generated files
run: |
cp -R .ize/env/${{ env.ENV }}/*.* examples/${{ github.job }}/

- name: Go TF Test
run: |
cd test/src
cd test
go mod tidy
go test -v -timeout 60m -run TestExamplesWebProxy

Expand Down Expand Up @@ -259,15 +263,15 @@ jobs:
- name: IZE create AWS Profile
run: ize gen aws-profile

- name: IZE gen tfenv
- name: IZE gen tfenv
run: ize gen tfenv

- name: Copy generated files
run: |
cp -R .ize/env/${{ env.ENV }}/*.* examples/${{ github.job }}/

- name: Go TF Test
run: |
cd test/src
cd test
go mod tidy
go test -v -timeout 60m -run TestExamplesWorkerAutoScheduled
101 changes: 101 additions & 0 deletions .github/workflows/run.pre-commit.yml_
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: "Tests: Pre-Commit"
concurrency: # This need to ensure that only a single job or workflow using the same concurrency group will run at a time.
group: ${{ github.workflow }}
cancel-in-progress: false

on:
pull_request:
branches:
- main

env:
TERRAFORM_DOCS_VERSION: v0.16.0
TFLINT_VERSION: v0.50.3

jobs:
collectInputs:
name: Collect workflow inputs
runs-on: ubuntu-latest
outputs:
directories: ${{ steps.dirs.outputs.directories }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get root directories
id: dirs
uses: clowdhaus/terraform-composite-actions/[email protected]

preCommitMinVersions:
name: Min TF pre-commit
needs: collectInputs
runs-on: ubuntu-latest
strategy:
matrix:
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}
steps:
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
- name: Delete huge unnecessary tools folder
run: |
rm -rf /opt/hostedtoolcache/CodeQL
rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk
rm -rf /opt/hostedtoolcache/Ruby
rm -rf /opt/hostedtoolcache/go

- name: Checkout
uses: actions/checkout@v4

- name: Terraform min/max versions
id: minMax
uses: clowdhaus/[email protected]
with:
directory: ${{ matrix.directory }}

- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
# Run only validate pre-commit check on min version supported
if: ${{ matrix.directory != '.' }}
uses: clowdhaus/terraform-composite-actions/[email protected]
with:
terraform-version: ${{ steps.minMax.outputs.minVersion }}
tflint-version: ${{ env.TFLINT_VERSION }}
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'

- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
# Run only validate pre-commit check on min version supported
if: ${{ matrix.directory == '.' }}
uses: clowdhaus/terraform-composite-actions/[email protected]
with:
terraform-version: ${{ steps.minMax.outputs.minVersion }}
tflint-version: ${{ env.TFLINT_VERSION }}
args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'

preCommitMaxVersion:
name: Max TF pre-commit
runs-on: ubuntu-latest
needs: collectInputs
steps:
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
- name: Delete huge unnecessary tools folder
run: |
rm -rf /opt/hostedtoolcache/CodeQL
rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk
rm -rf /opt/hostedtoolcache/Ruby
rm -rf /opt/hostedtoolcache/go

- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}

- name: Terraform min/max versions
id: minMax
uses: clowdhaus/[email protected]

- name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}
uses: clowdhaus/terraform-composite-actions/[email protected]
with:
terraform-version: ${{ steps.minMax.outputs.maxVersion }}
tflint-version: ${{ env.TFLINT_VERSION }}
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}
install-hcledit: true
31 changes: 31 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.89.0
hooks:
- id: terraform_fmt
- id: terraform_docs
args:
- '--args=--lockfile=false'
- id: terraform_tflint
args:
- '--args=--only=terraform_deprecated_interpolation'
- '--args=--only=terraform_deprecated_index'
- '--args=--only=terraform_unused_declarations'
- '--args=--only=terraform_comment_syntax'
- '--args=--only=terraform_documented_outputs'
- '--args=--only=terraform_documented_variables'
- '--args=--only=terraform_typed_variables'
- '--args=--only=terraform_module_pinned_source'
- '--args=--only=terraform_naming_convention'
- '--args=--only=terraform_required_version'
- '--args=--only=terraform_required_providers'
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- '--args=--only=terraform_unused_required_providers'
- id: terraform_validate
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2021-2022 HazelOps OÜ
Copyright 2021 HazelOps OÜ

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Loading
Loading