generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (102 loc) · 3.29 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Test
on:
pull_request:
branches:
- master
- 'v*'
jobs:
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@v4
- uses: hashicorp/setup-terraform@v2
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-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@v4
- uses: hashicorp/setup-terraform@v2
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
comment-title: Terraform Plan in different dir
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@v4
- uses: hashicorp/setup-terraform@v2
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
comment-title: Terraform Plan without wrapper
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@v4
- run: mv __tests__/* .
- uses: hashicorp/setup-terraform@v2
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
comment-title: Terraform Plan from root
tofu: # make sure the action works when using tofu
name: Test tofu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: opentofu/setup-opentofu@v1
with:
tofu_version: 1.6.0
- run: tofu init
working-directory: __tests__
- run: tofu plan -out test-plan.tfplan
working-directory: __tests__
- uses: ./
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
working-directory: __tests__
terraform-plan-file: test-plan.tfplan