Skip to content

Commit

Permalink
reproducible builds (#42)
Browse files Browse the repository at this point in the history
* initial

* fix

* fix

* fix

* fix

* fix
  • Loading branch information
JekaMas authored Nov 9, 2022
1 parent 805919c commit 0acf0db
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,25 @@ jobs:

- name: Run Go Test with race
run: go test -race -shuffle=on -timeout 28m ./...

reproducible-builds:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x

- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive

- name: Reproducible build test
run: |
make builds-dummy
shasum -a256 ./build/ibft1 | cut -d " " -f 1 > ibft1.sha256
shasum -a256 ./build/ibft2 | cut -d " " -f 1 > ibft2.sha256
if ! cmp ibft1.sha256 ibft2.sha256; then
echo >&2 "Reproducible build broken"; cat ibft1.sha256; cat ibft2.sha256; exit 1
fi
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bin/
build/
dist/

# MacOS Leftovers
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.PHONY: lint
.PHONY: lint build-dummy
lint:
golangci-lint run -E whitespace -E wsl -E wastedassign -E unconvert -E tparallel -E thelper -E stylecheck -E prealloc \
-E predeclared -E nlreturn -E misspell -E makezero -E lll -E importas -E ifshort -E gosec -E gofmt -E goconst \
-E forcetypeassert -E dogsled -E dupl -E errname -E errorlint -E nolintlint --timeout 2m

builds-dummy:
cd build && go build -o ./ibft1
cd build && go build -o ./ibft2
15 changes: 15 additions & 0 deletions build/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package main

import (
"fmt"
"io"

"github.com/0xPolygon/go-ibft/core"
)

func main() {
b := core.NewIBFT(nil, nil, nil)

// prevent golang compiler from removing the whole function
fmt.Sprint(io.Discard, b)
}

0 comments on commit 0acf0db

Please sign in to comment.