|
| 1 | +name: "Tests" |
| 2 | +defaults: |
| 3 | + run: |
| 4 | + shell: bash |
| 5 | +on: |
| 6 | + pull_request: |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + terraform-linter: |
| 11 | + name: Linter |
| 12 | + runs-on: ubuntu-24.04 |
| 13 | + timeout-minutes: 5 |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + terraform_version: [1.5.6, 1.10.1] |
| 17 | + directory: [., ./examples/complete/] |
| 18 | + fail-fast: false |
| 19 | + steps: |
| 20 | + - name: Checkout Code |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + submodules: true |
| 24 | + |
| 25 | + - uses: hashicorp/setup-terraform@v3 |
| 26 | + with: |
| 27 | + terraform_version: ${{ matrix.terraform_version }} |
| 28 | + |
| 29 | + - name: Terraform init |
| 30 | + working-directory: ${{ matrix.directory }} |
| 31 | + run: terraform init |
| 32 | + |
| 33 | + - name: Tflint Report Output |
| 34 | + |
| 35 | + with: |
| 36 | + working_directory: ${{ matrix.directory }} |
| 37 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 38 | + tflint_version: "v0.49.0" |
| 39 | + reporter: github-pr-review |
| 40 | + fail_on_error: "true" |
| 41 | + filter_mode: "added" |
| 42 | + flags: "--module" |
| 43 | + |
| 44 | + terraform-formatter: |
| 45 | + name: Formatter |
| 46 | + runs-on: ubuntu-24.04 |
| 47 | + timeout-minutes: 5 |
| 48 | + strategy: |
| 49 | + matrix: |
| 50 | + terraform_version: [1.5.6, 1.10.1] |
| 51 | + directory: [., ./examples/complete/] |
| 52 | + fail-fast: false |
| 53 | + steps: |
| 54 | + - name: Checkout Code |
| 55 | + uses: actions/checkout@v4 |
| 56 | + with: |
| 57 | + submodules: true |
| 58 | + |
| 59 | + - uses: hashicorp/setup-terraform@v3 |
| 60 | + with: |
| 61 | + terraform_version: ${{ matrix.terraform_version }} |
| 62 | + |
| 63 | + - name: Terraform init |
| 64 | + working-directory: ${{ matrix.directory }} |
| 65 | + run: terraform init |
| 66 | + |
| 67 | + - name: Terraform Format suggestions |
| 68 | + working-directory: ${{ matrix.directory }} |
| 69 | + run: terraform fmt |
| 70 | + |
| 71 | + - uses: reviewdog/[email protected] |
| 72 | + with: |
| 73 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 74 | + tool_name: "terraform" |
| 75 | + fail_on_error: "true" |
| 76 | + filter_mode: "added" |
| 77 | + |
| 78 | + terraform-e2e: |
| 79 | + name: E2E Tests (Terraform) |
| 80 | + strategy: |
| 81 | + max-parallel: 1 |
| 82 | + matrix: |
| 83 | + terraform_version: [1.5.6, 1.10.1] |
| 84 | + os: [ubuntu-24.04] |
| 85 | + runs-on: ${{ matrix.os }} |
| 86 | + steps: |
| 87 | + - name: Checkout Code |
| 88 | + uses: actions/checkout@v4 |
| 89 | + with: |
| 90 | + submodules: true |
| 91 | + |
| 92 | + - uses: hashicorp/setup-terraform@v3 |
| 93 | + with: |
| 94 | + terraform_version: ${{ matrix.terraform_version }} |
| 95 | + |
| 96 | + - name: Install Go |
| 97 | + uses: actions/setup-go@v5 |
| 98 | + with: |
| 99 | + go-version: 1.23.x |
| 100 | + |
| 101 | + - name: Run Tests |
| 102 | + working-directory: test/ |
| 103 | + env: |
| 104 | + LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} |
| 105 | + run: | |
| 106 | + go install github.com/gruntwork-io/terratest/cmd/terratest_log_parser@latest |
| 107 | + go mod tidy |
| 108 | + go test -v -timeout 60m -coverprofile=coverage-examples-complete.out -race -covermode=atomic | tee test_output.log >> $GITHUB_STEP_SUMMARY |
| 109 | + terratest_log_parser -testlog test_output.log -outputdir results |
| 110 | +
|
| 111 | + - name: Test Summary |
| 112 | + uses: test-summary/action@v2 |
| 113 | + with: |
| 114 | + paths: | |
| 115 | + test/results/**/*.xml |
| 116 | + test/results/*.xml |
| 117 | +
|
| 118 | + opentofu-e2e: |
| 119 | + name: E2E Tests (OpenTofu) |
| 120 | + strategy: |
| 121 | + max-parallel: 1 |
| 122 | + matrix: |
| 123 | + opentofu_version: [1.6.0, 1.8.7] |
| 124 | + os: [ubuntu-24.04] |
| 125 | + runs-on: ${{ matrix.os }} |
| 126 | + steps: |
| 127 | + - name: Checkout Code |
| 128 | + uses: actions/checkout@v4 |
| 129 | + with: |
| 130 | + submodules: true |
| 131 | + |
| 132 | + - uses: opentofu/setup-opentofu@v1 |
| 133 | + with: |
| 134 | + tofu_version: ${{ matrix.opentofu_version }} |
| 135 | + |
| 136 | + - name: Install Go |
| 137 | + uses: actions/setup-go@v5 |
| 138 | + with: |
| 139 | + go-version: 1.23.x |
| 140 | + |
| 141 | + - name: Run Tests |
| 142 | + working-directory: test/ |
| 143 | + env: |
| 144 | + LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} |
| 145 | + run: | |
| 146 | + go install github.com/gruntwork-io/terratest/cmd/terratest_log_parser@latest |
| 147 | + go mod tidy |
| 148 | + go test -v -timeout 60m -coverprofile=coverage-examples-complete.out -race -covermode=atomic | tee test_output.log >> $GITHUB_STEP_SUMMARY |
| 149 | + terratest_log_parser -testlog test_output.log -outputdir results |
| 150 | +
|
| 151 | + - name: Test Summary |
| 152 | + uses: test-summary/action@v2 |
| 153 | + with: |
| 154 | + paths: | |
| 155 | + test/results/**/*.xml |
| 156 | + test/results/*.xml |
| 157 | +
|
0 commit comments