2022-04-22 21:12:10 +00:00
|
|
|
name: Test Application On PR
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
2022-05-06 15:03:15 +00:00
|
|
|
stack-orchestrator-ref:
|
|
|
|
description: "The branch, commit or sha from stack-orchestrator to checkout"
|
2022-04-22 21:12:10 +00:00
|
|
|
required: false
|
|
|
|
default: "main"
|
2022-05-17 20:05:15 +00:00
|
|
|
ipld-ethcl-db-ref:
|
|
|
|
description: "The branch, commit or sha from ipld-ethcl-db to checkout"
|
2022-04-22 21:12:10 +00:00
|
|
|
required: false
|
|
|
|
default: "main"
|
2022-05-12 13:52:13 +00:00
|
|
|
ssz-data-ref:
|
|
|
|
description: "The branch, commit or sha from ssz-data to checkout"
|
|
|
|
required: false
|
|
|
|
default: "main"
|
2022-04-22 21:12:10 +00:00
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- "!**.md"
|
2022-04-25 14:47:05 +00:00
|
|
|
- "!.gitignore"
|
2022-04-22 21:12:10 +00:00
|
|
|
- "!LICENSE"
|
|
|
|
- "!.github/workflows/**"
|
|
|
|
- ".github/workflows/on-pr.yml"
|
2022-04-25 14:47:05 +00:00
|
|
|
- "**"
|
2022-04-22 21:12:10 +00:00
|
|
|
|
2022-05-06 15:03:15 +00:00
|
|
|
env:
|
2022-05-13 12:48:31 +00:00
|
|
|
stack-orchestrator-ref: ${{ github.event.inputs.stack-orchestrator-ref || 'feature/client-build'}}
|
2022-05-17 20:05:15 +00:00
|
|
|
ipld-ethcl-db-ref: ${{ github.event.inputs.ipld-ethcl-db-ref || 'feature/schema-ipld-ethcl-indexer' }}
|
2022-05-12 13:52:13 +00:00
|
|
|
ssz-data-ref: ${{ github.event.inputs.ssz-data-ref || 'main' }}
|
2022-05-06 15:03:15 +00:00
|
|
|
GOPATH: /tmp/go
|
2022-04-22 21:12:10 +00:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Run Docker Build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2022-05-06 15:03:15 +00:00
|
|
|
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:
|
2022-05-17 20:05:15 +00:00
|
|
|
ref: ${{ env.ipld-ethcl-db-ref }}
|
|
|
|
repository: vulcanize/ipld-ethcl-db
|
|
|
|
path: "./ipld-ethcl-db/"
|
|
|
|
token: ${{ secrets.GH_PAT }}
|
2022-05-06 15:03:15 +00:00
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Create config file
|
|
|
|
run: |
|
2022-05-17 20:05:15 +00:00
|
|
|
echo vulcanize_ipld_ethcl_db=$GITHUB_WORKSPACE/ipld-ethcl-db/ > ./config.sh
|
2022-05-06 15:03:15 +00:00
|
|
|
echo vulcanize_ipld_ethcl_indexer=$GITHUB_WORKSPACE/ipld-ethcl-indexer >> ./config.sh
|
|
|
|
echo ethcl_capture_mode=boot >> ./config.sh
|
2022-05-13 12:48:31 +00:00
|
|
|
echo ethcl_skip_sync=true >> ./config.sh
|
2022-05-13 14:46:13 +00:00
|
|
|
echo ethcl_known_gap_increment=1000000 >> ./config.sh
|
2022-05-06 15:03:15 +00:00
|
|
|
cat ./config.sh
|
|
|
|
|
|
|
|
- name: Run docker compose
|
|
|
|
run: |
|
|
|
|
docker-compose \
|
2022-05-17 20:05:15 +00:00
|
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ethcl-db.yml" \
|
2022-05-06 15:03:15 +00:00
|
|
|
-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
|
2022-05-17 20:35:38 +00:00
|
|
|
if [[ "$(cat ./HEALTH)" -eq "0" ]]; then echo "Application boot successful" && (exit 0); else docker compose -f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ipld-ethcl-indexer.yml" cp ipld-ethcl-indexer:/root/ipld-ethcl-indexer.log . && cat ipld-ethcl-indexer.log && (exit 1); fi
|
2022-04-22 21:12:10 +00:00
|
|
|
|
|
|
|
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:
|
2022-05-06 15:03:15 +00:00
|
|
|
ref: ${{ env.stack-orchestrator-ref }}
|
|
|
|
path: "./stack-orchestrator/"
|
|
|
|
repository: vulcanize/stack-orchestrator
|
2022-04-22 21:12:10 +00:00
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
2022-05-17 20:05:15 +00:00
|
|
|
ref: ${{ env.ipld-ethcl-db-ref }}
|
|
|
|
repository: vulcanize/ipld-ethcl-db
|
|
|
|
path: "./ipld-ethcl-db/"
|
|
|
|
token: ${{ secrets.GH_PAT }}
|
2022-04-22 21:12:10 +00:00
|
|
|
fetch-depth: 0
|
|
|
|
|
2022-05-12 13:52:13 +00:00
|
|
|
- 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
|
|
|
|
|
2022-04-22 21:12:10 +00:00
|
|
|
- name: Create config file
|
|
|
|
run: |
|
2022-05-17 20:05:15 +00:00
|
|
|
echo vulcanize_ipld_ethcl_db=$GITHUB_WORKSPACE/ipld-ethcl-db/ > ./config.sh
|
2022-04-22 21:12:10 +00:00
|
|
|
echo vulcanize_ipld_ethcl_indexer=$GITHUB_WORKSPACE/ipld-ethcl-indexer >> ./config.sh
|
|
|
|
cat ./config.sh
|
|
|
|
|
2022-05-12 13:52:13 +00:00
|
|
|
- name: Run docker compose
|
|
|
|
run: |
|
|
|
|
docker-compose \
|
2022-05-17 20:05:15 +00:00
|
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ethcl-db.yml" \
|
2022-05-12 13:52:13 +00:00
|
|
|
--env-file ./config.sh \
|
|
|
|
up -d --build
|
|
|
|
|
2022-04-22 21:12:10 +00:00
|
|
|
- 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:
|
2022-05-06 15:03:15 +00:00
|
|
|
ref: ${{ env.stack-orchestrator-ref }}
|
|
|
|
path: "./stack-orchestrator/"
|
|
|
|
repository: vulcanize/stack-orchestrator
|
2022-04-22 21:12:10 +00:00
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
2022-05-17 20:05:15 +00:00
|
|
|
ref: ${{ env.ipld-ethcl-db-ref }}
|
|
|
|
repository: vulcanize/ipld-ethcl-db
|
|
|
|
path: "./ipld-ethcl-db/"
|
|
|
|
token: ${{ secrets.GH_PAT }}
|
2022-04-22 21:12:10 +00:00
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Create config file
|
|
|
|
run: |
|
2022-05-17 20:05:15 +00:00
|
|
|
echo vulcanize_ipld_ethcl_db=$GITHUB_WORKSPACE/ipld-ethcl-db/ > ./config.sh
|
2022-04-22 21:12:10 +00:00
|
|
|
echo vulcanize_ipld_ethcl_indexer=$GITHUB_WORKSPACE/ipld-ethcl-indexer >> ./config.sh
|
2022-05-06 15:03:15 +00:00
|
|
|
echo ethcl_capture_mode=boot >> ./config.sh
|
2022-04-22 21:12:10 +00:00
|
|
|
cat ./config.sh
|
|
|
|
|
|
|
|
- name: Run docker compose
|
|
|
|
run: |
|
|
|
|
docker-compose \
|
2022-05-17 20:05:15 +00:00
|
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ethcl-db.yml" \
|
2022-05-06 15:03:15 +00:00
|
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/latest/docker-compose-lighthouse.yml" \
|
2022-04-22 21:12:10 +00:00
|
|
|
--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:
|
2022-05-17 20:05:15 +00:00
|
|
|
args: --timeout 90s
|