Skip to content

subscription tests #2602

subscription tests

subscription tests #2602

Workflow file for this run

name: Tests
on:
push:
paths-ignore:
- '**/README.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pkg-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project: [
bodhi,
eth-providers,
eth-rpc-adapter,
eth-transactions,
]
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: setup yarn
run: npm install -g yarn
- name: install deps
run: yarn install --immutable
- name: start test infra
run: docker compose up -d
- name: start rpc adapter for eth-providers
if: matrix.project == 'eth-providers'
run: yarn workspace @acala-network/eth-rpc-adapter run start:coverage
- name: generate typechain for eth-rpc-adapter tests
if: matrix.project == 'eth-rpc-adapter'
run: yarn workspace @acala-network/eth-rpc-adapter run typegen
- name: run tests
run: yarn workspace @acala-network/${{ matrix.project }} run test:coverage
- name: save coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.project }}
path: packages/${{ matrix.project }}/coverage
if-no-files-found: error
include-hidden-files: true
- name: dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
e2e-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project: [
e2e-hardhat,
e2e-truffle,
e2e-viem,
]
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: setup yarn
run: npm install -g yarn
- name: install deps
run: yarn install --immutable
- name: start test infra
run: docker compose up -d
- name: start coverage server
env:
COVERAGE_DIR: eth-rpc-adapter/coverage-${{ matrix.project }}
run: yarn workspace @acala-network/eth-rpc-adapter run start:coverage
- name: install deps for e2e tests
run: cd e2e-tests/${{ matrix.project }} && yarn install --immutable
- name: run e2e tests
run: cd e2e-tests/${{ matrix.project }} && yarn test:acalaFork
- name: stop coverage server and generate coverage report
run: yarn workspace @acala-network/eth-rpc-adapter run stop:coverage
- name: save coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.project }}
path: packages/eth-rpc-adapter/coverage-${{ matrix.project }}
if-no-files-found: error
include-hidden-files: true
- name: dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
merge-and-upload-coverage-reports:
runs-on: ubuntu-latest
needs: [pkg-tests, e2e-tests]
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: setup yarn
run: npm install -g yarn
- name: install deps
run: yarn install --immutable
- name: download all coverage reports
run: |
pkg_tasks="bodhi eth-providers eth-rpc-adapter eth-transactions"
e2e_tasks="e2e-hardhat e2e-truffle e2e-viem"
for pkg in $pkg_tasks; do
echo "downloading coverage for $pkg ..."
mkdir -p packages/$pkg/coverage
gh run download -n coverage-$pkg -D packages/$pkg/coverage
done
for e2e in $e2e_tasks; do
echo "downloading coverage for $e2e ..."
mkdir -p packages/eth-rpc-adapter/coverage-$e2e
gh run download -n coverage-$e2e -D packages/eth-rpc-adapter/coverage-$e2e
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: merge coverage reports
run: yarn merge-coverage
- name: upload merged coverage report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true