ci: add go binary diff (#562)

* ci: add go binary diff

* copilot fix :)

* print the diff in a code block

* fix yaml

* fix eof

* use cat command
This commit is contained in:
Alexis Couvreur
2025-03-12 22:47:16 -04:00
committed by GitHub
parent 31464c38b5
commit 13fc346a89
4 changed files with 220 additions and 18 deletions

View File

@@ -32,7 +32,7 @@ jobs:
cache-dependency-path: go.sum
- name: Build
run: go build -v ./cmd/sablier
run: make
- name: Test
run: go test -v -json -race -covermode atomic -coverprofile coverage.txt ./... 2>&1 | go tool go-junit-report -parser gojson -set-exit-code > junit.xml
@@ -57,4 +57,34 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: junit.xml
disable-search: true
disable-search: true
# TODO: Download release asset action with cache
- name: Download latest released Sablier binary
if: ${{ !cancelled() }}
id: latest-release
run: |
release_data=$(curl -s https://api.github.com/repos/sablierapp/sablier/releases/latest)
artifact_url=$(echo $release_data | jq -r '.assets[] | select(.name | contains("linux-amd64")) | .browser_download_url')
version=$(echo $release_data | jq -r '.tag_name')
wget -q $artifact_url -O sablier_${version}_linux-amd64
echo "artifact_path=sablier_${version}_linux-amd64" >> $GITHUB_OUTPUT
- name: Compare the downloaded binary with the built binary
if: ${{ !cancelled() }}
id: diff
run: |
go tool gsa -o diff.txt ${{ steps.latest-release.outputs.artifact_path }} sablier_draft_linux-amd64
echo "diff<<EOF" >> $GITHUB_OUTPUT
echo "$(cat diff.txt)" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Comment diff on pull request
if: ${{ !cancelled() }}
uses: thollander/actions-comment-pull-request@v3
with:
message: |
```
${{ steps.diff.outputs.diff }}
```
comment-tag: go-binary-diff