-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>
- Loading branch information
Showing
1 changed file
with
68 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,78 @@ | ||
--- | ||
name: TF Tests | ||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, closed] | ||
paths: ['**.yaml', scripts/**, tests/**] | ||
name: TF Tests | ||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, closed] | ||
paths: ['**.yaml', scripts/**, tests/**] | ||
|
||
jobs: | ||
tests: | ||
name: Tests Job | ||
runs-on: ubuntu-latest | ||
if: github.event.action != 'closed' || github.event.pull_request.merged | ||
jobs: | ||
tests: | ||
name: Tests Job | ||
runs-on: ubuntu-latest | ||
if: github.event.action != 'closed' || github.event.pull_request.merged | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
cli_uses: [tofu, terraform] | ||
test: | ||
- 10_fail_invalid_resource_type | ||
- 11_fail_data_source_error | ||
- 50_pass_one | ||
- 51_pass_character_limit | ||
- 52_pass_format_diff | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
cli_uses: [tofu, terraform] | ||
test: | ||
- 10_fail_invalid_resource_type | ||
- 11_fail_data_source_error | ||
- 50_pass_one | ||
- 51_pass_character_limit | ||
- 52_pass_format_diff | ||
|
||
permissions: | ||
actions: read # Required for workflow query and artifact download. | ||
contents: read # Required for repository checkout. | ||
issues: read # Required for getting PR branch from issue comment. | ||
pull-requests: write # Required for commenting on PR. | ||
statuses: write # Required for setting commit status from issue comment. | ||
permissions: | ||
actions: read # Required for workflow query and artifact download. | ||
contents: read # Required for repository checkout. | ||
issues: read # Required for getting PR branch from issue comment. | ||
pull-requests: write # Required for commenting on PR. | ||
statuses: write # Required for setting commit status from issue comment. | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- name: Setup TF (via tenv) | ||
env: | ||
CLI_USES: ${{ matrix.cli_uses }} | ||
CLI_VERSION: ~> 1.7.0 | ||
run: | | ||
VERSION=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r .tag_name) | ||
curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${VERSION}_amd64.deb" | ||
sudo dpkg -i "tenv_${VERSION}_amd64.deb" | ||
tenv $CLI_USES install "$CLI_VERSION" && tenv update-path | ||
- name: Setup TF (via tenv) | ||
env: | ||
CLI_USES: ${{ matrix.cli_uses }} | ||
CLI_VERSION: ~> 1.7.0 | ||
run: | | ||
VERSION=$(curl --silent https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r .tag_name) | ||
curl -O -L "https://github.com/tofuutils/tenv/releases/latest/download/tenv_${VERSION}_amd64.deb" | ||
sudo dpkg -i "tenv_${VERSION}_amd64.deb" | ||
tenv $CLI_USES install "$CLI_VERSION" && tenv update-path | ||
- name: Provision TF | ||
id: tf | ||
continue-on-error: true | ||
uses: ./ | ||
with: | ||
chdir_prefix: tests/ | ||
cli_uses: ${{ matrix.cli_uses }} | ||
command_input: ${{ format('-tf={0} -chdir={1}', github.event.action != 'closed' && 'plan' || 'apply', matrix.test) }} | ||
cache_plugins: false | ||
- name: Provision TF | ||
id: tf | ||
continue-on-error: true | ||
uses: ./ | ||
with: | ||
chdir_prefix: tests/ | ||
cli_uses: ${{ matrix.cli_uses }} | ||
command_input: ${{ format('-tf={0} -chdir={1}', github.event.action != 'closed' && 'plan' || 'apply', matrix.test) }} | ||
cache_plugins: false | ||
|
||
- name: Echo TF | ||
run: | | ||
echo "command: ${{ steps.tf.outputs.command }}" | ||
echo "comment_id: ${{ steps.tf.outputs.comment_id }}" | ||
echo "comment_summary: ${{ steps.tf.outputs.comment_summary }}" | ||
echo "plan_id: ${{ steps.tf.outputs.plan_id }}" | ||
echo "tf_fmt: ${{ steps.tf.outputs.tf_fmt }}" | ||
echo "tf_output: ${{ steps.tf.outputs.tf_output }}" | ||
- name: Echo TF | ||
run: | | ||
echo "command: ${{ steps.tf.outputs.command }}" | ||
echo "comment_id: ${{ steps.tf.outputs.comment_id }}" | ||
echo "comment_summary: ${{ steps.tf.outputs.comment_summary }}" | ||
echo "plan_id: ${{ steps.tf.outputs.plan_id }}" | ||
echo "tf_fmt: ${{ steps.tf.outputs.tf_fmt }}" | ||
echo "tf_output: ${{ steps.tf.outputs.tf_output }}" | ||
- name: Echo github-script context | ||
if: always() | ||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
with: | ||
script: console.log(JSON.stringify(context, null, 2)) | ||
- name: Echo github-script context | ||
if: always() | ||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
with: | ||
script: console.log(JSON.stringify(context, null, 2)) | ||
|
||
- name: Echo github context | ||
if: always() | ||
env: | ||
MATRIX_CONTEXT: ${{ toJSON(matrix) }} | ||
GITHUB_CONTEXT: ${{ toJSON(github) }} | ||
run: | | ||
echo "$MATRIX_CONTEXT" | ||
echo "$GITHUB_CONTEXT" | ||
- name: Echo github context | ||
if: always() | ||
env: | ||
MATRIX_CONTEXT: ${{ toJSON(matrix) }} | ||
GITHUB_CONTEXT: ${{ toJSON(github) }} | ||
run: | | ||
echo "$MATRIX_CONTEXT" | ||
echo "$GITHUB_CONTEXT" |