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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Continuous Delivery Pipeline (#488)
* Add bundler to dependabot * Rename RSpec Tests to Commit Stage * Enable push events * Remove pull request paths * Rename rspec-tests to unit-tests * Add build-release-candidate * Rename Commit Stage to Delivery Pipeline * Define Commit Stage * Define Acceptance Stage * Add Release stage * Only upload gem for Ruby 3.2 * Move CodeQL to Commit Stage * Rename to Delivery Co-authored-by: Aaron Lane <2400330-aaron-lane@users.noreply.gitlab.com>
- Loading branch information
1 parent
ca1fabe
commit f24ec65
Showing
7 changed files
with
169 additions
and
215 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
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 |
---|---|---|
@@ -0,0 +1,142 @@ | ||
name: Delivery | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
commit: | ||
name: "Commit" | ||
if: ${{ github.ref_type == 'branch' }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ruby-version: | ||
- '2.6' | ||
- '2.7' | ||
- '3.0' | ||
- '3.1' | ||
- '3.2' | ||
runs-on: ubuntu-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 | ||
- name: Run RSpec Tests | ||
if: ${{ matrix.ruby-version != '3.2' }} | ||
run: bundle exec rake test:rspec | ||
- name: Run RSpec Tests with Code Coverage | ||
if: ${{ matrix.ruby-version == '3.2' }} | ||
uses: paambaati/codeclimate-action@v3.2.0 | ||
env: | ||
CC_TEST_REPORTER_ID: 7574433e1beed630cb9a171c688bb9e010d5028f00f7218d6e845fe138c65168 | ||
with: | ||
coverageCommand: bundle exec rake test:rspec | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ruby | ||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
- name: Build Ruby Gem | ||
if: ${{ matrix.ruby-version == '3.2' }} | ||
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 | ||
if: ${{ github.event_name == 'push' && github.ref_name == 'main' && matrix.ruby-version == '3.2' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ruby-gem | ||
path: kitchen-terraform.gem | ||
|
||
acceptance: | ||
name: "Acceptance" | ||
if: ${{ github.ref_type == 'branch' && github.event_name == 'push' && github.ref_name == 'main' }} | ||
needs: | ||
- commit | ||
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' | ||
runs-on: ${{ matrix.operating-system }}-latest | ||
env: | ||
BUNDLE_GEMFILE: gems-acceptance.rb | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
- name: Download Ruby Gem | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ruby-gem | ||
path: kitchen-terraform.gem | ||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
# kitchen/rake_tasks raises a `NameError: undefined method `=~'` error on Ruby 3.2 | ||
ruby-version: '3.1' | ||
bundler: '2.4' | ||
bundler-cache: true | ||
- 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.2.0 | ||
with: | ||
terragrunt_version: ${{ matrix.terragrunt-version }} | ||
- name: Mirror Terraform Providers | ||
run: | | ||
cd ./test/terraform/PlugIns | ||
terraform providers mirror ./PlugInDirectory | ||
- name: Run Kitchen Tests | ||
run: | | ||
bundle exec rake test:kitchen:attributes-${{ matrix.operating-system }} | ||
bundle exec rake test:kitchen:plug-ins-${{ matrix.operating-system }} | ||
bundle exec rake test:kitchen:variables-${{ matrix.operating-system }} | ||
bundle exec rake test:kitchen:workspaces-${{ matrix.operating-system }} | ||
- name: Run Kitchen Test backend-ssh | ||
if: ${{ matrix.operating-system == 'ubuntu' }} | ||
run: | | ||
chmod 400 ./test/terraform/$VERSION_MATCHER/backend-ssh/id_ed25519 | ||
bundle exec rake test:kitchen:backend-ssh-ubuntu | ||
release: | ||
name: "Release" | ||
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up 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 | ||
path: kitchen-terraform.gem | ||
- name: Publish | ||
env: | ||
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }} | ||
run: gem push kitchen-terraform.gem |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright 2016-2021 Copado NCS LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
source "https://rubygems.org/" | ||
|
||
ruby ">= 2.6" | ||
|
||
gem "kitchen-terraform", path: "kitchen-terraform.gem" | ||
gem "rake", "~> 13.0" |