Skip to content

Sync main to forcerelay-dev branch #5204

Sync main to forcerelay-dev branch

Sync main to forcerelay-dev branch #5204

Workflow file for this run

name: E2E Tests
on:
push:
pull_request:
merge_group:
workflow_dispatch:
# Ensure that only a single job or workflow using the same concurrency group will run at a time.
# see https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
# only needs to test the group's latest commit
cancel-in-progress: true
jobs:
e2e-test:
strategy:
matrix:
# Supported GitHub-hosted runners and hardware resources
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
os: [ubuntu-22.04]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Cache of Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build
- name: Build Axon in the development profile
run: |
# check for AVX2 support by inspecting `/proc/cpuinfo` or running `lscpu`
lscpu
cargo build
- name: Start a single Axon node
env:
LOG_FILE: ${{ runner.temp }}/${{ matrix.os }}-single-axon-node.log
run: |
target/debug/axon --version | tee ${{ env.LOG_FILE }}
target/debug/axon init \
--config devtools/chain/config.toml \
--chain-spec devtools/chain/specs/single_node/chain-spec.toml \
| tee -a ${{ env.LOG_FILE }}
target/debug/axon run \
--config devtools/chain/config.toml \
| tee -a ${{ env.LOG_FILE }} &
npx zx <<'EOF'
import { waitXBlocksPassed } from './devtools/ci/scripts/helper.js'
await retry(3, '6s', () => waitXBlocksPassed('http://127.0.0.1:8000', 2))
EOF
timeout-minutes: 1
- name: Use Node.js 16
uses: actions/setup-node@v4
with:
node-version: 16
- name: Get yarn cache directory
id: yarn-cache-dir
run: echo "dir=$(yarn cache dir)" >> ${GITHUB_OUTPUT}
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- name: Node Cache
uses: actions/cache@v3
id: npm-and-yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: |
${{ steps.yarn-cache-dir.outputs.dir }}
${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: E2E Tests Linting in tests/e2e
working-directory: tests/e2e
run: yarn && yarn lint
- name: Serve files in tests/e2e/src by http-server
working-directory: tests/e2e
run: echo '\n' | yarn http-server
- name: E2E Tests in tests/e2e
working-directory: tests/e2e
run: |
npx zx <<'EOF'
await retry(3, expBackoff(), () => $`HEADLESS=new yarn test`)
EOF
timeout-minutes: 6