-
Notifications
You must be signed in to change notification settings - Fork 1
158 lines (151 loc) · 4.49 KB
/
test-and-release.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: "Test & Release"
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
id-token: write
contents: write
pull-requests: write
jobs:
test-simple:
name: Test Simple
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Test
uses: "./"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
test-setup:
name: Test Setup
runs-on: ubuntu-latest
strategy:
matrix:
terramate-version: ["0.4.2", "latest"]
terraform-version: ["1.5.7", "latest"]
terraform-plan-file: ["out.tfplan", "plan.out"]
tmp-file: ["tmp.txt", "file.tmp"]
comment-pull-request: ["true", "false"]
cleanup: ["true", "false"]
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Test
uses: "./"
with:
terraform-version: ${{ matrix.terraform-version }}
terraform-plan-file: ${{ matrix.terraform-plan-file }}
github-token: ${{ secrets.GITHUB_TOKEN }}
test-args:
name: Test Arguments
runs-on: ubuntu-latest
strategy:
matrix:
terramate-args: ["--changed", ""]
terraform-common-args: ["-no-color", ""]
terraform-init-args: ["-upgrade", ""]
terraform-validate-args: ["-json", ""]
terraform-plan-args: ["-parallelism=3", ""]
terraform-apply-args: ["-parallelism=2", ""]
terraform-destroy-args: ["-compact-warnings", ""]
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Test
uses: "./"
with:
terramate-args: ${{ matrix.terramate-args }}
terraform-common-args: ${{ matrix.terraform-common-args }}
terraform-init-args: ${{ matrix.terraform-init-args }}
terraform-validate-args: ${{ matrix.terraform-validate-args }}
terraform-plan-args: ${{ matrix.terraform-plan-args }}
terraform-apply-args: ${{ matrix.terraform-apply-args }}
terraform-destroy-args: ${{ matrix.terraform-destroy-args }}
apply: true
destroy: true
github-token: ${{ secrets.GITHUB_TOKEN }}
test-jobs:
name: Test Jobs
runs-on: ubuntu-latest
strategy:
matrix:
lint: ["true", "false"]
generate: ["true", "false"]
validate: ["true", "false"]
plan: ["true", "false"]
apply: ["true", "false"]
destroy: ["true", "false"]
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Test With Setup And Init
uses: "./"
with:
lint: ${{ matrix.lint }}
validate: ${{ matrix.validate }}
plan: ${{ matrix.plan }}
apply: ${{ matrix.apply }}
destroy: ${{ matrix.destroy }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test With Init Only
uses: "./"
with:
setup: false
init: true
lint: ${{ matrix.lint }}
validate: ${{ matrix.validate }}
plan: ${{ matrix.plan }}
apply: ${{ matrix.apply }}
destroy: ${{ matrix.destroy }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test Without Setup And Init
uses: "./"
with:
setup: false
init: false
lint: ${{ matrix.lint }}
validate: ${{ matrix.validate }}
plan: ${{ matrix.plan }}
apply: ${{ matrix.apply }}
destroy: ${{ matrix.destroy }}
github-token: ${{ secrets.GITHUB_TOKEN }}
release:
name: Release
needs:
- test-simple
- test-setup
- test-args
- test-jobs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Semantic Release Plugins
run: |
npm install semantic-release-replace-plugin -D
npm install --save-dev semantic-release-major-tag
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
with:
dry_run: ${{ github.event_name == 'pull_request' }}
ci: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}