-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into bmm/update-use-cases
- Loading branch information
Showing
195 changed files
with
1,927 additions
and
743 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 |
---|---|---|
|
@@ -2,14 +2,8 @@ | |
# SPDX-License-Identifier: BUSL-1.1 | ||
|
||
name: equivalence-test | ||
description: "Execute the suite of Terraform equivalence tests in testing/equivalence-tests" | ||
description: "Execute the suite of Terraform equivalence tests in testing/equivalence-tests and update the golden files." | ||
inputs: | ||
target-terraform-version: | ||
description: "The version of Terraform to use in execution." | ||
required: true | ||
target-terraform-branch: | ||
description: "The branch within this repository to update and compare." | ||
required: true | ||
target-equivalence-test-version: | ||
description: "The version of the Terraform equivalence tests to use." | ||
default: "0.3.0" | ||
|
@@ -19,9 +13,22 @@ inputs: | |
target-arch: | ||
description: "Current architecture" | ||
default: "amd64" | ||
current-branch: | ||
description: "What branch are we currently on?" | ||
required: true | ||
new-branch: | ||
description: "Name of new branch to be created for the review." | ||
required: true | ||
reviewers: | ||
description: "Comma-separated list of GitHub usernames to request review from." | ||
required: true | ||
message: | ||
description: "Message to include in the commit." | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
|
||
- name: "download equivalence test binary" | ||
shell: bash | ||
run: | | ||
|
@@ -30,32 +37,43 @@ runs: | |
./bin/equivalence-tests \ | ||
${{ inputs.target-os }} \ | ||
${{ inputs.target-arch }} | ||
- name: "download terraform binary" | ||
- name: Build terraform | ||
shell: bash | ||
run: | | ||
./.github/scripts/equivalence-test.sh download_terraform_binary \ | ||
${{ inputs.target-terraform-version }} \ | ||
./bin/terraform \ | ||
${{ inputs.target-os }} \ | ||
${{ inputs.target-arch }} | ||
run: ./.github/scripts/equivalence-test.sh build_terraform_binary ./bin/terraform | ||
|
||
- name: "run and update equivalence tests" | ||
id: execute | ||
shell: bash | ||
run: | | ||
./bin/equivalence-tests update \ | ||
--tests=testing/equivalence-tests/tests \ | ||
--goldens=testing/equivalence-tests/outputs \ | ||
--binary=$(pwd)/bin/terraform | ||
git add --intent-to-add testing/equivalence-tests/outputs | ||
changed=$(git diff --quiet -- testing/equivalence-tests/outputs || echo true) | ||
if [[ $changed == "true" ]]; then | ||
echo "found changes, and pushing new golden files into branch ${{ inputs.target-terraform-branch }}." | ||
git config user.email "[email protected]" | ||
git config user.name "The Terraform Team" | ||
echo "changed=$changed" >> "${GITHUB_OUTPUT}" | ||
git add ./testing/equivalence-tests/outputs | ||
git commit -m "Automated equivalence test golden file update for release ${{ inputs.target-terraform-version }}." | ||
git push | ||
else | ||
echo "found no changes, so not pushing any updates." | ||
fi | ||
- name: "branch, commit, and push changes" | ||
if: steps.execute.outputs.changed == 'true' | ||
shell: bash | ||
run: | | ||
git config user.name "hc-github-team-tf-core" | ||
git config user.email "[email protected]" | ||
git checkout -b ${{ inputs.new-branch }} | ||
git add testing/equivalence-tests/outputs | ||
git commit -m "Update equivalence test golden files." | ||
git push --set-upstream origin ${{ inputs.new-branch }} | ||
- name: "create pull request" | ||
if: steps.execute.outputs.changed == 'true' | ||
shell: bash | ||
run: | | ||
gh pr create \ | ||
--draft \ | ||
--base ${{ inputs.current-branch }} \ | ||
--head ${{ inputs.new-branch }} \ | ||
--title "Update equivalence test golden files" \ | ||
--body '${{ inputs.message }}' \ | ||
--reviewer ${{ inputs.reviewers }} |
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 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,73 @@ | ||
name: equivalence-test-diff | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- ready_for_review | ||
- reopened | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
jobs: | ||
equivalence-test-diff: | ||
name: "Equivalence Test Diff" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Fetch source code | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: Determine Go version | ||
id: go | ||
uses: ./.github/actions/go-version | ||
|
||
- name: Install Go toolchain | ||
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | ||
with: | ||
go-version: ${{ steps.go.outputs.version }} | ||
cache-dependency-path: go.sum | ||
|
||
- name: Download testing framework | ||
shell: bash | ||
run: | | ||
./.github/scripts/equivalence-test.sh download_equivalence_test_binary \ | ||
0.4.0 \ | ||
./bin/equivalence-tests \ | ||
linux \ | ||
amd64 | ||
- name: Build terraform | ||
shell: bash | ||
run: ./.github/scripts/equivalence-test.sh build_terraform_binary ./bin/terraform | ||
|
||
- name: Run equivalence tests | ||
id: equivalence-tests | ||
shell: bash {0} # we want to capture the exit code | ||
run: | | ||
./bin/equivalence-tests diff \ | ||
--tests=testing/equivalence-tests/tests \ | ||
--goldens=testing/equivalence-tests/outputs \ | ||
--binary=$(pwd)/bin/terraform | ||
echo "exit-code=$?" >> "${GITHUB_OUTPUT}" | ||
- name: Equivalence tests failed | ||
if: steps.equivalence-tests.outputs.exit-code == 1 # 1 is the exit code for failure | ||
shell: bash | ||
run: | | ||
gh pr comment ${{ github.event.pull_request.number }} \ | ||
--body "The equivalence tests failed. Please investigate [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})." | ||
exit 1 # fail the job | ||
- name: Equivalence tests changed | ||
if: steps.equivalence-tests.outputs.exit-code == 2 # 2 is the exit code for changed | ||
shell: bash | ||
run: | | ||
gh pr comment ${{ github.event.pull_request.number }} \ | ||
--body "The equivalence tests will be updated. Please verify the changes [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})." |
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
Oops, something went wrong.