Skip to content

Commit

Permalink
Add CI workflows and scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
muXxer committed Oct 25, 2023
1 parent 939c129 commit 7c4b605
Show file tree
Hide file tree
Showing 11 changed files with 485 additions and 4 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build evil-tools

on:
pull_request:
paths-ignore:
- 'scripts/**'

jobs:
build:
name: Build evil-tools
runs-on: self-hosted
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
id: go

- name: Print Go version
run: go version

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Build evil-tools
run: go build -v .
42 changes: 42 additions & 0 deletions .github/workflows/codeql_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

name: "CodeQL"

on:
# Run this security check every day at 03:00 to find potential new vulnerabilities in the develop branch
schedule:
- cron: "0 3 * * *"

jobs:
analyze:
name: Analyze
runs-on: self-hosted
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: develop

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: security-and-quality

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

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
23 changes: 23 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: GolangCIlint

on:
pull_request:
paths-ignore:
- 'scripts/**'

jobs:
golangci-lint:
name: GolangCI-Lint
runs-on: self-hosted
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
golangci_lint_flags: "--timeout=10m"
reporter: github-pr-check
filter_mode: nofilter
fail_on_error: true
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Binaries for programs and plugins
evil-tools
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# IDE related files
.vscode/
.idea/
go.work
go.work.sum

# OSX related files
.DS_Store
139 changes: 139 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
run:
tests: true
skip-dirs:
- scripts
skip-files:
- ".*_test.go$"
- "testframework.go"

linters-settings:
gofmt:
simplify: true
goimports:
local-prefixes: github.com/iotaledger
gocyclo:
min-complexity: 15
govet:
check-shadowing: false
misspell:
locale: US
staticcheck:
checks: ["all"]
nlreturn:
block-size: 2
stylecheck:
initialisms: ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS"]
depguard:
rules:
main:
deny:
- pkg: "errors"
desc: Should be replaced with "github.com/iotaledger/hive.go/ierrors" package
- pkg: "golang.org/x/xerrors"
desc: Should be replaced with "github.com/iotaledger/hive.go/ierrors" package
- pkg: "github.com/pkg/errors"
desc: Should be replaced with "github.com/iotaledger/hive.go/ierrors" package

linters:
# Disable all linters.
disable-all: true
# Enable specific linter
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
- asasalint
- asciicheck
- bidichk
- bodyclose
#- containedctx
- contextcheck
- decorder
- depguard
- dogsled
#- dupl
- durationcheck
- errchkjson
- errname
#- errorlint
- execinquery
#- exhaustive
#- exhaustruct
- exportloopref
- forcetypeassert
- goconst
#- gocritic
- godot
#- godox
#- goerr113
- gofmt
- goheader
- goimports
#- gomnd
#- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- grouper
- importas
#- interfacer
#- makezero
#- maligned
- misspell
#- nakedret
- nilerr
- nilnil
- nlreturn
- noctx
#- nonamedreturns
#- nosnakecase
#- nosprintfhostport
- prealloc
- predeclared
- promlinter
- revive
#- scopelint
- sqlclosecheck
- stylecheck
- tagliatelle
- tenv
#- testpackage
#- thelper
- tparallel
- unconvert
- unparam
- usestdlibvars
#- varnamelen

issues:
# Maximum issues count per one linter.
# Set to 0 to disable.
# Default: 50
max-issues-per-linter: 0
# Maximum count of issues with the same text.
# Set to 0 to disable.
# Default: 3
max-same-issues: 0
#exclude:
# - 'Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked' # errcheck
# - "err113: do not define dynamic errors, use wrapped static errors instead:" # goerr113
# - "type name will be used as [0-9A-Za-z_.]+ by other packages, and that stutters; consider calling this" # golint
# - "Potential file inclusion via variable" # gosec
# - "G404: Use of weak random number generator" # gosec
# - "Subprocess launch(ed with variable|ing should be audited)" # gosec
# - "Use of unsafe calls should be audited" # gosec
# - "G108: Profiling endpoint is automatically exposed on /debug/pprof" # gosec
# - "(Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)" # gosec
# - "G101: Potential hardcoded credentials" # gosec
# - "(G104|G307)" # gosec Duplicated errcheck checks.
# - "`[0-9A-Za-z_.]+` - `[0-9A-Za-z_.]+` always receives `[0-9A-Za-z_.]+`" # unparam
# - "should have comment .*or be unexported" # revive
# - "exported: comment on exported" # revive
# - "package-comments: package comment should be of the form" # revive
# - "blank-imports" # revive
# - "var-naming: don't use leading k in Go names;" #revive
# - 'shadow: declaration of "err"' # govet
Loading

0 comments on commit 7c4b605

Please sign in to comment.