Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from consensys-vertical-apps/feat/add-pipeline
Browse files Browse the repository at this point in the history
feat: add pipeline
  • Loading branch information
jasonyic authored Oct 7, 2023
2 parents 48b8d90 + 022d486 commit 5e8b28c
Show file tree
Hide file tree
Showing 10 changed files with 257 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
nodes.json
enrtree-info.json
all.json
Dockerfile
CHANGELOG.md
README.md

.git
.github
1 change: 1 addition & 0 deletions .github/workflows/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @jasonyic
80 changes: 80 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: release

permissions:
id-token: write
contents: write
issues: write
pull-requests: write

on:
push:
branches:
- "main"
- "release-**"

env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}

jobs:
release:
name: release
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- name: Semantic Release Version
id: semantic
uses: cycjimmy/semantic-release-action@v3
with:
extra_plugins: |
@semantic-release/changelog@6.0.2
@semantic-release/git@10.0.1
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}

- name: Build discv4-crawl
if: steps.semantic.outputs.new_release_version != ''
run: make build
env:
VERSION: ${{ steps.semantic.outputs.new_release_version }}

- name: Set up Docker Buildx
if: steps.semantic.outputs.new_release_version != ''
uses: docker/setup-buildx-action@v2

- name: Set up QEMU
if: steps.semantic.outputs.new_release_version != ''
uses: docker/setup-qemu-action@v2

- name: Login to Docker Registry
if: steps.semantic.outputs.new_release_version != ''
uses: docker/login-action@v1
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build & Publish image
if: steps.semantic.outputs.new_release_version != ''
uses: docker/build-push-action@v3
with:
context: .
tags: ${{env.DOCKER_REGISTRY}}/staking/discv4-crawl:${{ steps.semantic.outputs.new_release_version }}
push: true
platforms: linux/amd64,linux/arm64
cache-from: type=gha
#cache-to: type=gha,mode=max

- name: Semantic Release
if: steps.semantic.outputs.new_release_version != ''
uses: cycjimmy/semantic-release-action@v3
with:
extra_plugins: |
@semantic-release/changelog@6.0.2
@semantic-release/git@10.0.1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: reviewdog

on:
push:
branches:
- main
- beta
pull_request:
types:
- opened
- synchronize
- reopened
- labeled

jobs:
hadolint:
name: hadolint
runs-on: ubuntu-latest

if: github.actor != 'dependabot[bot]' || contains(github.event.pull_request.labels.*.name, 'safe-to-test')
steps:
- uses: actions/checkout@v3

- name: hadolint
uses: reviewdog/action-hadolint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-check
fail_on_error: true
73 changes: 73 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
linters-settings:
govet:
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
revive:
min-confidence: 0
gocyclo:
min-complexity: 10
maligned:
suggest-new: true
dupl:
threshold: 100
goconst:
min-len: 5
min-occurrences: 2
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
misspell:
locale: US
lll:
line-length: 140
gocritic:
enabled-tags:
- performance
- style
- experimental
disabled-checks:
- wrapperFunc
- hugeParam

linters:
enable:
- goconst
- gocritic
- revive
- govet
- misspell
- stylecheck
- unconvert
- unparam
- gofmt
disable:
- gochecknoinits

issues:
max-same-issues: 10
exclude-use-default: true

run:
deadline: 20m
skip-dirs:
- .gocache
- pkg/go-ethereum
- build
- public
- mock
- scripts
- vendor
- tests
skip-files:
- ".*\\.pb(\\.gw)?\\.go$"
- ".*_test.go$"
- pkg/toolkit/app/http/handler/dashboard/genstatic/gen.go
- pkg/toolkit/app/http/handler/swagger/genstatic/gen.go
14 changes: 14 additions & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ignored:
- DL3018
- DL3025
- DL3008
- DL4006
- DL3003
- DL3015
- SC2086
- SC1091
- DL4001
- SC2046

trustedRegistries:
- docker.io
14 changes: 14 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
branches:
- main
- name: beta-*
prerelease: true
- name: alpha-*
prerelease: true
plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/changelog"
- - "@semantic-release/github"
- assets:
- "build/discv4-crawl"
- "@semantic-release/git"
3 changes: 3 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
golang 1.20.7
golangci-lint 1.52.2
ginkgo 2.1.3
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:latest
FROM golang:1.21

ENV CRAWL_GIT_REPO=https://github.com/skylenet/discv4-dns-lists.git \
CRAWL_GIT_BRANCH=master \
Expand All @@ -25,7 +25,9 @@ ENV CRAWL_GIT_REPO=https://github.com/skylenet/discv4-dns-lists.git \
PROMETHEUS_METRICS_ENABLED=true \
PROMETHEUS_METRICS_LISTEN=0.0.0.0:9100

RUN apt-get update && apt-get install -y --no-install-recommends git curl jq
RUN apt-get update \
&& apt-get install -y --no-install-recommends git curl jq \
&& rm -rf /var/lib/apt/lists/*

EXPOSE 9100
WORKDIR /crawler
Expand Down
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.ONESHELL:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules


lint:
golangci-lint run

lint-fix:
golangci-lint run --fix

.PHONY: vendor
vendor:
go mod tidy
go mod vendor
go mod download

build-dirs:
@mkdir -p build

asdf-bootstrap:
asdf plugin update --all
asdf plugin-add golang https://github.com/kennyp/asdf-golang.git || true
asdf plugin-add golangci-lint https://github.com/hypnoglow/asdf-golangci-lint.git || true
asdf plugin-add ginkgo https://github.com/jimmidyson/asdf-ginkgo.git || true
NODEJS_CHECK_SIGNATURES=no asdf install

.PHONY: docker
docker:
# for multiple platform: --platform linux/amd64,linux/arm64
docker buildx build -t staking/discv4-crawl . --load

0 comments on commit 5e8b28c

Please sign in to comment.