Files
sablier/.github/workflows/build.yml
dependabot[bot] f27878722c build(deps): bump actions/checkout from 4 to 5 (#659)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-14 00:49:57 -04:00

106 lines
3.2 KiB
YAML

name: Build
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
build:
name: Build
permissions:
contents: read
id-token: write # OIDC with Codecov
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v5
- name: Set up Go 1.24
uses: actions/setup-go@v5
with:
go-version: ^1.24
cache-dependency-path: go.sum
- name: Build
run: make
- name: Disable AppArmor on the GitHub runner
uses: cisagov/action-disable-apparmor@437d94f26a2e4bf8c03acfb500a6afc688b497db # v1.0.0
- name: Enable unprivileged user namespaces
run: sudo sysctl -w kernel.unprivileged_userns_clone=1
- name: Test
run: go test -tags="nomsgpack,remote,exclude_graphdriver_btrfs,containers_image_openpgp" -v -json -race -covermode atomic -coverprofile coverage.txt ./... 2>&1 | go tool go-junit-report -parser gojson -set-exit-code > junit.xml
- name: Display JUnit report
if: ${{ !cancelled() }}
run: cat junit.xml
- name: Upload junit report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: junit-report
path: junit.xml
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5
with:
use_oidc: true
fail_ci_if_error: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
use_oidc: true
fail_ci_if_error: true
- name: Run Basic Test Results Action
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
uses: codecov/basic-test-results@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: junit.xml
disable-search: true
# TODO: Download release asset action with cache
- name: Download latest released Sablier binary
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
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() && github.event_name == 'pull_request' }}
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() && github.event_name == 'pull_request' }}
uses: thollander/actions-comment-pull-request@v3
with:
message: |
```
${{ steps.diff.outputs.diff }}
```
comment-tag: go-binary-diff