7a242a4c71
* multihash key gen func * go mod updates * Added test to ensure the application shuts down gracefully or within a timeframe. * Disregard race condition since its with the test not the application itself * Capture the head block in the DB entirely. (#27) * -- Intermediary Commit -- Just want to commit my code over the weekend, in case I spill coffee on my workstation. * Create DB models ready for write. * Handle SSE events * Update ref for stack-orchestrator * Use env in one place only. * Boot Application on PR * Update syntax * Update syntax * Correct command * Use bash instead of sh * Use until instead of while * Make linter happy and check sse subscription err * Handle Reorgs - Untested * Feature/22 test handling incoming events - Intermediary Commit (#28) * Checkpoint before the weekend * Update location for SetupPostgresDB * Feature/22 test handling incoming events (#30) * Checkpoint before the weekend * Update location for SetupPostgresDB * Include first functioning tests for processing head * Fix gitignore * Test CaptureHead | Add Metrics | Handle Test Race Conditions This Commit allows us to: * Test the `CaptureHead` function. * Test parsing a single Head message. * Test a Reorg condition. * Add Metrics. This is primarily used for testing but can have future use cases. * Rearrange the test due to race conditions introduced by reusing a variable. `BeforeEach` can't be used to update `BC`. * Update and finalize testing at this stage * Update code and CI/CD * Fix lint errors * Update CICD and fail when file not found. * Update test to have failed as expected. * Remove Test file * Add KnownGaps Errors (#33) * Handle Skipped Slots (#34) * Ensure that the node is synced at boot time * Update test + add logic for checking skipped slots * Update boot check * Add skip_sync to config. * Update a test so it fails * go mod updates * Integrate MHKey into existing code base. * Update go.mod and go.sum * Utilize the MHkey * Stop tests from running forever on failure. * Use sszRoot instead of sszObj for MhKey * Update entrypoint script * Update config parameter Co-authored-by: Abdul Rabbani <abdulrabbani00@gmail.com> Co-authored-by: Abdul Rabbani <58230246+abdulrabbani00@users.noreply.github.com>
207 lines
6.4 KiB
YAML
207 lines
6.4 KiB
YAML
name: Test Application On PR
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
stack-orchestrator-ref:
|
|
description: "The branch, commit or sha from stack-orchestrator 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"
|
|
ssz-data-ref:
|
|
description: "The branch, commit or sha from ssz-data to checkout"
|
|
required: false
|
|
default: "main"
|
|
pull_request:
|
|
paths:
|
|
- "!**.md"
|
|
- "!.gitignore"
|
|
- "!LICENSE"
|
|
- "!.github/workflows/**"
|
|
- ".github/workflows/on-pr.yml"
|
|
- "**"
|
|
|
|
env:
|
|
stack-orchestrator-ref: ${{ github.event.inputs.stack-orchestrator-ref || 'feature/client-build'}}
|
|
ipld-eth-db-ref: ${{ github.event.inputs.ipld-eth-db-ref || 'minimal-beacon-chain-schema' }}
|
|
ssz-data-ref: ${{ github.event.inputs.ssz-data-ref || 'main' }}
|
|
GOPATH: /tmp/go
|
|
jobs:
|
|
build:
|
|
name: Run Docker Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
path: "./ipld-ethcl-indexer"
|
|
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ env.stack-orchestrator-ref }}
|
|
path: "./stack-orchestrator/"
|
|
repository: vulcanize/stack-orchestrator
|
|
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
|
|
echo ethcl_capture_mode=boot >> ./config.sh
|
|
echo ethcl_skip_sync=true >> ./config.sh
|
|
echo ethcl_known_gap_increment=1000000 >> ./config.sh
|
|
cat ./config.sh
|
|
|
|
- name: Run docker compose
|
|
run: |
|
|
docker-compose \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-db.yml" \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/latest/docker-compose-lighthouse.yml" \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ipld-ethcl-indexer.yml" \
|
|
--env-file ./config.sh \
|
|
up -d --build
|
|
|
|
- name: Check to make sure HEALTH file is present
|
|
shell: bash
|
|
run: |
|
|
until $(docker compose -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ipld-ethcl-indexer.yml" cp ipld-ethcl-indexer:/root/HEALTH ./HEALTH) ; do sleep 10; done
|
|
cat ./HEALTH
|
|
if [[ "$(cat ./HEALTH)" -eq "0" ]]; then echo "Application boot successful" && (exit 0); else (exit 1); fi
|
|
|
|
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 ||`
|
|
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.stack-orchestrator-ref }}
|
|
path: "./stack-orchestrator/"
|
|
repository: vulcanize/stack-orchestrator
|
|
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
|
|
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ env.ssz-data-ref }}
|
|
repository: vulcanize/ssz-data
|
|
path: "./ipld-ethcl-indexer/pkg/beaconclient/ssz-data"
|
|
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/stack-orchestrator/docker/local/docker-compose-db.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 unit-test-ci
|
|
|
|
integration-test:
|
|
name: Run Integration Tests
|
|
runs-on: ubuntu-latest
|
|
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.stack-orchestrator-ref }}
|
|
path: "./stack-orchestrator/"
|
|
repository: vulcanize/stack-orchestrator
|
|
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
|
|
echo ethcl_capture_mode=boot >> ./config.sh
|
|
cat ./config.sh
|
|
|
|
- name: Run docker compose
|
|
run: |
|
|
docker-compose \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-db.yml" \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/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
|