This repository has been archived by the owner on Oct 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 144
223 lines (223 loc) · 7.29 KB
/
delivery.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: Delivery
on:
- push
concurrency: delivery-${{ github.ref }}
jobs:
commit-compile:
name: Commit - Compile
if: ${{ github.ref_type == 'branch' }}
runs-on: ${{ matrix.operating-system }}-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "${{ matrix.ruby-version }}"
bundler: "2.4"
bundler-cache: true
cache-version:
"1-os-${{ matrix.operating-system }}-rv-${{ matrix.ruby-version }}"
- name: Upload Bundler Lockfile
uses: actions/upload-artifact@v3
with:
name:
bundler-lockfile-os-${{ matrix.operating-system }}-rv-${{
matrix.ruby-version }}
path: gems.locked
if-no-files-found: error
strategy:
fail-fast: false
matrix:
include:
- operating-system: ubuntu
ruby-version: "3.0"
- operating-system: ubuntu
ruby-version: "3.1"
- operating-system: ubuntu
ruby-version: "3.2"
- operating-system: windows
ruby-version: "3.2"
commit-unit-test:
name: Commit - Unit Test
needs:
- commit-compile
if: ${{ github.ref_type == 'branch' }}
runs-on: ${{ matrix.operating-system }}-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Download Bundler Lockfile
uses: actions/download-artifact@v3
with:
name:
bundler-lockfile-os-${{ matrix.operating-system }}-rv-${{
matrix.ruby-version }}
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "${{ matrix.ruby-version }}"
bundler: "2.4"
bundler-cache: true
cache-version:
"1-os-${{ matrix.operating-system }}-rv-${{ matrix.ruby-version }}"
- name: Run RSpec Tests
if: ${{ !matrix.code-coverage }}
run: bundle exec rake test:rspec
- name: Run RSpec Tests with Code Coverage
if: ${{ matrix.code-coverage }}
uses: paambaati/codeclimate-action@v4.0.0
env:
CC_TEST_REPORTER_ID: 7574433e1beed630cb9a171c688bb9e010d5028f00f7218d6e845fe138c65168
with:
coverageCommand: bundle exec rake test:rspec
strategy:
fail-fast: false
matrix:
include:
- code-coverage: false
operating-system: ubuntu
ruby-version: "3.0"
- code-coverage: false
operating-system: ubuntu
ruby-version: "3.1"
- code-coverage: true
operating-system: ubuntu
ruby-version: "3.2"
- code-coverage: false
operating-system: windows
ruby-version: "3.2"
commit-assemble:
name: Commit - Assemble
needs:
- commit-compile
if: ${{ github.ref_type == 'branch' }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Download Bundler Lockfile
uses: actions/download-artifact@v3
with:
name: bundler-lockfile-os-ubuntu-rv-3.2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler: "2.4"
bundler-cache: true
cache-version: "1-os-ubuntu-rv-3.2"
- name: Build Ruby Gem
env:
GEM_PRIVATE_KEY: ${{ secrets.GEM_PRIVATE_KEY }}
run: |
printf -- "${GEM_PRIVATE_KEY}\n" > certs/gem-private_key.pem
gem cert --add certs/gem-public_cert.pem
gem build kitchen-terraform.gemspec --strict --output kitchen-terraform.gem
- name: Upload Ruby Gem
uses: actions/upload-artifact@v3
with:
name: ruby-gem
path: kitchen-terraform.gem
commit-code-analysis:
name: Commit - Code Analysis
if: ${{ github.ref_type == 'branch' }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
config-file: .github/codeql/config.yml
languages: ruby
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
acceptance:
name: Acceptance
needs:
- commit-unit-test
- commit-assemble
- commit-code-analysis
if:
${{ github.ref_type == 'branch' && github.event_name == 'push' &&
github.ref_name == 'main' }}
runs-on: ${{ matrix.operating-system }}-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler-cache: false
- name: Download Ruby Gem
uses: actions/download-artifact@v3
with:
name: ruby-gem
- name: Install Ruby Gems
run:
gem install --conservative --minimal-deps --verbose
kitchen-terraform.gem rake
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.terraform-version }}
terraform_wrapper: false
- name: Setup Terragrunt
if: ${{ matrix.operating-system == 'macos' }}
uses: autero1/action-terragrunt@v1.3.2
with:
terragrunt_version: ${{ matrix.terragrunt-version }}
- name: Mirror Terraform Providers
run: |
cd ./test/terraform/PlugIns
terraform providers mirror ./PlugInDirectory
- name: Run Kitchen Tests
run: |
rake --trace test:kitchen:attributes-${{ matrix.operating-system }}
rake --trace test:kitchen:plug-ins-${{ matrix.operating-system }}
rake --trace test:kitchen:variables-${{ matrix.operating-system }}
rake --trace test:kitchen:workspaces-${{ matrix.operating-system }}
- name: Run Kitchen Test backend-ssh
if: ${{ matrix.operating-system == 'ubuntu' }}
run: |
chmod 400 ./test/terraform/backend-ssh/id_ed25519
rake test:kitchen:backend-ssh-ubuntu
- name: Run Kitchen doctor
run: |
rake --trace test:kitchen:doctor-${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
include:
- operating-system: macos
terraform-version: "1.1.4"
terragrunt-version: "0.36.0"
- operating-system: ubuntu
terraform-version: "0.15.5"
- operating-system: ubuntu
terraform-version: "0.14.11"
- operating-system: windows
terraform-version: "0.13.7"
release:
name: Release
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
runs-on: ubuntu-latest
steps:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler-cache: false
- name: Download Ruby Gem Release Candidate
uses: dawidd6/action-download-artifact@v2
with:
commit: ${{ github.sha }}
event: push
name: ruby-gem
workflow_conclusion: success
- name: Publish Ruby Gem Release Candidate
env:
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
run: gem push kitchen-terraform.gem