Skip to content

Commit

Permalink
Merge pull request #2 from drand/new/wip
Browse files Browse the repository at this point in the history
Migration from the drand v1.5 codebase to its own repo
  • Loading branch information
AnomalRoil authored Jul 24, 2024
2 parents d80335a + 8e4c811 commit 59b065a
Show file tree
Hide file tree
Showing 62 changed files with 9,251 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint

on:
pull_request:
branches: [ main ]

concurrency:
group: ci-${{ github.ref }}-lint
cancel-in-progress: true

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Checkout
uses: actions/checkout@v4

- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.58
args: --timeout 5m
30 changes: 30 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Build/Tests"
on:
push:
branches:
- master
- main
pull_request:

concurrency:
group: ci-${{ github.ref }}-tests
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
continue-on-error: true
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Unit tests
env:
DRAND_TEST_LOGS: "${{ runner.debug == '1' && 'DEBUG' || 'INFO' }}"
CI: "true"
run: go test -v ./...
198 changes: 198 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
issues:
# Let us display all issues of one type at once
max-same-issues: 0
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- bodyclose
- cyclop
- errcheck
- forbidigo
- goconst
- gocyclo
- mnd
- gosec
- nilnil
- noctx
- revive
- depguard
- lll # signatures are long lines
- path: _test\.go
text: "SA1019" # we still want to test deprecated functions
- path: cmd
linters:
- forbidigo # we use Println in our UX
- path: internal/lib
linters:
- forbidigo # we use Println in our UX
- path: internal/drand-cli
linters:
- forbidigo # we use Println in our UX
- goconst # we re-use some strings in our flags
- path: client/http
text: "unexported-return"
run:
skip-dirs:
- demo
- test

linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
#- containedctx #TODO could be enabled
#- contextcheck #TODO could be enabled
#- cyclop
#- deadcode # Deprecated
- decorder
# - depguard
- dogsled
- dupl
- dupword
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
# - execinquery # deprecated
- exhaustive
# - exhaustivestruct
# - exhaustruct
- exportloopref
# - forbidigo
# - forcetypeassert #TODO could be enabled
- funlen
# - gci
# - gochecknoglobals
- gochecknoinits
# - gocognit
- goconst
- gocritic
- gocyclo
# - godot
# - godox #TODO could be enabled
# - goerr113
- gofmt
# - gofumpt
- goheader
- goimports
# - golint # Deprecated
# - gomnd # deprecated, replaced by mnd
# - gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- grouper
# - ifshort
- importas
- ineffassign
- interfacebloat
# - interfacer # Deprecated
# - ireturn
- lll
- loggercheck
- maintidx
- makezero
# - maligned #Deprecated
#- mnd
- misspell
- nakedret
# - nestif
- nilerr
- nilnil
# - nlreturn
- noctx
- nolintlint
# - nonamedreturns
# - nosnakecase
- nosprintfhostport
# - paralleltest #TODO could be enabled
- prealloc
- predeclared
# - promlinter #TODO could be enabled
- reassign
- revive
- rowserrcheck
# - scopelint # Deprecated
- sqlclosecheck
- staticcheck
# - structcheck # Deprecated
- stylecheck
# - tagliatelle
- tenv
- testableexamples
# - testpackage
# - thelper #TODO could be enabled
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
# - varcheck # Deprecated
# - varnamelen
- wastedassign
- whitespace
# - wrapcheck
# - wsl

linters-settings:
dupl:
threshold: 100
exhaustive:
default-signifies-exhaustive: false
funlen:
lines: 100
statements: 50
goconst:
min-len: 3
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
gocyclo:
min-complexity: 15
goimports:
local-prefixes: github.com/drand
golint:
min-confidence: 0
mnd:
# don't include the "operation" and "assign"
checks:
- argument
- case
- condition
- return
lll:
line-length: 140
# maligned: # Deprecated
# suggest-new: true
# govet:
# check-shadowing: true #TODO could be enabled
# enable:
# - fieldalignment #TODO could be enabled
revive:
enable:
- var-naming
misspell:
locale: US
nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
drand-relay-gossip:
go build -o drand-relay-gossip ./gossip-relay/main.go
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
## New Project
## drand-cli is a set of useful binaries for the drand ecosystem

This repo contains most notably:
- a client CLI tool to fetch and verify drand beacons from the various available sources
- a gossipsub relay to relay drand beacons on gossipsub
- Go APIs to connect to drand networks through http or gossipsub relays.



---
Expand Down
Loading

0 comments on commit 59b065a

Please sign in to comment.