mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-11 08:32:19 -06:00
290fbd66d3
Signed-off-by: Luis Giraldo <giraldo.luisdavid@gmail.com>
57 lines
1.7 KiB
YAML
57 lines
1.7 KiB
YAML
# This workflow runs on pull requests to ensure that the snapshots produced by
|
|
# the equivalence tests are consistent with the snapshots that are checked in.
|
|
#
|
|
# If there is an inconsistency, it is the responsibility of the committer to
|
|
# review it, ensure that any changes are intentional, and then commit the new
|
|
# snapshots.
|
|
name: Snapshots
|
|
|
|
on:
|
|
pull_request:
|
|
|
|
jobs:
|
|
compare:
|
|
name: Compare
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
|
|
|
|
|
- name: Install Go
|
|
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
|
|
with: { go-version: '1.21.3' }
|
|
|
|
- name: Get the equivalence test binary
|
|
run: |
|
|
./.github/scripts/equivalence-test.sh download_equivalence_test_binary \
|
|
0.4.0 \
|
|
./bin/equivalence-testing \
|
|
linux \
|
|
amd64
|
|
|
|
- name: Build the OpenTofu binary
|
|
run: |
|
|
go build -o ./bin/tofu ./cmd/tofu
|
|
|
|
- name: Run the equivalence tests
|
|
run: |
|
|
./bin/equivalence-testing update \
|
|
--tests=testing/equivalence-tests/tests \
|
|
--goldens=testing/equivalence-tests/outputs \
|
|
--rewrites=testing/rewrites.jsonc \
|
|
--binary=./bin/tofu \
|
|
|
|
- name: Ensure there is no diff
|
|
shell: bash
|
|
run: |
|
|
changed=$(git diff --quiet -- testing/equivalence-tests/outputs || echo true)
|
|
if [[ "$changed" == "true" ]]; then
|
|
echo "Found changes, please commit the new golden files."
|
|
git diff -- testing/equivalence-tests/outputs
|
|
exit 1
|
|
else
|
|
echo "Found no changes."
|
|
fi
|