generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #3 from byu-oit/json_file
trying out a file pattern instead of passing in the json string directly
- Loading branch information
Showing
10 changed files
with
1,498 additions
and
171 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: "build" | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- 'v*' | ||
|
||
jobs: | ||
build: # make sure build/ci work properly | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- run: | | ||
yarn install | ||
yarn run all |
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,45 +1,86 @@ | ||
name: "build-test" | ||
on: # rebuild any PRs and main branch changes | ||
name: "test" | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- 'releases/*' | ||
- 'v*' | ||
|
||
jobs: | ||
build: # make sure build/ci work properly | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- run: | | ||
yarn install | ||
yarn run all | ||
test: # make sure the action works on a clean machine without building only on PRs | ||
if: ${{ github.event_name == 'pull_request' }} | ||
test-action: # make sure the action works on a clean machine without building | ||
name: Test normal PR use | ||
runs-on: ubuntu-latest | ||
env: | ||
tf_version: 0.12.27 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: hashicorp/setup-terraform@v1 | ||
with: | ||
terraform_version: ${{ env.tf_version }} | ||
- run: terraform init | ||
working-directory: __tests__ | ||
- run: terraform plan -out test-plan.tfplan | ||
working-directory: __tests__ | ||
- uses: ./ | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
terraform_plan_json: | | ||
{ | ||
"resource_changes": [ | ||
{ | ||
"address": "module.app.module.database.aws_db_instance.database", | ||
"type": "aws_db_instance", | ||
"name": "database", | ||
"change": { | ||
"actions": ["delete"] | ||
} | ||
}, | ||
{ | ||
"address": "module.app.aws_security_group_rule.db_access", | ||
"type": "aws_security_group_rule", | ||
"name": "db_access", | ||
"change": { | ||
"actions": ["delete", "create"] | ||
} | ||
} | ||
] | ||
} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
working-directory: __tests__ | ||
terraform-plan-file: test-plan.tfplan | ||
|
||
test-action-plan-in-diff-dir: # make sure the action works with plan in different directory from working dir | ||
name: Test TF plan in different dir | ||
runs-on: ubuntu-latest | ||
env: | ||
tf_version: 0.12.27 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: hashicorp/setup-terraform@v1 | ||
with: | ||
terraform_version: ${{ env.tf_version }} | ||
- run: terraform init | ||
working-directory: __tests__ | ||
- run: terraform plan -out ../test-plan.tfplan | ||
working-directory: __tests__ | ||
- uses: ./ | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
working-directory: __tests__ | ||
terraform-plan-file: ../test-plan.tfplan | ||
|
||
test-action-without-tf-wrapper: # make sure the action works without the terraform wrapper | ||
name: Test without TF wrapper | ||
runs-on: ubuntu-latest | ||
env: | ||
tf_version: 0.12.27 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: hashicorp/setup-terraform@v1 | ||
with: | ||
terraform_version: ${{ env.tf_version }} | ||
terraform_wrapper: false | ||
- run: terraform init | ||
working-directory: __tests__ | ||
- run: terraform plan -out test-plan.tfplan | ||
working-directory: __tests__ | ||
- uses: ./ | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
working-directory: __tests__ | ||
terraform-plan-file: test-plan.tfplan | ||
|
||
test-action-at-root: # make sure the action works with terraform dir as root dir | ||
name: Test from Root | ||
runs-on: ubuntu-latest | ||
env: | ||
tf_version: 0.12.27 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- run: mv __tests__/* . | ||
- uses: hashicorp/setup-terraform@v1 | ||
with: | ||
terraform_version: ${{ env.tf_version }} | ||
- run: terraform init | ||
- run: terraform plan -out test-plan.tfplan | ||
- uses: ./ | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
terraform-plan-file: test-plan.tfplan |
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 |
---|---|---|
|
@@ -99,4 +99,8 @@ __tests__/runner/* | |
lib/**/* | ||
|
||
.idea | ||
*.iml | ||
*.iml | ||
|
||
!__tests__/main.test.ts | ||
!__tests__/test.tf | ||
__tests__/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
resource "local_file" "fake_file" { | ||
filename = "test.txt" | ||
content = "Hello ${random_pet.name.id}" | ||
} | ||
|
||
resource "random_pet" "name"{ | ||
keepers = { | ||
uuid = uuid() | ||
} | ||
} |
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.