Skip to content

Commit

Permalink
Fail early when worktree dirty (#25)
Browse files Browse the repository at this point in the history
Co-authored-by: brian shore <bshore@hashicorp.com>
  • Loading branch information
samsalisbury and shore committed Jan 11, 2023
1 parent a7172d5 commit 941a719
Show file tree
Hide file tree
Showing 12 changed files with 256 additions and 67 deletions.
4 changes: 2 additions & 2 deletions action.yml
Expand Up @@ -115,7 +115,7 @@ runs:
- name: Run Primary Build
shell: bash
working-directory: ${{ inputs.work_dir }}
run: $RUN_CLI build
run: $RUN_CLI build -clean -json

# Upload Primary Build
- name: Upload Primary Zip
Expand All @@ -130,7 +130,7 @@ runs:
if: inputs.reproducible == 'assert' || inputs.reproducible == 'report'
shell: bash
working-directory: ${{ inputs.work_dir }}
run: $RUN_CLI build -verification
run: $RUN_CLI build -clean -json -verification

# Upload Local Verification Build
- name: Upload Local Verification Zip
Expand Down
31 changes: 31 additions & 0 deletions e2e/test.bats
@@ -0,0 +1,31 @@
#!/usr/bin/env bats

set -Eeuo pipefail

# This tests that we get the same verification zip path when we run the commands:
#
# - config
# - inspect -build-config -verification
# - build -verification
@test "verification output paths match" {
rm -rf dist/ out/
CONFIG="$(actions-go-build config | grep ZIP_PATH_VERIFICATION | grep -Eo '/.*$')"
BUILDENV="$(actions-go-build inspect --build-config --verification | jq -r .Paths.ZipPath)"
actions-go-build build -q
BUILD="$(actions-go-build build -q -verification -json | jq -r .Config.Paths.ZipPath)"

echo "$CONFIG"
echo "$BUILDENV"
echo "$BUILD"

if [ "$CONFIG" != "$BUILDENV" ]; then
echo "config vs. buildenv:"
diff <(echo "$CONFIG") <(echo "$BUILDENV")
fi
if [ "$CONFIG" != "$BUILD" ]; then
echo "config vs. build:"
diff <(echo "$CONFIG") <(echo "$BUILD")
fi

[[ "$CONFIG" == "$BUILDENV" ]]
}
34 changes: 19 additions & 15 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 941a719

Please sign in to comment.