Skip to content

feat(setup): switch to official terramate-setup-action #63

feat(setup): switch to official terramate-setup-action

feat(setup): switch to official terramate-setup-action #63

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-pull-request:
name: Test Pull Request
runs-on: ubuntu-latest
needs:
- test-simple
if: ${{ github.event_name == 'pull_request' }}
strategy:
matrix:
terramate-args: ["--changed", ""]
comment-pull-request: ["true", "false"]
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 }}
comment-pull-request: ${{ matrix.comment-pull-request }}
github-token: ${{ secrets.GITHUB_TOKEN }}
test-setup:
name: Test Setup
runs-on: ubuntu-latest
needs:
- test-simple
strategy:
matrix:
go-version: ["1.17", "latest"]
terramate-version: ["v0.4.2", "latest"]
terraform-version: ["1.5.7", "latest"]
terraform-plan-file: ["out.tfplan", "plan.out"]
tmp-file: ["tmp.txt", "file.tmp"]
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:
go-version: ${{ matrix.go-version }}
terramate-version: ${{ matrix.terramate-version }}
terraform-version: ${{ matrix.terraform-version }}
terraform-plan-file: ${{ matrix.terraform-plan-file }}
temp-file: ${{ matrix.tmp-file }}
cleanup: ${{ matrix.cleanup }}
comment-pull-request: false
test-jobs:
name: Test Jobs
runs-on: ubuntu-latest
needs:
- test-setup
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 }}
comment-pull-request: false
- 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 }}
comment-pull-request: false
- 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 }}
comment-pull-request: false
test-terraform-args:
name: Test Terraform Arguments
runs-on: ubuntu-latest
needs:
- test-jobs
strategy:
matrix:
terraform-common-args: ["-no-color", ""]
terraform-init-args: ["-upgrade", ""]
terraform-validate-args: ["-json", ""]
terraform-plan-args: ["-parallelism=3", ""]
terraform-show-args: ["-no-color", ""]
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:
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-show-args: ${{ matrix.terraform-plan-args }}
terraform-apply-args: ${{ matrix.terraform-apply-args }}
terraform-destroy-args: ${{ matrix.terraform-destroy-args }}
apply: true
destroy: true
comment-pull-request: false
test-terramate-args:
name: Test Terramate Arguments
runs-on: ubuntu-latest
needs:
- test-jobs
strategy:
matrix:
terramate-args: ["--changed", ""]
terramate-plan-args: ["--quiet", ""]
terramate-apply-args: ["--quiet", ""]
terramate-destroy-args: ["--reverse", ""]
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 }}
terrmate-plan-args: ${{ matrix.terramate-plan-args }}
terramate-apply-args: ${{ matrix.terramate-apply-args }}
terramate-destroy-args: ${{ matrix.terramate-destroy-args }}
apply: true
destroy: true
comment-pull-request: false
release:
name: Release
needs:
- test-terraform-args
- test-terramate-args
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 }}