Skip to content

Commit

Permalink
Merge a5fd153 into c39e12a
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarhussain authored Nov 30, 2023
2 parents c39e12a + a5fd153 commit fb6dae2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 39 deletions.
9 changes: 6 additions & 3 deletions .github/actions/core-dump/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ description: 'List down and upload core dumps as artifacts'
runs:
using: "composite"
steps:
- run: ls -l
- name: List down core dump files
run: |
ls -lah /cores/
sudo chmod -R +rwx /cores/*
shell: sh

- name: Backup core dump
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: core-dump
path: core.*
path: /cores/*
48 changes: 16 additions & 32 deletions .github/actions/setup-debug-node/action.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,23 @@
name: 'Setup node with debug support'
description: 'Setup the nodejs version with debug support'
inputs:
node-version:
description: 'Version of nodejs'
required: true
default: '20'
debug:
description: Enable the debug version
required: true
default: 'false'

name: "Setup node with debug support"
description: "Setup the nodejs version with debug support"
runs:
using: "composite"
steps:
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
check-latest: true
cache: yarn

# 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
shell: sh
if: ${{ inputs.debug == 'true' }}
- run: sudo cp -f node $(which node)
shell: sh
if: ${{ inputs.debug == 'true' }}
- run: sudo sh -c "ulimit -c unlimited"
- 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
shell: sh
if: ${{ inputs.debug == 'true' }}
- run: sudo sh -c "echo core > /proc/sys/kernel/core_pattern"
shell: sh
if: ${{ inputs.debug == 'true' }}
- run: echo $(node --print "process.version")
# List of naming patterns
# https://man7.org/linux/man-pages/man5/core.5.html
- run: |
sudo mkdir -p /cores
sudo sh -c "echo /cores/core-%e-%s-%u-%g-%p-%t > /proc/sys/kernel/core_pattern"
shell: sh
- run: echo $(node --print "process.features.debug")
- run: |
echo $(/usr/bin/node-with-debug --print "process.version")
echo $(/usr/bin/node-with-debug --print "process.features.debug")
shell: sh

14 changes: 10 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,14 @@ jobs:
node: [20]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn

# Remove when finished debugging core dumps
- uses: './.github/actions/setup-debug-node'
with:
node-version: ${{matrix.node}}
debug: 'true'

- name: Restore build cache
id: cache-primes-restore
Expand All @@ -181,8 +185,10 @@ jobs:

- name: Unit tests
id: unit_tests
run: yarn test:unit
# 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"

# Remove when finished debugging core dumps
- uses: './.github/actions/core-dump'
if: ${{ failure() && steps.unit_tests.conclusion == 'failure' }}

Expand Down

0 comments on commit fb6dae2

Please sign in to comment.