Update CICD.yml #51
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
name: "Build" | |
on: [push, pull_request] | |
jobs: | |
Matrix: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate Matrix | |
id: matrix | |
uses: Invicton-Labs/terraform-module-testing/matrix@dev | |
with: | |
minimum_tf_version: '1.10.3' | |
additional_runners: 'macos-13, windows-2019' | |
- name: Output Matrix | |
run: | | |
echo "Strategy: ${{ steps.matrix.outputs.strategy }}" | |
outputs: | |
strategy: ${{ steps.matrix.outputs.strategy }} | |
Test: | |
needs: [Matrix] | |
strategy: ${{ fromJSON(needs.Matrix.outputs.strategy)}} | |
runs-on: ${{ matrix.runs-on }} | |
container: ${{ matrix.container }} | |
steps: | |
- name: Initialize - Pass | |
id: init-pass | |
uses: Invicton-Labs/terraform-module-testing/initialize@dev | |
with: | |
tf_path: tests/pass | |
- name: Run Tests - Pass | |
id: tests-pass | |
uses: Invicton-Labs/terraform-module-testing/apply-destroy@dev | |
with: | |
tf_path: tests/pass | |
- name: Initialize - Pass (With Output) | |
id: init-pass-output | |
uses: Invicton-Labs/terraform-module-testing/initialize@dev | |
with: | |
tf_path: tests/pass-output | |
- name: Run Tests - Pass (With Output) | |
id: tests-pass-output | |
uses: Invicton-Labs/terraform-module-testing/apply-destroy@dev | |
with: | |
tf_path: tests/pass-output | |
- name: Initialize - Pass - Condition Delayed | |
id: init-pass-condition-delayed | |
uses: Invicton-Labs/terraform-module-testing/initialize@dev | |
with: | |
tf_path: tests/pass-condition-delayed | |
- name: Run Tests - Pass - Condition Delayed | |
id: tests-pass-condition-delayed | |
uses: Invicton-Labs/terraform-module-testing/apply-destroy@dev | |
with: | |
tf_path: tests/pass-condition-delayed | |
- name: Initialize - Pass - Message Delayed | |
id: init-pass-message-delayed | |
uses: Invicton-Labs/terraform-module-testing/initialize@dev | |
with: | |
tf_path: tests/pass-message-delayed | |
- name: Run Tests - Pass - Message Delayed | |
id: tests-pass-message-delayed | |
uses: Invicton-Labs/terraform-module-testing/apply-destroy@dev | |
with: | |
tf_path: tests/pass-message-delayed | |
stderr_contains: Unsuitable value for error message | |
- name: Initialize - Pass - Condition & Message Delayed | |
id: init-pass-condition-message-delayed | |
uses: Invicton-Labs/terraform-module-testing/initialize@dev | |
with: | |
tf_path: tests/pass-condition-message-delayed | |
- name: Run Tests - Pass - Condition & Message Delayed | |
id: tests-pass-condition-message-delayed | |
uses: Invicton-Labs/terraform-module-testing/apply-destroy@dev | |
with: | |
tf_path: tests/pass-condition-message-delayed | |
- name: Initialize - Fail | |
id: init-fail | |
uses: Invicton-Labs/terraform-module-testing/initialize@dev | |
with: | |
tf_path: tests/fail | |
- name: Run Tests - Fail | |
id: tests-fail | |
uses: Invicton-Labs/terraform-module-testing/apply-failure@dev | |
with: | |
tf_path: tests/fail | |
stderr_contains: sample error | |
- name: Initialize - Fail (Output) | |
id: init-fail-output | |
uses: Invicton-Labs/terraform-module-testing/initialize@dev | |
with: | |
tf_path: tests/fail-output | |
- name: Run Tests - Fail (Output) | |
id: tests-fail-output | |
uses: Invicton-Labs/terraform-module-testing/apply-failure@dev | |
with: | |
tf_path: tests/fail-output | |
stderr_contains: sample error | |
- name: Initialize - Fail - Condition Delayed | |
id: init-fail-condition-delayed | |
uses: Invicton-Labs/terraform-module-testing/initialize@dev | |
with: | |
tf_path: tests/fail-condition-delayed | |
- name: Run Tests - Fail - Condition Delayed | |
id: tests-fail-condition-delayed | |
uses: Invicton-Labs/terraform-module-testing/apply-failure@dev | |
with: | |
tf_path: tests/fail-condition-delayed | |
stderr_contains: sample error | |
- name: Initialize - Fail - Message Delayed | |
id: init-fail-message-delayed | |
uses: Invicton-Labs/terraform-module-testing/initialize@dev | |
with: | |
tf_path: tests/fail-message-delayed | |
- name: Run Tests - Fail - Message Delayed | |
id: tests-fail-message-delayed | |
uses: Invicton-Labs/terraform-module-testing/apply-failure@dev | |
with: | |
tf_path: tests/fail-message-delayed | |
stderr_contains: Unsuitable value for error message | |
- name: Initialize - Fail - Condition & Message Delayed | |
id: init-fail-condition-message-delayed | |
uses: Invicton-Labs/terraform-module-testing/initialize@dev | |
with: | |
tf_path: tests/fail-condition-message-delayed | |
- name: Run Tests - Fail - Condition & Message Delayed | |
id: tests-fail-condition-message-delayed | |
uses: Invicton-Labs/terraform-module-testing/apply-failure@dev | |
with: | |
tf_path: tests/fail-condition-message-delayed | |
stderr_contains: sample error | |
# This job just waits for all other jobs to pass. We have it here | |
# so our branch protection rule can reference a single job, instead | |
# of needing to list every matrix value of every job above. | |
Passed: | |
runs-on: ubuntu-latest | |
needs: [Test] | |
steps: | |
- name: Mark tests as passed | |
run: echo "🎉" |