Skip to content

Commit 815a91d

Browse files
Merge pull request #2 from threshold-network/release-ci-updates
ENG-469 release ci updates
2 parents f1008aa + d08bfa3 commit 815a91d

9 files changed

Lines changed: 130 additions & 26 deletions

File tree

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "gomod"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
open-pull-requests-limit: 5
10+
11+
- package-ecosystem: "github-actions"
12+
directory: "/"
13+
schedule:
14+
interval: "weekly"
15+
day: "monday"
16+
open-pull-requests-limit: 5

.github/workflows/client.yml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,64 @@ jobs:
1313
client-build-and-test:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717

1818
- name: Setup Go
19-
uses: actions/setup-go@v3
19+
uses: actions/setup-go@v4
2020
with:
21-
go-version: "1.18"
21+
go-version: "1.22"
22+
cache: true
2223

2324
- name: Run Go generators
2425
run: go generate ./.../gen
2526

27+
- name: Ensure generated code is clean
28+
run: git diff --exit-code
29+
30+
- name: Run Go vet
31+
run: go vet ./...
32+
2633
- name: Build Go
2734
run: go build ./...
2835

2936
- name: Install gotestsum
30-
run: go install gotest.tools/gotestsum@latest
37+
run: go install gotest.tools/gotestsum@v1.12.0
3138

3239
- name: Run Go tests
3340
run: gotestsum
3441

42+
- name: Install govulncheck
43+
run: go install golang.org/x/vuln/cmd/govulncheck@v1.1.1
44+
45+
- name: Run govulncheck
46+
run: govulncheck ./...
47+
continue-on-error: true
48+
3549
client-scan:
3650
if: github.event_name != 'schedule'
3751
runs-on: ubuntu-latest
3852
steps:
3953
- uses: actions/checkout@v3
40-
- uses: securego/gosec@master
54+
- uses: securego/gosec@v2.19.0
4155
with:
4256
args: ./...
4357

4458
client-lint:
4559
if: github.event_name != 'schedule'
4660
runs-on: ubuntu-latest
4761
steps:
48-
- uses: actions/checkout@v3
62+
- uses: actions/checkout@v4
63+
- name: Setup Go
64+
uses: actions/setup-go@v4
65+
with:
66+
go-version: "1.22"
67+
cache: true
68+
69+
- name: Run Go generators
70+
run: go generate ./.../gen
71+
72+
- name: Install golint
73+
run: go install golang.org/x/lint/golint@latest
4974

50-
- name: Lint Go
51-
uses: keep-network/golint-action@v1.0.2
75+
- name: Run golint
76+
run: golint ./...

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
The format is based on Keep a Changelog and this fork follows Semantic Versioning for tagged releases.
5+
6+
## Unreleased
7+
### Added
8+
- Release guide and initial changelog stub for the fork of `keep-core/keep-common`.
9+
10+
## Upstream Baseline - v1.7.0
11+
### Notes
12+
- Latest upstream tag from https://github.com/keep-network/keep-common (tracked via git tags); upstream is unmaintained, so this fork continues independently from that point.
13+
### Added
14+
- Inherited upstream history through v1.7.0 as the starting point for forked releases.

README.adoc

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,30 @@ https://docs.threshold.network[image:https://img.shields.io/badge/docs-website-g
55
https://discord.gg/threshold[image:https://img.shields.io/badge/chat-Discord-5865f2.svg[Chat with us on Discord]]
66

77
Common libraries and tools used across Keep repositories. This repository is a
8-
fork of https://github.com/keep-core/keep-common[`keep-core/keep-common`].
8+
fork of https://github.com/keep-core/keep-common[`keep-core/keep-common`],
9+
continuing independently from the upstream `v1.7.0` tag.
10+
11+
See link:RELEASE.md[Release guide] and link:CHANGELOG.md[Changelog] for versioning,
12+
tagging, and history.
13+
14+
== Getting started
15+
16+
```
17+
go mod tidy
18+
go generate ./.../gen
19+
go test ./...
20+
```
21+
22+
== Toolchain & CI
23+
24+
- Go: 1.22 (CI uses `actions/setup-go@v4` with module cache).
25+
- Checks: `go generate` (enforced clean), `go vet`, `go build`, `go test` via `gotestsum`.
26+
- Security: `govulncheck` (informational), `gosec` pinned version.
27+
- Lint: `golint` installed via `go install`.
28+
29+
== Releases
30+
31+
See link:RELEASE.md[Release guide] for versioning, tagging, and publishing steps.
932

1033
== Directory structure
1134

@@ -43,7 +66,12 @@ keep-common/
4366
== Installation
4467

4568
* Clone this repo
46-
* Install go v1.18: `$ brew install go@1.18`
69+
* Install Go v1.22
4770
* Generate go files: `$ go generate ./.../gen`
4871
* Build the project: `$ go build ./...`
4972
* Run tests: `$ go test ./...`
73+
74+
== Contributing
75+
76+
See link:CONTRIBUTING.adoc[Contribution Guide] for forking, signing, and PR
77+
expectations; keep tests green and generators clean before review.

RELEASE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Release Guide
2+
3+
Process for publishing tagged Go module releases for this fork of `keep-common`.
4+
5+
## Versioning
6+
1) Use SemVer tags on `main`: `vX.Y.Z` when matching upstream versions; append `-tlabs.N` for fork-only releases (increment `N` for subsequent fork tags at the same base version).
7+
2) Latest known upstream tag is `v1.7.0` from https://github.com/keep-network/keep-common (tracked via git tags). Upstream is unmaintained, so future releases proceed independently on this fork.
8+
9+
## Pre-release Checklist
10+
1) Sync with upstream: pull the latest upstream tag/commit, resolve conflicts, and ensure CI is green.
11+
2) Generators: `go generate ./.../gen`; verify the worktree is clean afterward.
12+
3) Module sanity: `go mod tidy` (expect no diff) and `go list ./...` to confirm dependencies and packages resolve.
13+
4) Quality gates: `go vet ./...` and `go test ./...`; add `go test -race ./...` for concurrency-heavy changes.
14+
5) Changelog: update `CHANGELOG.md` with Added/Changed/Fixed/Breaking notes and mention the upstream commit/tag you synced.
15+
16+
## Tagging & Publishing
17+
1) Tag: `git tag -a vX.Y.Z -m "Release vX.Y.Z"` (or `vX.Y.Z-tlabs.N` for fork-specific releases).
18+
2) Push tag: `git push origin vX.Y.Z[-tlabs.N]`.
19+
3) Create a GitHub release from the tag with the changelog excerpt and a note about the upstream baseline.

pkg/chain/ethereum/ethutil/rate_limiter_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,10 @@ func TestRateLimiter_RequestsPerSecondLimitOnly(t *testing.T) {
153153
duration := time.Now().Sub(startTime)
154154
averageRequestsPerSecond := float64(requests) / duration.Seconds()
155155

156-
// The actual average can exceed the limit a little bit.
157-
// Here we set the maximum acceptable deviation to 5%.
158-
maxDeviation := 0.05
156+
// The actual average can exceed the limit a little bit because of
157+
// scheduling jitter and coarse timer resolution. Allow a slightly
158+
// wider deviation to avoid flakes on busy runners.
159+
maxDeviation := 0.15
159160

160161
if averageRequestsPerSecond > (1+maxDeviation)*float64(requestsPerSecondLimit) {
161162
t.Errorf(

pkg/clientinfo/observer_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ func TestObserve(t *testing.T) {
1111
return 5000
1212
}
1313
gauge := &Gauge{}
14-
ctx, _ := context.WithTimeout(context.Background(), 5*time.Millisecond)
14+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Millisecond)
15+
defer cancel()
1516

1617
observer := &MetricObserver{input, gauge}
1718

tools/generators/promise/promise.go.tmpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{/* This is a template for Promises */ -}}
2-
// This is auto generated code
2+
// Package async contains promise implementations generated for specific types.
3+
// This is auto generated code.
34
package async
45

56
import (
@@ -11,11 +12,10 @@ import (
1112
{{- end }}
1213
)
1314

14-
// Promise represents an eventual completion of an ansynchronous operation
15-
// and its resulting value. Promise can be either fulfilled or failed and
16-
// it can happen only one time. All Promise operations are thread-safe.
17-
//
18-
// To create a promise use: `&{{ .Prefix }}Promise{}`
15+
// {{ .Prefix }}Promise represents an eventual completion of an ansynchronous
16+
// operation and its resulting value. Promise can be either fulfilled or
17+
// failed and it can happen only one time. All Promise operations are
18+
// thread-safe. To create a promise use: `&{{ .Prefix }}Promise{}`
1919
type {{ .Prefix }}Promise struct {
2020
mutex sync.Mutex
2121
successFn func({{ .Type }})

tools/generators/promise/promise_template_content.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ package main
22

33
// promiseTemplateContent contains the template string from promise.go.tmpl
44
var promiseTemplateContent = `{{/* This is a template for Promises */ -}}
5-
// This is auto generated code
5+
// Package async contains promise implementations generated for specific types.
6+
// This is auto generated code.
67
package async
78
89
import (
@@ -14,11 +15,10 @@ import (
1415
{{- end }}
1516
)
1617
17-
// Promise represents an eventual completion of an ansynchronous operation
18-
// and its resulting value. Promise can be either fulfilled or failed and
19-
// it can happen only one time. All Promise operations are thread-safe.
20-
//
21-
// To create a promise use: ` + "`" + `&{{ .Prefix }}Promise{}` + "`" + `
18+
// {{ .Prefix }}Promise represents an eventual completion of an ansynchronous
19+
// operation and its resulting value. Promise can be either fulfilled or
20+
// failed and it can happen only one time. All Promise operations are
21+
// thread-safe. To create a promise use: ` + "`" + `&{{ .Prefix }}Promise{}` + "`" + `
2222
type {{ .Prefix }}Promise struct {
2323
mutex sync.Mutex
2424
successFn func({{ .Type }})

0 commit comments

Comments
 (0)