2023-06-21 23:25:27 +00:00
|
|
|
name: Unit and integration tests
|
|
|
|
on:
|
2023-09-21 08:01:49 +00:00
|
|
|
# workflow_call:
|
|
|
|
|
|
|
|
# Job headers are hidden when not top-level - run them directly for readability until fixed:
|
|
|
|
# https://github.com/go-gitea/gitea/issues/26736
|
|
|
|
pull_request:
|
|
|
|
branches: '*'
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- ci-test
|
|
|
|
|
|
|
|
env:
|
2024-08-06 21:06:37 +00:00
|
|
|
SO_VERSION: v1.1.0-36d4969-202407091537
|
|
|
|
FIXTURENET_ETH_STACKS_REF: main
|
2023-06-21 23:25:27 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
unit-tests:
|
2023-09-21 08:01:49 +00:00
|
|
|
name: Run unit tests
|
2023-06-21 23:25:27 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version-file: 'go.mod'
|
|
|
|
check-latest: true
|
2023-09-21 08:01:49 +00:00
|
|
|
- name: Run DB container
|
2023-06-21 23:25:27 +00:00
|
|
|
run: |
|
|
|
|
docker compose -f test/compose-db.yml up --wait --quiet-pull
|
2023-09-21 08:01:49 +00:00
|
|
|
- name: Run tests
|
|
|
|
run: go test -p 1 -v ./pkg/...
|
2023-06-21 23:25:27 +00:00
|
|
|
|
|
|
|
integration-tests:
|
2023-09-21 08:01:49 +00:00
|
|
|
name: Run integration tests
|
2023-06-21 23:25:27 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version-file: 'go.mod'
|
|
|
|
check-latest: true
|
2023-09-21 08:01:49 +00:00
|
|
|
|
2024-08-06 21:06:37 +00:00
|
|
|
# At present the stock setup-python action fails on Linux/aarch64
|
|
|
|
# Conditional steps below workaroud this by using deadsnakes for that case only
|
|
|
|
- name: "Install Python for ARM on Linux"
|
|
|
|
if: ${{ runner.arch == 'arm64' && runner.os == 'Linux' }}
|
|
|
|
uses: deadsnakes/action@v3.0.1
|
|
|
|
with:
|
|
|
|
python-version: 3.11
|
|
|
|
- name: "Install Python cases other than ARM on Linux"
|
|
|
|
if: ${{ ! (runner.arch == 'arm64' && runner.os == 'Linux') }}
|
2023-09-21 08:01:49 +00:00
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: '3.11'
|
|
|
|
- name: Install stack-orchestrator
|
2023-06-21 23:25:27 +00:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: cerc-io/stack-orchestrator
|
2023-09-21 08:01:49 +00:00
|
|
|
ref: ${{ env.SO_VERSION }}
|
2023-06-21 23:25:27 +00:00
|
|
|
path: ./stack-orchestrator
|
|
|
|
- run: pip install ./stack-orchestrator
|
2024-08-06 21:06:37 +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
|
2023-09-21 08:01:49 +00:00
|
|
|
|
|
|
|
- name: Run testnet stack
|
|
|
|
env:
|
|
|
|
CERC_GO_AUTH_TOKEN: ${{ secrets.CICD_REPO_TOKEN }}
|
2024-08-06 21:06:37 +00:00
|
|
|
run: ./scripts/run-test-stack.sh ./fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-plugeth
|
2023-09-21 08:01:49 +00:00
|
|
|
- name: Run contract deployer
|
2023-06-21 23:25:27 +00:00
|
|
|
run: |
|
|
|
|
docker compose -f test/compose-deployer.yml up --wait --quiet-pull
|
2023-09-21 08:01:49 +00:00
|
|
|
- name: Wait for testnet
|
2023-06-21 23:25:27 +00:00
|
|
|
run: |
|
|
|
|
# Start validator at current head, but not before Merge (block 1 on test chain)
|
|
|
|
while
|
2024-08-06 21:06:37 +00:00
|
|
|
echo "Waiting for chain head to progress..."
|
2023-06-21 23:25:27 +00:00
|
|
|
height=$(./scripts/get-block-number.sh $ETH_HTTP_PATH)
|
2024-08-06 21:06:37 +00:00
|
|
|
[[ "$height" -lt 2 ]];
|
2023-06-21 23:25:27 +00:00
|
|
|
do sleep 5; done
|
|
|
|
echo "Chain has reached block $height"
|
|
|
|
echo VALIDATE_FROM_BLOCK=$height >> "$GITHUB_ENV"
|
2023-09-21 08:01:49 +00:00
|
|
|
- name: Run tests
|
2023-06-21 23:25:27 +00:00
|
|
|
run: |
|
2024-08-06 21:06:37 +00:00
|
|
|
go test -v -p 1 ./integration/... -timeout=20m
|