2024-05-17 17:22:23 +00:00
|
|
|
name: Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches: '*'
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- ci-test
|
|
|
|
|
|
|
|
env:
|
2024-08-07 04:53:17 +00:00
|
|
|
SO_VERSION: v1.1.0-36d4969-202407091537
|
|
|
|
SYSTEM_TESTS_REF: main
|
|
|
|
FIXTURENET_ETH_STACKS_REF: main
|
2024-05-17 17:22:23 +00:00
|
|
|
|
|
|
|
jobs:
|
2024-07-01 14:01:27 +00:00
|
|
|
test-beacon-collector:
|
|
|
|
name: Run Beacon collector tests
|
2024-05-17 17:22:23 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-08-07 04:53:17 +00:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
progress: false
|
2024-05-17 17:22:23 +00:00
|
|
|
- uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version-file: 'go.mod'
|
|
|
|
check-latest: true
|
|
|
|
- name: "Build server image"
|
|
|
|
run: docker build . -t cerc/eth-blob-indexer:local
|
|
|
|
- name: "Install Python"
|
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: 3.11
|
|
|
|
|
2024-08-07 04:53:17 +00:00
|
|
|
- name: Install stack-orchestrator
|
|
|
|
run: |
|
|
|
|
curl -L -O https://github.com/cerc-io/stack-orchestrator/releases/download/$SO_VERSION/laconic-so
|
|
|
|
chmod +x laconic-so
|
|
|
|
echo PATH="$PATH:$(pwd)" >> $GITHUB_ENV
|
2024-05-17 17:22:23 +00:00
|
|
|
|
|
|
|
- name: "Clone system-tests"
|
2024-08-07 04:53:17 +00:00
|
|
|
uses: actions/checkout@v4
|
2024-05-17 17:22:23 +00:00
|
|
|
with:
|
|
|
|
repository: cerc-io/system-tests
|
|
|
|
ref: ${{ env.SYSTEM_TESTS_REF }}
|
|
|
|
path: ./system-tests
|
2024-05-30 11:12:24 +00:00
|
|
|
token: ${{ secrets.CICD_REPO_TOKEN }}
|
2024-08-07 04:53:17 +00:00
|
|
|
progress: false
|
2024-05-17 17:22:23 +00:00
|
|
|
- name: "Install pytest"
|
|
|
|
working-directory: ./system-tests
|
|
|
|
run: pip3 install pytest
|
2024-08-07 04:53:17 +00:00
|
|
|
- name: "Clone fixturenet stack repo"
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
repository: cerc-io/fixturenet-eth-stacks
|
|
|
|
ref: ${{ env.FIXTURENET_ETH_STACKS_REF }}
|
|
|
|
path: ./fixturenet-eth-stacks
|
|
|
|
progress: false
|
2024-05-17 17:22:23 +00:00
|
|
|
|
|
|
|
- name: "Run fixturenet stack"
|
2024-08-07 04:53:17 +00:00
|
|
|
run: ./scripts/run-test-stack.sh ./fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-plugeth
|
2024-05-17 17:22:23 +00:00
|
|
|
- name: "Run server"
|
|
|
|
run: docker compose -f test/compose.yml up --wait --quiet-pull
|
|
|
|
- name: "Run tests"
|
|
|
|
working-directory: ./system-tests
|
2024-08-07 04:53:17 +00:00
|
|
|
# Work around dependency conflict in system-tests:
|
|
|
|
# web3 uses an older eth-account until (unreleased) v7
|
2024-05-17 17:22:23 +00:00
|
|
|
run: |
|
|
|
|
pip3 install -r requirements.txt
|
2024-08-07 04:53:17 +00:00
|
|
|
pip3 install --no-deps 'eth-account>=0.12.3,<0.13'
|
2024-05-17 17:22:23 +00:00
|
|
|
pip3 install 'pydantic>=2.0.0'
|
|
|
|
python3 -m pytest -vv -k test_blob_tx
|
2024-07-01 14:01:27 +00:00
|
|
|
|
|
|
|
test-blobscan-scraper:
|
|
|
|
name: Run Blobscan scraper tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-08-07 04:53:17 +00:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
progress: false
|
2024-07-01 14:01:27 +00:00
|
|
|
- uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version-file: 'go.mod'
|
|
|
|
check-latest: true
|
|
|
|
- name: "Install redis-cli"
|
|
|
|
env:
|
|
|
|
DEBIAN_FRONTEND: noninteractive
|
|
|
|
run: apt-get update && apt-get install -y redis-tools
|
|
|
|
|
|
|
|
- name: "Run Blob DB"
|
|
|
|
working-directory: ./test
|
|
|
|
run: docker compose up eth-blob-db --wait --quiet-pull
|
|
|
|
# Check a mainnet blob
|
|
|
|
- name: "Run tests"
|
|
|
|
env:
|
|
|
|
TEST_BLOCK: 20000000
|
|
|
|
TEST_VHASH: 0x017ba4bd9c166498865a3d08618e333ee84812941b5c3a356971b4a6ffffa574
|
|
|
|
# First 10 bytes of blob data
|
|
|
|
EXPECTED_VALUE: 2100000675789c8cd37b0a
|
|
|
|
run: |
|
|
|
|
REDIS_PORT=$(docker port test-eth-blob-db-1 6379 | cut -d: -f2)
|
|
|
|
go run ./cmd/blobscan-scraper \
|
|
|
|
--redis-addr localhost:$REDIS_PORT --log-level debug \
|
|
|
|
--from-block $TEST_BLOCK --to-block $((TEST_BLOCK + 1))
|
|
|
|
|
|
|
|
VALUE=$(redis-cli -p $REDIS_PORT GETRANGE blob:$TEST_VHASH 0 9 | od -An -tx1 | tr -d ' \n')
|
|
|
|
[ "$EXPECTED_VALUE" = "$VALUE" ]
|