From 863b4a58fe067961387a4ac6238e80bcfb4caadd Mon Sep 17 00:00:00 2001 From: Lynn Date: Fri, 28 Feb 2020 23:19:43 -0800 Subject: [PATCH] binary size checking hooks --- .github/workflows/cli.yml | 1 + internal/build/build.go | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index c2924e1..c9fa616 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -46,6 +46,7 @@ jobs: run: | go run internal/build/build.go vet go run internal/build/build.go test + go run internal/build/build.go check-binary-size - name: Upload coverage to Codecov if: success() && matrix.go == 1.13 && matrix.os == 'ubuntu-latest' diff --git a/internal/build/build.go b/internal/build/build.go index 5a6415a..df3bd88 100644 --- a/internal/build/build.go +++ b/internal/build/build.go @@ -1,5 +1,3 @@ -//+build ignore - package main import ( @@ -40,6 +38,10 @@ func main() { Name: "toc", Action: TocActionFunc, }, + { + Name: "check-binary-size", + Action: checkBinarySizeActionFunc, + }, } err := app.Run(os.Args) @@ -178,3 +180,12 @@ func TocActionFunc(c *cli.Context) error { return nil } + +func checkBinarySizeActionFunc(c *cli.Context) (err error) { + err = runCmd("git", "diff", "--exit-code") + if err != nil { + return err + } + + return nil +}