Skip to content
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: configure additional CI jobs & bring linter settings in compliance with OSS template #279

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[codespell]
skip = *.pulsar.go,*.pb.go,*.pb.gw.go,*.bin,*.sum,*.mod,*.git,*.json
ignore-words-list = usera,pres,crate
quiet-level = 3
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
# check dependencies in go.mod
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
# checks dependencies in github workflows
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
15 changes: 15 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This mergify configuration is used for backporting only. This setup
# will backport a PR after being approved if it has the label 'backport'.
# Please see the comments below for configuring branches, labels, etc.
#
pull_request_rules:
- name: backport to maintained branches
conditions:
- label=backport # create a label in your project called backport
actions:
backport:
branches: # the list of branches the pull request should be copied to.
- main
assignees: # assign newly created backport PR to author
- "{{ author }}"
title: "`[BP: {{ destination_branch }} <- #{{ number }}]` {{ title }}"
61 changes: 61 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '59 23 * * 5'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages.
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ✏️ If the Autobuild fails above, remove it and uncomment the following lines
# and modify them (or add more) to build your code.

#- run: |
# make install

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
27 changes: 20 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: golangci-lint
# Lint the entire golang project. This workflow relies on the
# '.golangci.yml' file for its configuration settings.
name: Lint
on:
push:
tags:
Expand All @@ -7,15 +9,26 @@ on:
- master
- main
pull_request:

permissions:
contents: read

env:
GO_VERSION: 1.23

jobs:
golangci:
name: lint
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- uses: actions/checkout@v4

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6.1.1
with:
version: latest
only-new-issues: true
args: --timeout=3m
version: v1.61.0
args: --timeout 15m
11 changes: 11 additions & 0 deletions .github/workflows/markdown-link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Markdown Link Check

on:
pull_request:

jobs:
link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gaurav-nelson/[email protected]
24 changes: 24 additions & 0 deletions .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Spell Check

on:
pull_request:

jobs:
spellcheck:
name: Run codespell
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install codespell
run: pip install codespell

- name: Run codespell
run: codespell
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
runs-on: ubuntu-latest
steps:
# Install and setup go
- name: Set up Go 1.21
- name: Set up Go 1.23
uses: actions/setup-go@v4
with:
go-version: '^1.21.4'
go-version: '^1.23'

# checkout horcrux
- name: checkout horcrux
Expand All @@ -47,10 +47,10 @@ jobs:
- TestHorcruxProxyGRPC
steps:
# Install and setup go
- name: Set up Go 1.21
- name: Set up Go 1.23
uses: actions/setup-go@v4
with:
go-version: '^1.21.4'
go-version: '^1.23'

# checkout horcrux
- name: checkout horcrux
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/title-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Lint PR Title"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: read

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
142 changes: 53 additions & 89 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,106 +1,70 @@
run:
timeout: 10m
tests: true

# These linter checks can be modified on a per project basis.
# Simply remove them from the enable list to disable them.
linters:
disable-all: true
enable:
- asciicheck
- bidichk
- bodyclose
- dogsled
- copyloopvar
- decorder
- dupl
- dupword
- errcheck
- errchkjson
- errname
- exhaustive
# - forbidigo disabled because there are many places in cmd where passing in a logger would require non-trivial refactor
- gci
- goconst
- gocritic
- gofmt
- goimports
- godot
- gofumpt
- gosec
- gosimple
- gosmopolitan
- govet
- importas
- grouper
- ineffassign
- lll
- loggercheck
- misspell
- nakedret
- prealloc
- revive
- nilerr
- nilnil
- noctx
- staticcheck
- stylecheck
- testifylint
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- nolintlint
- usestdlibvars
- wastedassign
- whitespace

linters-settings:
dogsled:
max-blank-identifiers: 3
importas:
no-extra-aliases: true
alias:
- pkg: github.com/cosmos/cosmos-sdk/crypto/codec
alias: cryptocodec
- pkg: github.com/cosmos/cosmos-sdk/crypto/types
alias: cryptotypes
- pkg: github.com/cosmos/cosmos-sdk/x/slashing/types
alias: slashingtypes
- pkg: github.com/cometbft/cometbft/types
alias: comet
- pkg: github.com/cometbft/cometbft/config
alias: cometconfig
- pkg: github.com/cometbft/cometbft/crypto
alias: cometcrypto
- pkg: github.com/cometbft/cometbft/crypto/ed25519
alias: cometcryptoed25519
- pkg: github.com/cometbft/cometbft/crypto/encoding
alias: cometcryptoencoding
- pkg: github.com/tendermint/go-amino
alias: amino
- pkg: github.com/cometbft/cometbft/libs/bytes
alias: cometbytes
- pkg: github.com/cometbft/cometbft/libs/json
alias: cometjson
- pkg: github.com/cometbft/cometbft/libs/log
alias: cometlog
- pkg: github.com/cometbft/cometbft/libs/net
alias: cometnet
- pkg: github.com/cometbft/cometbft/libs/os
alias: cometos
- pkg: github.com/cometbft/cometbft/libs/rand
alias: cometrand
- pkg: github.com/cometbft/cometbft/libs/service
alias: cometservice
- pkg: github.com/cometbft/cometbft/p2p/conn
alias: cometp2pconn
- pkg: github.com/cometbft/cometbft/privval
alias: cometprivval
- pkg: github.com/cometbft/cometbft/proto/tendermint/types
alias: cometproto
- pkg: github.com/cometbft/cometbft/proto/tendermint/crypto
alias: cometprotocrypto
- pkg: github.com/cometbft/cometbft/proto/tendermint/privval
alias: cometprotoprivval
- pkg: github.com/cometbft/cometbft/rpc/client
alias: cometrpcclient
- pkg: github.com/cometbft/cometbft/rpc/client/http
alias: cometrpchttp
- pkg: github.com/cometbft/cometbft/rpc/jsonrpc/client
alias: cometrpcjsonclient
- pkg: github.com/cometbft/cometbft/rpc/jsonrpc/types
alias: cometrpcjsontypes
- pkg: github.com/cometbft/cometbft/rpc/core/types
alias: cometrpctypes
- pkg: github.com/ecies/go/v2
alias: ecies
- pkg: github.com/grpc-ecosystem/go-grpc-middleware/retry
alias: grpcretry
- pkg : github.com/kraken-hpc/go-fork
alias: fork
- pkg: github.com/armon/go-metrics/prometheus
alias: gmprometheus
- pkg: github.com/mitchellh/go-homedir
alias: homedir
- pkg: gitlab.com/unit410/threshold-ed25519/pkg
alias: tsed25519
- pkg: github.com/Jille/raft-grpc-transport
alias: raftgrpctransport
- pkg: github.com/hashicorp/raft-boltdb/v2
alias: boltdb
- pkg: math/rand
alias: mrand
maligned:
suggest-new: true
govet:
misspell:
locale: US
gci:
custom-order: true
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- blank # blank imports
- dot # dot imports
- prefix(cosmossdk.io)
- prefix(github.com/cosmos)
- prefix(github.com/cosmos/cosmos-sdk)
- prefix(github.com/cometbft/cometbft)
- prefix(github.com/strangelove-ventures/horcrux)
gosec:
excludes:
- G404 # disables checks on insecure random number source
- G115 # disables checks on type conversions between signed and unsigned integers

issues:
max-issues-per-linter: 0
Loading
Loading