diff --git a/.github/workflows/api-diff.yml b/.github/workflows/api-diff.yml new file mode 100644 index 0000000000..09fca0949f --- /dev/null +++ b/.github/workflows/api-diff.yml @@ -0,0 +1,34 @@ +name: Analyze API Changes +description: Runs apidiff-go action to check for breaking changes to modules' public APIs + +on: + pull_request: + +jobs: + root-module: + name: Root Module + permissions: + pull-requests: write + contents: read + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + cache: false + + - uses: smartcontractkit/.github/actions/changed-modules-go@feat/changed-modules-go + id: changed-modules + + - uses: smartcontractkit/.github/actions/apidiff-go@apidiff-go/0.1.0 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + go-mod-paths: "${{ steps.changed-modules.outputs.modified-modules }}" + enforce-compatible: "false" # dont fail on breaking changes diff --git a/pkg/monitoring/monitor.go b/pkg/monitoring/monitor.go index dd158a0264..761cf271a0 100644 --- a/pkg/monitoring/monitor.go +++ b/pkg/monitoring/monitor.go @@ -42,6 +42,8 @@ type Monitor struct { Manager Manager HTTPServer HTTPServer + + NewParam uint64 } // NewMonitor builds a new Monitor instance using dependency injection. @@ -56,6 +58,7 @@ func NewMonitor( txResultsSourceFactory SourceFactory, feedsParser FeedsParser, nodesParser NodesParser, + newParam uint64, ) (*Monitor, error) { cfg, err := config.Parse() if err != nil { @@ -147,6 +150,7 @@ func NewMonitor( RDDPoller: rddPoller, Manager: manager, HTTPServer: httpServer, + NewParam: newParam, }, nil } diff --git a/pkg/utils/mailbox/mailbox.go b/pkg/utils/mailbox/mailbox.go index 6b84eb5246..08aba8a89d 100644 --- a/pkg/utils/mailbox/mailbox.go +++ b/pkg/utils/mailbox/mailbox.go @@ -31,9 +31,12 @@ func NewHighCapacity[T any]() *Mailbox[T] { // NewSingle returns a new Mailbox with capacity one. func NewSingle[T any]() *Mailbox[T] { return New[T](1) } +// NewSingleDuplicate copies the above function to demonstrate API analysis +func NewSingleDuplicate[T any]() *Mailbox[T] { return New[T](1) } + // New creates a new mailbox instance. If name is non-empty, it must be unique and calling Start will launch // prometheus metric monitor that periodically reports mailbox load until Close() is called. -func New[T any](capacity uint64) *Mailbox[T] { +func New[T any](capacity uint32) *Mailbox[T] { queueCap := capacity if queueCap == 0 { queueCap = 100 @@ -41,7 +44,7 @@ func New[T any](capacity uint64) *Mailbox[T] { return &Mailbox[T]{ chNotify: make(chan struct{}, 1), queue: make([]T, 0, queueCap), - capacity: capacity, + capacity: uint64(capacity), } }