157 lines
4.4 KiB
YAML
157 lines
4.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"
|
|
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:
|
|
stack-orchestrator-ref: ${{ github.event.inputs.stack-orchestrator-ref || 'c17752de64f208f286f02379b80d2a935237c860'}}
|
|
ipld-eth-db-ref: ${{ github.event.inputs.ipld-eth-db-ref || '05600e51d2163e1c5e2a872cb54606bc0a380d12' }}
|
|
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.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
|
|
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:
|
|
stack-orchestrator-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.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
|
|
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
|
|
|
|
- name: Run the tests using Make without race conditions
|
|
run: |
|
|
cd ipld-ethcl-indexer
|
|
make integration-test-local-no-race
|
|
|
|
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
|