Skip to content

Commit

Permalink
update github workflows, linters, configs, docs and readme
Browse files Browse the repository at this point in the history
Signed-off-by: Pranay Valson <[email protected]>
  • Loading branch information
noslav committed Jan 14, 2025
1 parent f536e11 commit e4b4adb
Show file tree
Hide file tree
Showing 21 changed files with 966 additions and 22 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: build-test

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
- "develop"

jobs:
audit:
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22.5

- name: Checkout code
uses: actions/checkout@v2

- name: Verify dependencies
run: go mod verify

- name: Build all
run: make all

- name: Run tests
run: make test

- name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}

- name: Clean
run: make clean
46 changes: 46 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: docker-image-ci

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
- "develop"

jobs:
push-image:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Login to GitHub Container Registry
if: ${{ !env.ACT }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_PAT }}

- uses: actions/checkout@v2
- name: Build & Publish the Docker image
if: ${{ !env.ACT }}
run: |
docker build . --file Dockerfile --tag ghcr.io/covalenthq/bsp-geth:latest
docker push ghcr.io/covalenthq/bsp-geth:latest
# - name: Start containers
# run: docker-compose -f "docker-compose.yml" up --build --remove-orphans --force-recreate --exit-code-from agent

# - name: Check running bsp-geth
# run: docker inspect bsp-geth

# - name: Check running containers
# run: docker ps

# - name: Stop containers
# if: always()
# run: docker-compose -f "docker-compose.yml" down
31 changes: 31 additions & 0 deletions .github/workflows/gcr-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: gcr-image

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
- "develop"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Login to GCR
uses: docker/login-action@v2
with:
registry: us-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}

- uses: actions/checkout@v2
# - uses: satackey/[email protected]
- name: Build & Publish the Docker image
run: |
docker buildx create --name builder --use --platform=linux/amd64,linux/arm64 && docker buildx build --platform=linux/amd64,linux/arm64 . -t us-docker.pkg.dev/covalent-project/network/bsp-geth:latest --push
11 changes: 5 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@ name: i386 linux tests

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]
workflow_dispatch:

jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@v2
with:
go-version: 1.23.0
cache: false
go-version: 1.22.5
- name: Run tests
run: go test -short ./...
env:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: golangci-lint

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
- "develop"
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
jobs:
golangci-build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- name: Set up Go 1.22.5
uses: actions/setup-go@v3
with:
go-version: 1.22.5
id: go
- run: go version

- name: Lint
run: |
# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.51.2
# ./bin/golangci-lint run
# Optional: working directory, useful for monorepos
# working-directory: somedir
# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0
# 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 action will use pre-installed Go.
# skip-go-installation: 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
21 changes: 21 additions & 0 deletions .github/workflows/hadolint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: dockerfile-lint

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
- "develop"

jobs:
linter:
name: lint-dockerfile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: lint dockerfile
uses: brpaz/hadolint-action@master
with:
dockerfile: "Dockerfile"
39 changes: 39 additions & 0 deletions .github/workflows/tag-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: tag-release

on:
push:
tags:
- "v*.*.*"

jobs:
tagged-release:
name: Tagged Release
runs-on: "ubuntu-latest"

steps:
- name: Login to GCR
uses: docker/login-action@v2
with:
registry: us-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}

- uses: actions/checkout@v2

# - uses: satackey/[email protected]

- name: Set env
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Build & Publish the Docker image
run: |
docker buildx create --name builder --use --platform=linux/amd64,linux/arm64 && docker buildx build --platform=linux/amd64,linux/arm64 . -t us-docker.pkg.dev/covalent-project/network/bsp-geth:stable -t us-docker.pkg.dev/covalent-project/network/bsp-geth:"${{ env.TAG }}" --push
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
draft: false
prerelease: false
files: |
*.zip
*.tar.gz
20 changes: 19 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,23 @@ profile.cov
# VS Code
.vscode

# dashboard
/dashboard/assets/flow-typed
/dashboard/assets/node_modules
/dashboard/assets/stats.json
/dashboard/assets/bundle.js
/dashboard/assets/bundle.js.map
/dashboard/assets/package-lock.json

**/yarn-error.log

data/
ganache_data/
.env
scripts/
logs/
coverage.out
coverage.txt
tests/spec-tests/
bin/
bin/
out/
4 changes: 4 additions & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ignored:
- DL3018
- DL3016
- DL3059
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG VERSION=""
ARG BUILDNUM=""

# Build Geth in a stock Go builder container
FROM golang:1.23-alpine AS builder
FROM golang:1.22-alpine AS builder

RUN apk add --no-cache gcc musl-dev linux-headers git

Expand All @@ -23,7 +23,7 @@ RUN apk add --no-cache ca-certificates
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/

EXPOSE 8545 8546 30303 30303/udp
ENTRYPOINT ["geth"]
ENTRYPOINT ["geth", "--mainnet", "--syncmode", "full", "--datadir", "/root/.ethereum/covalent", "--replication.targets", "redis://localhost:6379/?topic=replication", "--replica.result", "true", "--replica.specimen", "true", "--replica.blob", "true"]

# Add some metadata labels to help programmatic image consumption
ARG COMMIT=""
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.alltools
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG VERSION=""
ARG BUILDNUM=""

# Build Geth in a stock Go builder container
FROM golang:1.23-alpine AS builder
FROM golang:1.22-alpine AS builder

RUN apk add --no-cache gcc musl-dev linux-headers git

Expand Down
Loading

0 comments on commit e4b4adb

Please sign in to comment.