Boot application with tests (#14)

* Update cobra to require `head` or `historic` when using `capture`.

* A very generic package for implementing PGX driver

I copied most of the code from the `statediff` service from within geth. The idea is that I can create formal DB packages, that can be utilized in other projects down the road.

* Put PGX and other future Postgres Drivers behind SQL package

This PR makes allows users to provide a config, along with a driver string. It will then provide the respective driver.

* Add DB Connection and Logging

* Utilize LogRus
* Create a DB connection using PGX.
* Create an internal boot package for starting the application.

* Code clean up + Beacon Chain Connection

This concludes all the code needed to connect to the DB and beacon node. We will no longer reference the lighthouse client because this application should work interchangeably with any beacon node.

I have also standardized logging.

* Last second clean ups

* Utilize Ginkgo toreplace `testing` library, and add CI/CD. (#9)

* Utilize Ginkgo and replace `testing` library.

* Add TOC to docs

* Add Docker specific files

* Remove -e

* Update on-pr-manual.yml

* Add depth

* Add repositories

* Remove $ from path

* Update path for make

* Setup Go and Ginkgo

* Use go mod download

* Use go install

* Update on-pr-manual.yml

* Use latest

* Remove install of GINKGO

* Add explicit gopath

* Explicitly specify the gopath

* Update on-pr-manual.yml

* Update on-pr-manual.yml

* Update on-pr-manual.yml

* Update on-pr-manual.yml

* Update on-pr-manual.yml

* Update on-pr-manual.yml

* Use which ginkgo

* Try with make now

* Final working Make

* Feature/11 testing add tests for boot (#12)

* Utilize Versioning

* Update Testing and CI/CD

* Update Testing

* Add Linting and Remove timeout

* Update Lint

* handle errors to make the linter happy

* Utilized interfaces for DB

* Update Manual Testing CI/CD

* Try combining everything into one pipeline (#13)

* Try combining everything into one pipeline

* Update on-pr-manual.yml

* Remove PAth for testing

* Combine single YML workflow file for PR

* Add a comment
This commit is contained in:
Abdul Rabbani 2022-04-22 17:12:10 -04:00 committed by GitHub
parent 978d38e68c
commit 90cb1d3414
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

150
.github/workflows/on-pr.yml vendored Normal file
View File

@ -0,0 +1,150 @@
name: Test Application On PR
on:
workflow_dispatch:
inputs:
foundry-test-ref:
description: "The branch, commit or sha from foundry-test to checkout"
required: false
default: "main"
ipld-eth-db-ref:
description: "The branch, commit or sha from ipld-eth-db to checkout"
required: false
default: "main"
pull_request:
paths:
- "!**.md"
- ".gitignore"
- "!LICENSE"
- "!.github/workflows/**"
- ".github/workflows/on-pr.yml"
jobs:
build:
name: Run Docker Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run docker build
run: make docker-build
unit-test:
name: Run Unit Tests
runs-on: ubuntu-latest
## IF you want to update the default branch for `pull_request runs, do it after the ||`
env:
foundry-test-ref: ${{ github.event.inputs.foundry-test-ref || 'feature/build-stack'}}
ipld-eth-db-ref: ${{ github.event.inputs.ipld-eth-db-ref || 'main' }}
GOPATH: /tmp/go
steps:
- name: Create GOPATH
run: mkdir -p /tmp/go
- uses: actions/checkout@v2
with:
path: "./ipld-ethcl-indexer"
- uses: actions/checkout@v3
with:
ref: ${{ env.foundry-test-ref }}
path: "./foundry-test/"
repository: vulcanize/foundry-test
fetch-depth: 0
- uses: actions/checkout@v3
with:
ref: ${{ env.ipld-eth-db-ref }}
repository: vulcanize/ipld-eth-db
path: "./ipld-eth-db/"
fetch-depth: 0
- name: Create config file
run: |
echo vulcanize_ipld_eth_db=$GITHUB_WORKSPACE/ipld-eth-db/ > ./config.sh
echo vulcanize_ipld_ethcl_indexer=$GITHUB_WORKSPACE/ipld-ethcl-indexer >> ./config.sh
cat ./config.sh
- uses: actions/setup-go@v3
with:
go-version: ">=1.17.0"
check-latest: true
- name: Install packages
run: |
go install github.com/onsi/ginkgo/v2/ginkgo@latest
which ginkgo
- name: Run the tests using Make
run: |
cd ipld-ethcl-indexer
make unit-test-ci
integration-test:
name: Run Integration Tests
runs-on: ubuntu-latest
env:
foundry-test-ref: feature/build-stack
ipld-eth-db-ref: main
GOPATH: /tmp/go
steps:
- name: Create GOPATH
run: mkdir -p /tmp/go
- uses: actions/checkout@v2
with:
path: "./ipld-ethcl-indexer"
- uses: actions/checkout@v3
with:
ref: ${{ env.foundry-test-ref }}
path: "./foundry-test/"
repository: vulcanize/foundry-test
fetch-depth: 0
- uses: actions/checkout@v3
with:
ref: ${{ env.ipld-eth-db-ref }}
repository: vulcanize/ipld-eth-db
path: "./ipld-eth-db/"
fetch-depth: 0
- name: Create config file
run: |
echo vulcanize_ipld_eth_db=$GITHUB_WORKSPACE/ipld-eth-db/ > ./config.sh
echo vulcanize_ipld_ethcl_indexer=$GITHUB_WORKSPACE/ipld-ethcl-indexer >> ./config.sh
cat ./config.sh
- name: Run docker compose
run: |
docker-compose \
-f "$GITHUB_WORKSPACE/foundry-test/docker/local/docker-compose-db.yml" \
-f "$GITHUB_WORKSPACE/foundry-test/docker/latest/docker-compose-lighthouse.yml" \
--env-file ./config.sh \
up -d --build
- uses: actions/setup-go@v3
with:
go-version: ">=1.17.0"
check-latest: true
- name: Install packages
run: |
go install github.com/onsi/ginkgo/v2/ginkgo@latest
which ginkgo
- name: Run the tests using Make
run: |
cd ipld-ethcl-indexer
make integration-test-ci
golangci:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: ">=1.17.0"
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --disable errcheck