-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: improvements #451
ci: improvements #451
Changes from all commits
d1a533b
c386a04
32a1166
aee563d
72d48f6
63c553d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,52 @@ | ||
name: Go lint and test | ||
name: Lint & test | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
branches: [master] | ||
pull_request: | ||
branches: [ master ] | ||
workflow_dispatch: | ||
branches: [master] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: self-hosted | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.18 | ||
- name: Build | ||
run: go build -v ./... | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22 | ||
- name: Build | ||
run: go build -v ./... | ||
|
||
lint: | ||
runs-on: self-hosted | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.18 | ||
- name: Download golangci-lint | ||
run: wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s latest | ||
- name: Lint | ||
run: ./bin/golangci-lint run | ||
- name: Vet | ||
run: go vet | ||
|
||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.60 | ||
- name: Vet | ||
run: go vet | ||
|
||
test: | ||
runs-on: self-hosted | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running tests in three OSs. |
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.18 | ||
- name: Test | ||
run: go test -v -race ./... | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22 | ||
- name: Test | ||
run: go test -v -race ./... -timeout=15m |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,8 @@ import ( | |
"errors" | ||
"fmt" | ||
"io" | ||
mRand "math/rand" | ||
mRandV1 "math/rand" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we not convert everything to v2? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortuantely no until we can use Go v1.23 which creates an API to do that exactly. |
||
mRand "math/rand/v2" | ||
"reflect" | ||
"runtime" | ||
"sort" | ||
|
@@ -688,8 +689,6 @@ func benchmarkCommitNLeaves(b *testing.B, n int) { | |
} | ||
|
||
func BenchmarkModifyLeaves(b *testing.B) { | ||
mRand.Seed(time.Now().UnixNano()) // skipcq: GO-S1033 | ||
|
||
n := 200000 | ||
toEdit := 10000 | ||
val := []byte{0} | ||
|
@@ -714,8 +713,7 @@ func BenchmarkModifyLeaves(b *testing.B) { | |
for i := 0; i < b.N; i++ { | ||
binary.BigEndian.PutUint32(val, uint32(i)) | ||
for j := 0; j < toEdit; j++ { | ||
// skipcq: GSC-G404 | ||
k := keys[mRand.Intn(n)] | ||
k := keys[mRand.IntN(n)] | ||
if err := root.Insert(k, val, nil); err != nil { | ||
b.Error(err) | ||
} | ||
|
@@ -1454,8 +1452,8 @@ func TestBatchMigratedKeyValues(t *testing.T) { | |
for i := 0; i < iterations; i++ { | ||
runtime.GC() | ||
|
||
// ***Insert the key pairs 'naively' *** | ||
rand := mRand.New(mRand.NewSource(42)) //skipcq: GSC-G404 | ||
// Insert the key pairs 'naively' | ||
rand := mRandV1.New(mRandV1.NewSource(42)) | ||
tree := genRandomTree(rand, treeInitialKeyValCount) | ||
randomKeyValues := genRandomKeyValues(rand, migrationKeyValueCount) | ||
|
||
|
@@ -1471,8 +1469,8 @@ func TestBatchMigratedKeyValues(t *testing.T) { | |
} | ||
unbatchedDuration += time.Since(now) | ||
|
||
// ***Insert the key pairs with optimized strategy & methods*** | ||
rand = mRand.New(mRand.NewSource(42)) //skipcq: GSC-G404 | ||
// Insert the key pairs with optimized strategy & methods | ||
rand = mRandV1.New(mRandV1.NewSource(42)) | ||
tree = genRandomTree(rand, treeInitialKeyValCount) | ||
randomKeyValues = genRandomKeyValues(rand, migrationKeyValueCount) | ||
|
||
|
@@ -1528,7 +1526,7 @@ func TestBatchMigratedKeyValues(t *testing.T) { | |
} | ||
} | ||
|
||
func genRandomTree(rand *mRand.Rand, keyValueCount int) VerkleNode { | ||
func genRandomTree(rand *mRandV1.Rand, keyValueCount int) VerkleNode { | ||
tree := New() | ||
for _, kv := range genRandomKeyValues(rand, keyValueCount) { | ||
if err := tree.Insert(kv.key, kv.value, nil); err != nil { | ||
|
@@ -1543,7 +1541,7 @@ type keyValue struct { | |
value []byte | ||
} | ||
|
||
func genRandomKeyValues(rand *mRand.Rand, count int) []keyValue { | ||
func genRandomKeyValues(rand *mRandV1.Rand, count int) []keyValue { | ||
ret := make([]keyValue, count) | ||
for i := 0; i < count; i++ { | ||
keyval := make([]byte, 64) | ||
|
@@ -1564,7 +1562,7 @@ func BenchmarkBatchLeavesInsert(b *testing.B) { | |
b.ResetTimer() | ||
for i := 0; i < b.N; i++ { | ||
b.StopTimer() | ||
rand := mRand.New(mRand.NewSource(42)) //skipcq: GSC-G404 | ||
rand := mRandV1.New(mRandV1.NewSource(42)) //skipcq: GSC-G404 | ||
tree := genRandomTree(rand, treeInitialKeyValCount) | ||
randomKeyValues := genRandomKeyValues(rand, migrationKeyValueCount) | ||
b.StartTimer() | ||
|
@@ -1724,7 +1722,7 @@ const ( | |
|
||
// Generate implements the quick.Generator interface from testing/quick | ||
// to generate random test cases. | ||
func (randTest) Generate(r *mRand.Rand, size int) reflect.Value { | ||
func (randTest) Generate(r *mRandV1.Rand, size int) reflect.Value { | ||
var finishedFn = func() bool { | ||
if size == 0 { | ||
return true | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Targeting the same version as the minimum required today in go-ethereum.