Skip to content

Commit

Permalink
fix: compare hashes without paths
Browse files Browse the repository at this point in the history
  • Loading branch information
aalu1418 committed Aug 5, 2024
1 parent fd6027e commit d1cd6fe
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/e2e_custom_cl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,15 @@ jobs:
with:
name: artifacts
path: ./temp/artifacts
- name: hash current artifacts
id: current
run: |
cd ./temp/artifacts # need to be in directory for hashes to compare without path differences
# shellcheck disable=SC2035
echo "hash=$(sha1sum * | sha1sum)" >> "$GITHUB_OUTPUT"
- name: build contracts
id: previous
run: |
# TODO: make dynamic container
# docker run -d -v "$(pwd)":/repo --name build-container projectserum/build:v0.25.0 tail -f /dev/null
Expand All @@ -120,13 +128,24 @@ jobs:
docker stop build-container
docker rm build-container
# copy + save hash
cp ${{ env.CONTRACT_ARTIFACTS_PATH }}/* ./temp/artifacts/previous
cd ./temp/artifacts/previous # need to be in directory for hashes to compare without path differences
# shellcheck disable=SC2035
echo "hash=$(sha1sum * | sha1sum)" >> "$GITHUB_OUTPUT"
- name: compare hashes
id: check
run: |
echo "current: $(sha1sum ./temp/artifacts/* | sha1sum)" # get hash of current artifacts
mkdir -p temp/artifacts/previous
cp ${{ env.CONTRACT_ARTIFACTS_PATH }}/* temp/artifacts/previous
echo "previous: $(sha1sum ${{ env.CONTRACT_ARTIFACTS_PATH }}/* | sha1sum)" # get hash of previous artifacts
echo "previous: ${{ steps.previous.outputs.hash }}"
echo "current: ${{ steps.current.outputs.hash }}"
if [ "${{ steps.previous.outputs.hash }}" != "${{ steps.current.outputs.hash }}" ]; then
echo "continue=true" >> "$GITHUB_OUTPUT"
fi
- uses: actions/upload-artifact@v4
if: steps.check.outputs.continue
with:
name: artifacts
path: ./temp/artifacts/ # combine artifacts
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/upstream-tracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ jobs:
WIKI="${WIKI//$'\n'/\\n}" # preserve new line
printf -v WIKI "%q " "$WIKI" # escape chars that may cause issues
echo "open<<EOF" >> $GITHUB_OUTPUT
echo "$OPEN" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "open<<EOF" >> "$GITHUB_OUTPUT"
echo "$OPEN" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
echo "closed<<EOF" >> $GITHUB_OUTPUT
echo "$CLOSED" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "closed<<EOF" >> "$GITHUB_OUTPUT"
echo "$CLOSED" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
echo "wiki<<EOF" >> $GITHUB_OUTPUT
echo "$WIKI" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "wikirange=$WIKIRANGE" >> $GITHUB_OUTPUT
echo "wiki<<EOF" >> "$GITHUB_OUTPUT"
echo "$WIKI" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
echo "wikirange=$WIKIRANGE" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
if: steps.updates.outputs.open || steps.updates.outputs.closed || steps.updates.outputs.wiki
- name: Open Issue
Expand Down

0 comments on commit d1cd6fe

Please sign in to comment.