Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.git/
.github/
.idea/
.vscode/
*.db
*.db-journal
*.db-wal
coverage.out
dist/
web/node_modules/
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.go]
indent_style = tab

[*.{yaml,yml,md,json}]
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab
4 changes: 3 additions & 1 deletion .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ jobs:
- name: Set up Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: '1.24'
go-version: '1.26'
- name: Set up pnpm
uses: pnpm/action-setup@v4
- uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
name: Set up Node
with:
Expand Down
78 changes: 37 additions & 41 deletions .github/workflows/vet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,31 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go_version: [ 1.24.x ]
go_version: [ 1.26.x ]
steps:
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: ${{ matrix.go_version }}
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: golangci-lint
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
# v8+ of the action is required for golangci-lint v2 (older action
# versions pass --out-format, which v2 removed)
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.64

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
version: v2.12.2
args: --timeout=5m

# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
golang-test:
runs-on: ubuntu-latest
strategy:
matrix:
go_version: [ 1.24.x ]
go_version: [ 1.26.x ]
steps:
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: ${{ matrix.go_version }}
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: run tests
run: go test -json ./... > test.json
- name: Annotate tests
Expand All @@ -71,17 +54,25 @@ jobs:
matrix:
node-version: [22.x]
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
with:
version: 10.30.1
run_install: false
- name: Set up NodeJS ${{ matrix.node-version }}
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: web/package-lock.json
cache: "pnpm"
cache-dependency-path: web/pnpm-lock.yaml
- name: Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile
- name: Install Playwright browsers
# the Storybook test suite runs in a real Chromium via Vitest browser mode
run: pnpm exec playwright install --with-deps chromium
- name: Test
run: npm test
run: pnpm test
web-lint:
runs-on: ubuntu-latest
defaults:
Expand All @@ -91,23 +82,28 @@ jobs:
matrix:
node-version: [22.x]
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
with:
version: 10.30.1
run_install: false
- name: Set up NodeJS ${{ matrix.node-version }}
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: web/package-lock.json
cache: "pnpm"
cache-dependency-path: web/pnpm-lock.yaml
- name: Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile
- name: Lint
run: npm run lint
run: pnpm lint
- name: Save Report
run: npm run lint:report
run: pnpm lint:report
continue-on-error: true
- name: Annotate Results
uses: ataylorme/eslint-annotate-action@5f4dc2e3af8d3c21b727edb597e5503510b1dc9c # 2.2.0
if: "!github.event.pull_request.head.repo.fork"
if: "!github.event.pull_request.head.repo.fork"
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
report-json: "web/eslint_report.json"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
bin
/forky
.playwright-mcp/
coverage.out
config.yaml
config2.yaml
__debug_bin*
dist/
web/dist/
checkpointz
store.db
index.db
155 changes: 111 additions & 44 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,132 @@
linters-settings:
errcheck:
check-type-assertions: true
goconst:
min-len: 2
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
govet:
shadow: true
nolintlint:
require-explanation: true
require-specific: true
version: "2"

run:
timeout: 5m

linters:
disable-all: true
default: none
enable:
- asasalint
- bidichk
- bodyclose
- containedctx
- decorder
- dogsled
- durationcheck
- copyloopvar
- cyclop
- dupword
- errcheck
- errname
- copyloopvar
- errorlint
- exhaustive
- exptostd
- fatcontext
- funlen
- gocognit
- gocritic
- gocyclo
- gofmt
- goheader
- goimports
- gosec
- gosimple
- govet
- ineffassign
- intrange
- misspell
- nakedret
- nilerr
- modernize
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
- nosprintfhostport
- prealloc
- perfsprint
- predeclared
- promlinter
- reassign
- revive
- sloglint
- staticcheck
- stylecheck
- thelper
- tagliatelle
- testifylint
- tparallel
- typecheck
- unconvert
- usetesting
- unparam
- unused
- usestdlibvars
- wastedassign
- whitespace
- wsl

run:
issues-exit-code: 1
settings:
cyclop:
max-complexity: 30

funlen:
lines: 100
statements: 50

gocognit:
# Aligned with cyclop's max-complexity so the two complexity metrics agree.
min-complexity: 30

errcheck:
check-type-assertions: true

exhaustive:
# A `default` case counts as handling the remaining enum members. Avoids
# enumerating large generated enums (e.g. xatu.Event_Name) exhaustively.
default-signifies-exhaustive: true

tagliatelle:
case:
rules:
yaml: snake
json: snake

revive:
rules:
- name: unexported-return
disabled: true

govet:
enable-all: true
disable:
- fieldalignment
settings:
shadow:
# Non-strict: don't flag the idiomatic `if x, err := f(); err != nil`
# reuse of an outer err in nested scopes.
strict: false

nolintlint:
require-explanation: true
require-specific: true

sloglint:
no-global: all
context: scope

staticcheck:
checks:
- all

exclusions:
paths:
# ogen-generated server/client code.
- api/rest
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
# Test files are allowed to be long/complex (table-driven tests) and to
# have unused helper parameters.
- path: _test\.go
linters:
- funlen
- gocognit
- cyclop
- unparam

formatters:
enable:
- gofumpt
- goimports
settings:
goimports:
local-prefixes:
- github.com/ethpandaops/forky
exclusions:
paths:
# ogen-generated server/client code.
- api/rest
5 changes: 4 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ before:
- make build-web
builds:
- binary: forky-{{.Version}}
main: ./cmd/forky
tags:
- webui
goos:
- linux
- windows
Expand All @@ -24,7 +27,7 @@ builds:
ignore:
- goarch: 386
ldflags:
- -s -w -X github.com/ethpandaops/forky/pkg/version.Release={{.Tag}} -X github.com/ethpandaops/forky/pkg/version.GitCommit={{.ShortCommit}}
- -s -w -X github.com/ethpandaops/forky/internal/version.Release={{.Tag}} -X github.com/ethpandaops/forky/internal/version.GitCommit={{.ShortCommit}}
mod_timestamp: "{{ .CommitTimestamp }}"

checksum:
Expand Down
13 changes: 13 additions & 0 deletions .redocly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
extends:
- recommended

rules:
info-license: error
no-server-example.com: error
tag-description: error
operation-4xx-response: error
no-unused-components: error
operation-2xx-response: off
# Forky's API is unauthenticated (read-only fork-choice data). Re-enable once
# an auth scheme is added.
security-defined: off
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
golang 1.26.2
golangci-lint 2.12.2
Loading
Loading