Skip to content

test-suite-e2e-operators-tests #63

test-suite-e2e-operators-tests

test-suite-e2e-operators-tests #63

name: test-suite-e2e-operators-tests
# Github does not support more than 10 inputs for workflow_dispatch:
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#providing-inputs
# Core, relayer and test-suite will use the default versions defined in the `fhevm-cli` script
on:
workflow_dispatch:
inputs:
connector_version:
description: "Connector Version"
default: ""
type: string
db_migration_version:
description: "Coprocessor DB Migration Image Version"
default: ""
type: string
host_version:
description: "Host Image Version"
default: ""
type: string
gateway_version:
description: "Gateway Image Version"
required: false
default: ""
type: string
host_listener_version:
description: "Host Listener Image Version"
default: ""
type: string
gateway_listener_version:
description: "Gateway Listener Image Version"
default: ""
type: string
tx_sender_version:
description: "Transaction Sender Image Version"
default: ""
type: string
tfhe_worker_version:
description: "TFHE Worker Image Version"
default: ""
type: string
sns_worker_version:
description: "SNS Worker Image Version"
default: ""
type: string
zkproof_worker_version:
description: "ZKProof Worker Image Version"
default: ""
type: string
relayer_version:
description: "Relayer Image Version"
default: ""
type: string
relayer_migrate_version:
description: "Relayer Migrate Image Version"
default: ""
type: string
stack_era:
description: "Stack era hint for modern simple-ACL-compatible bundles"
default: ""
type: string
permissions: {}
# Allow to run multiple instances of the same workflow in parallel when triggered manually
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'workflow_dispatch' && github.run_id || 'auto' }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
setup-instance:
name: test-suite-e2e-operators-tests/setup-instance
runs-on: ubuntu-latest
permissions:
contents: 'read' # Required to checkout repository code
outputs:
runner-name: ${{ steps.start-remote-instance.outputs.label }}
steps:
- name: Start remote instance
id: start-remote-instance
uses: zama-ai/slab-github-runner@79939325c3c429837c10d6041e4fd8589d328bac
with:
mode: start
github-token: ${{ secrets.SLAB_ACTION_TOKEN }}
slab-url: ${{ secrets.SLAB_BASE_URL }}
job-secret: ${{ secrets.JOB_SECRET }}
backend: aws
profile: bench
operators-e2e-test:
name: test-suite-e2e-operators-tests/operators-e2e-test
if: ${{ github.event_name == 'workflow_dispatch' }}
permissions:
contents: 'read' # Required to checkout repository code
id-token: 'write' # Required for OIDC authentication
packages: 'read' # Required to read GitHub packages/container registry
env:
GH_TOKEN: ${{ secrets.GHCR_READ_TOKEN || github.token }}
CONNECTOR_DB_MIGRATION_VERSION: ${{ inputs.connector_version }}
CONNECTOR_GW_LISTENER_VERSION: ${{ inputs.connector_version }}
CONNECTOR_KMS_WORKER_VERSION: ${{ inputs.connector_version }}
CONNECTOR_TX_SENDER_VERSION: ${{ inputs.connector_version }}
COPROCESSOR_DB_MIGRATION_VERSION: ${{ inputs.db_migration_version }}
HOST_VERSION: ${{ inputs.host_version }}
GATEWAY_VERSION: ${{ inputs.gateway_version }}
COPROCESSOR_HOST_LISTENER_VERSION: ${{ inputs.host_listener_version }}
COPROCESSOR_GW_LISTENER_VERSION: ${{ inputs.gateway_listener_version }}
COPROCESSOR_TX_SENDER_VERSION: ${{ inputs.tx_sender_version }}
COPROCESSOR_TFHE_WORKER_VERSION: ${{ inputs.tfhe_worker_version }}
COPROCESSOR_SNS_WORKER_VERSION: ${{ inputs.sns_worker_version }}
COPROCESSOR_ZKPROOF_WORKER_VERSION: ${{ inputs.zkproof_worker_version }}
RELAYER_VERSION: ${{ inputs.relayer_version }}
RELAYER_MIGRATE_VERSION: ${{ inputs.relayer_migrate_version }}
STACK_ERA: ${{ inputs.stack_era }}
runs-on: ${{ needs.setup-instance.outputs.runner-name }}
needs: setup-instance
timeout-minutes: 1440
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: 'false'
fetch-depth: 0
- name: Setup Docker
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: Install unzip
run: |
sudo apt-get update
sudo apt-get install -y unzip
- name: Setup Bun
uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2.1.3
- name: Install foundry
uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_READ_TOKEN }}
- name: Login to Chainguard Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: cgr.dev
username: ${{ secrets.CGR_USERNAME }}
password: ${{ secrets.CGR_PASSWORD }}
- name: Install CLI deps
working-directory: test-suite/fhevm
run: |
bun install --frozen-lockfile
- name: Resolve compat defaults
working-directory: test-suite/fhevm
run: |
set -euo pipefail
bash ./scripts/resolve-workflow-compat-env.sh \
"${COPROCESSOR_DB_MIGRATION_VERSION:-}" \
"${COPROCESSOR_HOST_LISTENER_VERSION:-}" \
"${COPROCESSOR_GW_LISTENER_VERSION:-}" \
"${COPROCESSOR_TX_SENDER_VERSION:-}" \
"${COPROCESSOR_TFHE_WORKER_VERSION:-}" \
"${COPROCESSOR_SNS_WORKER_VERSION:-}" \
"${COPROCESSOR_ZKPROOF_WORKER_VERSION:-}" \
"${CONNECTOR_DB_MIGRATION_VERSION:-}" \
"${CONNECTOR_GW_LISTENER_VERSION:-}" \
"${CONNECTOR_KMS_WORKER_VERSION:-}" \
"${CONNECTOR_TX_SENDER_VERSION:-}" \
"${GATEWAY_VERSION:-}" \
"${HOST_VERSION:-}"
- name: Deploy fhevm Stack
working-directory: test-suite/fhevm
run: |
./fhevm-cli up --target latest-release --scenario ./scenarios/two-of-two.yaml
- name: All operators tests
working-directory: test-suite/fhevm
run: |
./fhevm-cli test operators
- name: Random operators tests
working-directory: test-suite/fhevm
run: |
./fhevm-cli test random
- name: Show logs on test failure
working-directory: test-suite/fhevm
if: failure()
run: |
snapshot_logs() {
local group="$1"
local container="$2"
local filter="${3:-}"
echo "::group::${group}"
if [ -n "$filter" ]; then
docker logs --tail 200 "${container}" 2>&1 | grep -v "$filter" || true
else
docker logs --tail 200 "${container}" 2>&1 || true
fi
echo "::endgroup::"
}
snapshot_logs "Relayer Logs" fhevm-relayer
snapshot_logs "Host Listener" coprocessor-host-listener
snapshot_logs "Gateway Listener" coprocessor-gw-listener
snapshot_logs "SNS Worker Logs" coprocessor-sns-worker "Selected 0 rows to process"
snapshot_logs "Transaction Sender Logs (filtered)" coprocessor-transaction-sender "Selected 0 rows to process"
snapshot_logs "ZKProof Worker" coprocessor-zkproof-worker
snapshot_logs "TFHE Worker" coprocessor-tfhe-worker
snapshot_logs "Coprocessor 2 - Host Listener" coprocessor1-host-listener
snapshot_logs "Coprocessor 2 - Gateway Listener" coprocessor1-gw-listener
snapshot_logs "Coprocessor 2 - SNS Worker" coprocessor1-sns-worker "Selected 0 rows to process"
snapshot_logs "Coprocessor 2 - Transaction Sender (filtered)" coprocessor1-transaction-sender "Selected 0 rows to process"
snapshot_logs "Coprocessor 2 - ZKProof Worker" coprocessor1-zkproof-worker
snapshot_logs "Coprocessor 2 - TFHE Worker" coprocessor1-tfhe-worker
- name: Cleanup
working-directory: test-suite/fhevm
if: always()
run: |
./fhevm-cli clean --images
teardown-instance:
name: test-suite-e2e-operators-tests/teardown
if: ${{ always() && needs.setup-instance.result == 'success' }}
needs: [ setup-instance, operators-e2e-test]
runs-on: ubuntu-latest
permissions:
contents: 'read' # Required to checkout repository code
steps:
- name: Stop remote instance
id: stop-instance
uses: zama-ai/slab-github-runner@79939325c3c429837c10d6041e4fd8589d328bac
with:
mode: stop
github-token: ${{ secrets.SLAB_ACTION_TOKEN }}
slab-url: ${{ secrets.SLAB_BASE_URL }}
job-secret: ${{ secrets.JOB_SECRET }}
label: ${{ needs.setup-instance.outputs.runner-name }}