Run e2e tests #192
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run e2e tests | |
on: | |
workflow_call: | |
inputs: | |
e2eBranch: | |
type: string | |
required: false | |
substrateNodeVersion: | |
type: string | |
required: false | |
default: 'eth-rollup-develop' | |
globalVersion: | |
type: string | |
required: false | |
default: '8dd0c81aa88b967334d001d8cae031f8799a189f' | |
workflow_dispatch: | |
inputs: | |
e2eBranch: | |
type: string | |
required: false | |
substrateNodeVersion: | |
type: string | |
required: false | |
default: 'eth-rollup-develop' | |
globalVersion: | |
type: string | |
required: false | |
default: '8dd0c81aa88b967334d001d8cae031f8799a189f' | |
permissions: | |
contents: read | |
actions: read | |
checks: write | |
env: | |
CURRENT_BRANCH: ${{ github.head_ref || github.ref_name }} | |
DEFAULT_E2E_REPO_BRANCH: eth-rollup-develop | |
AVS_AGGREGATOR_VERSION: ${{ inputs.globalVersion }} | |
AVS_FINALIZER_VERSION: ${{ inputs.globalVersion }} | |
ROLLUP_SEQUENCER_VERSION: ${{ inputs.globalVersion }} | |
ROLLUP_UPDATER_VERSION: ${{ inputs.globalVersion }} | |
MANGATA_NODE_VERSION: ${{ inputs.substrateNodeVersion }} | |
jobs: | |
run-e2e-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Start env | |
run: docker compose up -d --wait | |
- name: Use custom branch in e2e tests repository if it exists, otherwise use default branch | |
id: e2e | |
run: | | |
# Implementation of this conditional action was taken from here: | |
# https://github.com/actions/checkout/issues/512#issuecomment-1264735491 | |
# This condition check if the input 'e2eBranch' is empty, and if it is, it checks if the current branch name exists in 'mangata-e2e' repository | |
if [[ -z "${{ inputs.e2eBranch }}" ]]; then | |
# Checking if current branch name exists in 'mangata-e2e' repository | |
if git ls-remote --heads --quiet --exit-code https://github.com/mangata-finance/mangata-e2e.git ${{ env.CURRENT_BRANCH }}; then | |
echo "Using custom '${{ env.CURRENT_BRANCH }}' branch as it exists in 'mangata-e2e' repository" | |
echo "BRANCH=${{ env.CURRENT_BRANCH }}" >> $GITHUB_OUTPUT | |
else | |
echo "Custom branch '${{ env.CURRENT_BRANCH }}' does not exist in 'mangata-e2e' repository, using default '${{ env.DEFAULT_E2E_REPO_BRANCH }}' branch" | |
echo "BRANCH=${{ env.DEFAULT_E2E_REPO_BRANCH }}" >> $GITHUB_OUTPUT | |
fi | |
else | |
echo "Using '${{ inputs.e2eBranch }}' branch fo 'mangata-e2e' repository as it was provided in the input" | |
echo "BRANCH=${{ inputs.e2eBranch }}" >> $GITHUB_OUTPUT | |
fi | |
- name: Checkout tests | |
uses: actions/checkout@v4 | |
with: | |
repository: mangata-finance/mangata-e2e | |
ref: ${{ steps.e2e.outputs.BRANCH }} | |
path: e2eTests | |
- name: Install e2e tests dependencies | |
working-directory: e2eTests | |
run: yarn install | |
- name: Run tests | |
working-directory: e2eTests | |
run: yarn test-rollup | |
- name: Get sequencer logs | |
if: success() || failure() | |
run: docker logs rollup-sequencer-1 | |
- name: Get updater logs | |
if: success() || failure() | |
run: docker logs rollup-updater-1 | |
- name: Test Report | |
uses: dorny/[email protected] | |
if: success() || failure() | |
with: | |
name: E2E report test-rollup | |
path: e2eTests/reports/*.xml | |
reporter: jest-junit | |
run-avs-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Start env | |
run: docker compose up -d --wait | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
- name: build and copy contracts | |
working-directory: contracts | |
run: | | |
forge build | |
cp out/FinalizerTaskManager.sol/FinalizerTaskManager.json ../avs-finalizer/tests/abis/FinalizerTaskManager.json | |
cp out/IndexRegistryStorage.sol/IndexRegistryStorage.json ../avs-finalizer/tests/abis/IndexRegistryStorage.json | |
cp out/RegistryCoordinator.sol/RegistryCoordinator.json ../avs-finalizer/tests/abis/RegistryCoordinator.json | |
cp out/RegistryCoordinatorStorage.sol/RegistryCoordinatorStorage.json ../avs-finalizer/tests/abis/RegistryCoordinatorStorage.json | |
- name: FINALIZER tests - install deps | |
working-directory: avs-finalizer/tests/ | |
run: yarn install | |
- name: FINALIZER tests - run tests | |
working-directory: avs-finalizer/tests/ | |
run: yarn test | |
- name: Get avs-aggregator logs | |
if: success() || failure() | |
run: docker logs rollup-avs-aggregator-1 | |
- name: Get avs-finalizer logs | |
if: success() || failure() | |
run: docker logs rollup-avs-finalizer-1 | |
- name: Get anvil logs | |
if: success() || failure() | |
run: docker logs rollup-anvil-1 | |
- run: docker ps |