-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from mineiros-io/soerenmartius/tests
Add unit tests
- Loading branch information
Showing
26 changed files
with
2,179 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,11 @@ on: | |
push: | ||
branches: | ||
- main | ||
- master | ||
pull_request: | ||
|
||
concurrency: | ||
group: main | ||
group: terraform-google-cloud-sql | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
|
@@ -16,7 +17,121 @@ jobs: | |
name: Static Analysis | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
# for security reasons we pin commit ids and not tags. | ||
# actions/[email protected] -> 2541b1294d2704b0964813337f33b291d3f8596b | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Run pre-commit | ||
run: make test/pre-commit | ||
# - name: Setup SSH to Private Modules | ||
# # for security reasons we pin commit ids and not tags. | ||
# # webfactory/[email protected] -> fc49353b67b2b7c1e0e6a600572d01a69f2672dd | ||
# uses: webfactory/ssh-agent@fc49353b67b2b7c1e0e6a600572d01a69f2672dd | ||
# with: | ||
# ssh-private-key: | | ||
# ${{ secrets.DEPLOY_KEY__REPOSITORY_A }} | ||
# ${{ secrets.DEPLOY_KEY__REPOSITORY_B }} | ||
|
||
- name: Set up Golang | ||
# for security reasons we pin commit ids and not tags. | ||
# actions/[email protected] -> b22fbbc2921299758641fab08929b4ac52b32923 | ||
uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923 | ||
with: | ||
go-version: 1.17.6 | ||
|
||
- name: Set up Terramate | ||
# for security reasons we pin commit ids and not tags. | ||
# mineiros-io/[email protected] -> bea6836fa912c982f39a2965a327476b15d06b45 | ||
run: go install github.com/mineiros-io/terramate/cmd/terramate@bea6836fa912c982f39a2965a327476b15d06b45 | ||
env: | ||
GOPROXY: direct | ||
|
||
- name: Set up Terradoc | ||
# for security reasons we pin commit ids and not tags. | ||
# mineiros-io/terradoc@main -> af1a7b3ae3635958adf5ee2f40e0c3e70fd0803a | ||
run: go install github.com/mineiros-io/terradoc/cmd/terradoc@af1a7b3ae3635958adf5ee2f40e0c3e70fd0803a | ||
env: | ||
GOPROXY: direct | ||
|
||
- name: Set up Terraform | ||
# for security reasons we pin commit ids and not tags. | ||
# hashicorp/[email protected] -> 17d4c9b8043b238f6f35641cdd8433da1e6f3867 | ||
uses: hashicorp/setup-terraform@17d4c9b8043b238f6f35641cdd8433da1e6f3867 | ||
with: | ||
terraform_version: 1.2.1 | ||
terraform_wrapper: false | ||
|
||
- name: Setup TFLint | ||
# for security reasons we pin commit ids and not tags. | ||
# terraform-linters/[email protected] -> 9e653e0f7de0839150e03280e0981e0c25eaf10a | ||
uses: terraform-linters/setup-tflint@9e653e0f7de0839150e03280e0981e0c25eaf10a | ||
with: | ||
tflint_version: v0.29.0 | ||
|
||
- name: Setup and run pre-commit | ||
# for security reasons we pin commit ids and not tags. | ||
# pre-commit/[email protected] -> 9b88afc9cd57fd75b655d5c71bd38146d07135fe | ||
uses: pre-commit/action@9b88afc9cd57fd75b655d5c71bd38146d07135fe | ||
|
||
unit-tests: | ||
# needs: pre-commit | ||
runs-on: ubuntu-latest | ||
name: Unit Tests | ||
steps: | ||
- name: Checkout | ||
# for security reasons we pin commit ids and not tags. | ||
# actions/[email protected] -> 2541b1294d2704b0964813337f33b291d3f8596b | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b | ||
with: | ||
fetch-depth: 0 | ||
|
||
# - name: Setup SSH to Private Modules | ||
# # for security reasons we pin commit ids and not tags. | ||
# # webfactory/[email protected] -> fc49353b67b2b7c1e0e6a600572d01a69f2672dd | ||
# uses: webfactory/ssh-agent@fc49353b67b2b7c1e0e6a600572d01a69f2672dd | ||
# with: | ||
# ssh-private-key: | | ||
# ${{ secrets.DEPLOY_KEY__REPOSITORY_A }} | ||
# ${{ secrets.DEPLOY_KEY__REPOSITORY_B }} | ||
|
||
- name: Check for Terraform file changes | ||
# for security reasons we pin commit ids and not tags. | ||
# getsentry/[email protected] -> b2feaf19c27470162a626bd6fa8438ae5b263721 | ||
uses: getsentry/paths-filter@b2feaf19c27470162a626bd6fa8438ae5b263721 | ||
id: changes | ||
with: | ||
filters: | | ||
terraform: | ||
- '*.tf' | ||
- 'test/**/*.tf' | ||
- 'test/**/*.go' | ||
- 'test/go.mod' | ||
- 'test/go.sum' | ||
- name: Set up Terraform | ||
if: steps.changes.outputs.terraform == 'true' | ||
# for security reasons we pin commit ids and not tags. | ||
# hashicorp/[email protected] -> 17d4c9b8043b238f6f35641cdd8433da1e6f3867 | ||
uses: hashicorp/setup-terraform@17d4c9b8043b238f6f35641cdd8433da1e6f3867 | ||
with: | ||
terraform_version: 1.2.1 | ||
terraform_wrapper: false | ||
|
||
- name: Set up Golang | ||
if: steps.changes.outputs.terraform == 'true' | ||
# for security reasons we pin commit ids and not tags. | ||
# actions/[email protected] -> b22fbbc2921299758641fab08929b4ac52b32923 | ||
uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923 | ||
with: | ||
go-version: 1.17.6 | ||
|
||
- name: Run Unit Tests | ||
if: steps.changes.outputs.terraform == 'true' | ||
run: make test/unit-tests | ||
env: | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.MINEIROS_TESTING_AWS_SECRET_ACCESS_KEY }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.MINEIROS_TESTING_AWS_ACCESS_KEY_ID }} | ||
GOOGLE_CREDENTIALS: ${{ secrets.MINEIROS_TESTING_GCP_SA_KEY_FILE }} | ||
TEST_GCP_PROJECT: ${{ secrets.MINEIROS_TESTING_GCP_PROJECT }} | ||
TEST_GCP_ORG_DOMAIN: ${{ secrets.MINEIROS_TESTING_GCP_ORG_DOMAIN }} | ||
TEST_GCP_BILLING_ACCOUNT: ${{ secrets.MINEIROS_TESTING_GCP_BILLING_ACCOUNT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
repos: | ||
- repo: https://github.com/mineiros-io/pre-commit-hooks | ||
rev: v0.3.1 | ||
rev: v0.4.1 | ||
hooks: | ||
- id: phony-targets | ||
- id: terradoc-validate | ||
- id: terradoc-fmt | ||
- id: terradoc-generate | ||
- id: terramate-generate | ||
- id: terraform-fmt | ||
- id: terraform-validate | ||
exclude: ^examples|.terraform/ | ||
- id: tflint | ||
- id: golangci-lint | ||
- id: phony-targets | ||
- id: markdown-link-check | ||
args: ['-p'] # When adding the -p flag, markdown-link-check will always with an exit code 0, even if dead links are found | ||
verbose: true # Forces the output of the hook to be printed even when the hook passes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.