Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update debug node action and test workflow to use on several steps #6291

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions .github/actions/setup-debug-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,30 @@ name: "Setup node with debug support"
description: "Setup the nodejs version with debug support"
runs:
using: "composite"
steps:
steps:
# Determine the path of the Node executable
- name: Get Node Path
id: nodepath
shell: bash
run: echo "NODE_PATH=$(which node)" >> $GITHUB_OUTPUT

- name: Check node version
shell: bash
run: |
NODE_VERSION=$(${{ steps.nodepath.outputs.NODE_PATH }} --print "process.version")
echo "Node version found: $NODE_VERSION"
if [[ "$NODE_VERSION" == v20* ]]; then
echo "Matching node version (v20) is installed."
else
echo "Only node 20 has a debug version available"
exit 1
fi

# For now we only have the Node 20 debug build
- run: |
sudo apt-get install unzip && curl -L "https://drive.google.com/uc?export=download&id=1hlhbbQi-NJi8_WjULvOdo-K_tfZFzN3Z&confirm=t" > nodejs.zip && unzip nodejs.zip
sudo cp -f node /usr/bin/node-with-debug
sudo chmod +x /usr/bin/node-with-debug
sudo cp -f node ${{ steps.nodepath.outputs.NODE_PATH }}
sudo chmod +x ${{ steps.nodepath.outputs.NODE_PATH }}
shell: sh

# List of naming patterns
Expand All @@ -18,6 +36,6 @@ runs:
shell: sh

- run: |
echo $(/usr/bin/node-with-debug --print "process.version")
echo $(/usr/bin/node-with-debug --print "process.features.debug")
echo $(${{ steps.nodepath.outputs.NODE_PATH }} --print "process.version")
echo $(${{ steps.nodepath.outputs.NODE_PATH }} --print "process.features.debug")
shell: sh
90 changes: 73 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
workflow_dispatch:

env:
NODE_DEBUG: true
GETH_DOCKER_IMAGE: ethereum/client-go:v1.11.6
NETHERMIND_DOCKER_IMAGE: nethermind/nethermind:1.18.0

Expand All @@ -32,6 +33,9 @@ jobs:
node-version: ${{matrix.node}}
check-latest: true
cache: yarn
- name: Use Debug Version of Node
uses: './.github/actions/setup-debug-node'
if: env.NODE_DEBUG == 'true'
- name: Node.js version
id: node
run: echo "v8CppApiVersion=$(node --print "process.versions.modules")" >> $GITHUB_OUTPUT
Expand All @@ -47,11 +51,24 @@ jobs:
packages/*/.git-data.json
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
- name: Install & build
id: install_and_build
if: steps.cache-build-restore.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile && yarn build
run: |
if [ "${{ env.NODE_DEBUG }}" == "true" ]; then
sudo sh -c "ulimit -c unlimited"
fi
yarn install --frozen-lockfile && yarn build
- name: Build
id: build
if: steps.cache-build-restore.outputs.cache-hit == 'true'
run: yarn build
run: |
if [ "${{ env.NODE_DEBUG }}" == "true" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required for the build step too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. there have been a number of segfaults during build

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I was more curious about the install step actually. Probably it makes sense to be consistent and do it everywhere.

sudo sh -c "ulimit -c unlimited"
fi
yarn build
- uses: './.github/actions/core-dump'
if: ${{ env.NODE_DEBUG == 'true' && always() && (steps.install_and_build.conclusion == 'failure' || steps.build.conclusion == 'failure') }}

- name: Check Build
run: yarn check-build
- name: Test root binary exists
Expand Down Expand Up @@ -159,9 +176,8 @@ jobs:
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn

# # Remove when finished debugging core dumps
# - uses: './.github/actions/setup-debug-node'
- uses: './.github/actions/setup-debug-node'
if: env.NODE_DEBUG == 'true'

- name: Restore build cache
id: cache-primes-restore
Expand All @@ -184,14 +200,15 @@ jobs:
key: spec-test-data-${{ hashFiles('packages/validator/test/spec/params.ts') }}

- name: Unit tests
# id: unit_tests
# Rever to "yarn test:unit" when finished debugging core dumps
# run: sudo sh -c "ulimit -c unlimited && /usr/bin/node-with-debug $(which yarn) test:unit"
run: yarn test:unit

# # Remove when finished debugging core dumps
# - uses: './.github/actions/core-dump'
# if: ${{ failure() && steps.unit_tests.conclusion == 'failure' }}
id: unit_tests
run: |
if [ "${{ env.NODE_DEBUG }}" == "true" ]; then
sudo sh -c "ulimit -c unlimited"
fi
yarn test:unit
- uses: './.github/actions/core-dump'
if: ${{ always() && env.NODE_DEBUG == 'true' && steps.unit_tests.conclusion == 'failure' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if there could be a way to integrate the core-dump as part of the previous step script. It would help with readability.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a bad idea but it needs to run as the last step of a job so that it can catch failures from any preceding step. Ideally this action should be added at the end of any job, as the last step, that may potentially throw a native fault


- name: Upload coverage data
run: yarn coverage
Expand All @@ -212,6 +229,10 @@ jobs:
node-version: ${{matrix.node}}
check-latest: true
cache: yarn
- name: Use Debug Version of Node
uses: './.github/actions/setup-debug-node'
if: env.NODE_DEBUG == 'true'

- name: Restore build cache
id: cache-primes-restore
uses: actions/cache/restore@v3
Expand All @@ -229,9 +250,18 @@ jobs:
run: scripts/run_e2e_env.sh start

- name: E2E tests
run: yarn test:e2e
id: e2e_tests
env:
GOERLI_RPC_URL: ${{ secrets.GOERLI_RPC_URL!=0 && secrets.GOERLI_RPC_URL || env.GOERLI_RPC_DEFAULT_URL }}
run: |
if [ "${{ env.NODE_DEBUG }}" == "true" ]; then
sudo sh -c "ulimit -c unlimited"
fi
yarn test:e2e
# Conditional core-dump action based on NODE_DEBUG and test failure
- uses: './.github/actions/core-dump'
if: ${{ env.NODE_DEBUG == 'true' && failure() && steps.e2e_tests.conclusion == 'failure' }}

- name: Stop the e2e test environment
run: scripts/run_e2e_env.sh stop
Expand Down Expand Up @@ -296,6 +326,9 @@ jobs:
node-version: ${{matrix.node}}
check-latest: true
cache: yarn
- name: Use Debug Version of Node
uses: './.github/actions/setup-debug-node'
if: env.NODE_DEBUG == 'true'
- name: Restore build cache
id: cache-primes-restore
uses: actions/cache/restore@v3
Expand All @@ -318,15 +351,38 @@ jobs:
- name: Download spec tests
run: yarn download-spec-tests
working-directory: packages/beacon-node

# Run them in different steps to quickly identifying which command failed
# Otherwise just doing `yarn test:spec` you can't tell which specific suite failed
# many of the suites have identical names for minimal and mainnet
# Spec tests with IDs
- name: Spec tests bls-general
run: yarn test:spec-bls-general
id: spec_bls_general
working-directory: packages/beacon-node
run: |
if [ "${{ env.NODE_DEBUG }}" == "true" ]; then
sudo sh -c "ulimit -c unlimited"
fi
yarn test:spec-bls-general
- name: Spec tests minimal
run: yarn test:spec-minimal
id: spec_minimal
working-directory: packages/beacon-node
run: |
if [ "${{ env.NODE_DEBUG }}" == "true" ]; then
sudo sh -c "ulimit -c unlimited"
fi
yarn test:spec-minimal
- name: Spec tests mainnet
run: NODE_OPTIONS='--max-old-space-size=4096' yarn test:spec-mainnet
id: spec_mainnet
working-directory: packages/beacon-node
run: |
if [ "${{ env.NODE_DEBUG }}" == "true" ]; then
sudo sh -c "ulimit -c unlimited"
fi
NODE_OPTIONS='--max-old-space-size=4096' yarn test:spec-mainnet
- uses: './.github/actions/core-dump'
if: ${{ always() && env.NODE_DEBUG == 'true' && (steps.spec_bls_general.outcome == 'failure' || steps.spec_minimal.outcome == 'failure' || steps.spec_mainnet.outcome == 'failure') }}

Loading