-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: binary-size | ||
on: push | ||
# Prevent writing to the repository using the CI token. | ||
# Ref: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions | ||
permissions: read-all | ||
env: | ||
MAKEFLAGS: "-j 2" | ||
jobs: | ||
buf-binary-size: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: setup-go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21.x' | ||
- name: cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cache/buf/${{ runner.os }}/x86_64/bin | ||
~/.cache/buf/${{ runner.os }}/x86_64/go/pkg/mod | ||
~/.cache/buf/${{ runner.os }}/x86_64/gocache | ||
~/.cache/buf/${{ runner.os }}/x86_64/include | ||
~/.cache/buf/${{ runner.os }}/x86_64/versions | ||
key: ${{ runner.os }}-buf-${{ hashFiles('**/go.sum', 'make/**') }} | ||
restore-keys: | | ||
${{ runner.os }}-buf- | ||
- name: make-bufbinarysize | ||
run: make bufbinarysize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
DIR="$(CDPATH= cd "$(dirname "${0}")/../../.." && pwd)" | ||
cd "${DIR}" | ||
|
||
TMP="$(mktemp -d )" | ||
trap 'rm -rf "${TMP}"' EXIT | ||
|
||
fail() { | ||
echo "error: $@" >&2 | ||
exit 1 | ||
} | ||
|
||
size_bytes() { | ||
case "$(uname -s)" in | ||
Darwin) stat -f%z "${1}" ;; | ||
Linux) stat -c%s "${1}" ;; | ||
*) fail "must be run on darwin or linux" ;; | ||
esac | ||
} | ||
|
||
# Build in the same manner as we do in release.bash. | ||
CGO_ENABLED=0 \ | ||
GOOS=darwin \ | ||
GOARCH=arm64 \ | ||
go build -a -ldflags "-s -w" -trimpath -buildvcs=false \ | ||
-o "${TMP}/bin" \ | ||
"${1}" | ||
|
||
echo "$(awk "BEGIN { printf(\"%.2f\", $(size_bytes "${TMP}/bin") / 1048576.0) }") MB" |
2 changes: 1 addition & 1 deletion
2
private/bufpkg/bufplugin/bufplugindocker/testdata/success/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
FROM alpine:3.19.0 | ||
FROM alpine:3.19.1 | ||
|
||
RUN echo "success" |