Convert the vtest setup action to a Node 24 JavaScript action.
Rename the action path from setup-vtest to vtest and update workflow references.
move VTest execution into the action so Run VTest steps call the action directly
move VTest failure logs and coredump reporting into the action post step
simplify workflow jobs by removing duplicated Show VTest results and Show 
coredumps steps
fix container path issues by using a workspace-relative vtest binary during 
reg-tests
---
 .github/actions/setup-vtest/action.yml | 49 ---------------
 .github/actions/vtest/action.yml       | 11 ++++
 .github/actions/vtest/dist/main.js     | 83 ++++++++++++++++++++++++++
 .github/actions/vtest/dist/post.js     | 54 +++++++++++++++++
 .github/workflows/aws-lc.yml           | 28 +--------
 .github/workflows/fedora-rawhide.yml   | 13 +---
 .github/workflows/openssl-ech.yml      | 33 +---------
 .github/workflows/openssl-master.yml   | 33 +---------
 .github/workflows/quictls.yml          | 28 +--------
 .github/workflows/vtest.yml            | 27 +--------
 .github/workflows/wolfssl.yml          | 28 +--------
 11 files changed, 155 insertions(+), 232 deletions(-)
 delete mode 100644 .github/actions/setup-vtest/action.yml
 create mode 100644 .github/actions/vtest/action.yml
 create mode 100644 .github/actions/vtest/dist/main.js
 create mode 100644 .github/actions/vtest/dist/post.js

diff --git a/.github/actions/setup-vtest/action.yml 
b/.github/actions/setup-vtest/action.yml
deleted file mode 100644
index c6071b473..000000000
--- a/.github/actions/setup-vtest/action.yml
+++ /dev/null
@@ -1,49 +0,0 @@
-name: 'setup VTest'
-description: 'ssss'
-
-runs:
-  using: "composite"
-  steps:
-
-    - name: Setup coredumps
-      if: ${{ runner.os == 'Linux' }}
-      shell: sh
-      run: |
-        sudo mkdir -p /tmp/core
-        sudo sysctl fs.suid_dumpable=1
-        sudo sysctl kernel.core_pattern=/tmp/core/core.%h.%e.%t
-
-    - name: Setup ulimit for core dumps
-      shell: sh
-      run: |
-        # This is required for macOS which does not actually allow to increase
-        # the '-n' soft limit to the hard limit, thus failing to run.
-        ulimit -n 65536
-        ulimit -c unlimited
-
-    - name: Get VTest latest commit SHA
-      id: vtest-sha
-      shell: sh
-      run: |
-        echo "sha=$(git ls-remote https://code.vinyl-cache.org/vtest/VTest2 
HEAD | cut -f1)" >> $GITHUB_OUTPUT
-
-    - name: Cache VTest
-      id: cache-vtest
-      uses: actions/cache@v5
-      with:
-        path: ${{ github.workspace }}/vtest
-        key: vtest-${{ runner.os }}-${{ runner.arch }}-${{ 
steps.vtest-sha.outputs.sha }}
-
-    - name: Install VTest
-      if: ${{ steps.cache-vtest.outputs.cache-hit != 'true' }}
-      shell: sh
-      run: |
-        DESTDIR=${{ github.workspace }}/vtest scripts/build-vtest.sh
-
-    - name: Install problem matcher for VTest
-      shell: sh
-      # This allows one to more easily see which tests fail.
-      run: echo "::add-matcher::.github/vtest.json"
-
-
-
diff --git a/.github/actions/vtest/action.yml b/.github/actions/vtest/action.yml
new file mode 100644
index 000000000..2ebc8eae1
--- /dev/null
+++ b/.github/actions/vtest/action.yml
@@ -0,0 +1,11 @@
+name: vtest
+description: Setup VTest and publish failing VTest logs automatically in a 
post step.
+
+runs:
+  using: node24
+  main: dist/main.js
+  post: dist/post.js
+  post-if: failure()
+
+
+
diff --git a/.github/actions/vtest/dist/main.js 
b/.github/actions/vtest/dist/main.js
new file mode 100644
index 000000000..f797a36df
--- /dev/null
+++ b/.github/actions/vtest/dist/main.js
@@ -0,0 +1,83 @@
+const { execSync } = require('child_process');
+const fs = require('fs');
+const path = require('path');
+
+function run(command, options = {}) {
+  const { ignoreError = false, cwd = process.cwd() } = options;
+
+  try {
+    execSync(command, {
+      cwd,
+      stdio: 'inherit',
+      shell: '/bin/sh'
+    });
+  } catch (error) {
+    if (!ignoreError) {
+      throw error;
+    }
+  }
+}
+
+function setupCoreDumps() {
+  if (process.platform !== 'linux') {
+    return;
+  }
+
+  run('sudo mkdir -p /tmp/core');
+  run('sudo sysctl fs.suid_dumpable=1');
+  run('sudo sysctl kernel.core_pattern=/tmp/core/core.%h.%e.%t');
+}
+
+function setupUlimit() {
+  if (process.platform === 'win32') {
+    return;
+  }
+
+  run('ulimit -n 65536; ulimit -c unlimited');
+}
+
+function installVtest(workspace) {
+  const vtestBin = path.join(workspace, 'vtest', 'vtest');
+  if (fs.existsSync(vtestBin)) {
+    return;
+  }
+
+  run(`DESTDIR="${path.join(workspace, 'vtest')}" scripts/build-vtest.sh`, { 
cwd: workspace });
+}
+
+function addMatcher() {
+  // This allows one to more easily see which tests fail.
+  process.stdout.write('::add-matcher::.github/vtest.json\n');
+}
+
+function shellQuote(value) {
+  return `'${String(value).replace(/'/g, `'"'"'`)}'`;
+}
+
+function runRegtests(workspace) {
+  const vtestProgram = './vtest/vtest';
+  const regtestsTypes = 'default,bug,devel';
+
+  run(
+    `make reg-tests VTEST_PROGRAM=${shellQuote(vtestProgram)} 
REGTESTS_TYPES=${shellQuote(regtestsTypes)}`,
+    { cwd: workspace }
+  );
+}
+
+function main() {
+  const workspace = process.env.GITHUB_WORKSPACE || process.cwd();
+
+  setupCoreDumps();
+  setupUlimit();
+  installVtest(workspace);
+  addMatcher();
+  runRegtests(workspace);
+}
+
+try {
+  main();
+} catch (error) {
+  const message = error && error.message ? error.message : String(error);
+  process.stdout.write(`::error::vtest action failed: ${message}\n`);
+  process.exit(1);
+}
diff --git a/.github/actions/vtest/dist/post.js 
b/.github/actions/vtest/dist/post.js
new file mode 100644
index 000000000..3699c42a2
--- /dev/null
+++ b/.github/actions/vtest/dist/post.js
@@ -0,0 +1,54 @@
+const { execSync } = require('child_process');
+
+function run(command) {
+  execSync(command, {
+    stdio: 'inherit',
+    shell: '/bin/sh'
+  });
+}
+
+function showVtestLogs() {
+  const command = [
+    'for folder in ${TMPDIR:-/tmp}/haregtests-*/vtc.*; do',
+    '  if [ ! -f "$folder/INFO" ] && [ ! -f "$folder/LOG" ]; then',
+    '    continue',
+    '  fi',
+    '  printf "::group::"',
+    '  [ -f "$folder/INFO" ] && cat "$folder/INFO"',
+    '  [ -f "$folder/LOG" ] && cat "$folder/LOG"',
+    '  echo "::endgroup::"',
+    'done'
+  ].join('\n');
+
+  run(command);
+}
+
+function showCoreDumps() {
+  const command = [
+    'HAPROXY_BIN=./haproxy',
+    'for file in /tmp/core/core.* /tmp/core.*; do',
+    '  [ -f "$file" ] || continue',
+    '  printf "::group::"',
+    '  gdb -ex "thread apply all bt full" "$HAPROXY_BIN" "$file" || true',
+    '  echo "::endgroup::"',
+    'done'
+  ].join('\n');
+
+  run(command);
+}
+
+function main() {
+  if (process.platform === 'win32') {
+    return;
+  }
+
+  showVtestLogs();
+  showCoreDumps();
+}
+
+try {
+  main();
+} catch (error) {
+  const message = error && error.message ? error.message : String(error);
+  process.stdout.write(`::warning::vtest post step could not show VTest logs: 
${message}\n`);
+}
diff --git a/.github/workflows/aws-lc.yml b/.github/workflows/aws-lc.yml
index e239fa94f..8509447d9 100644
--- a/.github/workflows/aws-lc.yml
+++ b/.github/workflows/aws-lc.yml
@@ -55,39 +55,13 @@ jobs:
           ldd $(which haproxy)
           haproxy -vv
           echo "version=$(haproxy -vq)" >> $GITHUB_OUTPUT
-      - uses: ./.github/actions/setup-vtest
       - name: Run VTest for HAProxy
         id: vtest
-        run: |
-          make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest 
REGTESTS_TYPES=default,bug,devel
+        uses: ./.github/actions/vtest
       - name: Run Unit tests
         id: unittests
         run: |
           make unit-tests
-      - name: Show VTest results
-        if: ${{ failure() && steps.vtest.outcome == 'failure' }}
-        run: |
-          for folder in ${TMPDIR:-/tmp}/haregtests-*/vtc.*; do
-            printf "::group::"
-            cat $folder/INFO
-            cat $folder/LOG
-            echo "::endgroup::"
-          done
-          exit 1
-      - name: Show coredumps
-        if: ${{ failure() && steps.vtest.outcome == 'failure' }}
-        run: |
-          failed=false
-          shopt -s nullglob
-          for file in /tmp/core.*; do
-            failed=true
-            printf "::group::"
-            gdb -ex 'thread apply all bt full' ./haproxy $file
-            echo "::endgroup::"
-          done
-          if [ "$failed" = true ]; then
-            exit 1;
-          fi
       - name: Show Unit-Tests results
         if: ${{ failure() && steps.unittests.outcome == 'failure' }}
         run: |
diff --git a/.github/workflows/fedora-rawhide.yml 
b/.github/workflows/fedora-rawhide.yml
index 7b8c9a3af..52f145e3f 100644
--- a/.github/workflows/fedora-rawhide.yml
+++ b/.github/workflows/fedora-rawhide.yml
@@ -31,7 +31,6 @@ jobs:
       run: |
         dnf -y install awk diffutils git zlib-devel pcre2-devel 
'perl(FindBin)' perl-IPC-Cmd 'perl(File::Copy)' 'perl(File::Compare)' lua-devel 
socat findutils systemd-devel clang openssl-devel.x86_64 procps-ng
         dnf -y install 'perl(FindBin)' 'perl(File::Compare)' perl-IPC-Cmd 
'perl(File::Copy)' glibc-devel.i686 lua-devel.i686 lua-devel.x86_64 
systemd-devel.i686 zlib-ng-compat-devel.i686 libatomic.i686 openssl-devel.i686 
pcre2-devel.i686
-    - uses: ./.github/actions/setup-vtest
     - name: Compile HAProxy with ${{ matrix.platform.cc }}
       run: |
         make -j3 CC=${{ matrix.platform.cc }} V=1 ERR=1 TARGET=linux-glibc 
DEBUG="-DDEBUG_POOL_INTEGRITY -DDEBUG_UNIT" USE_PROMEX=1 USE_OPENSSL=1 
USE_QUIC=1 USE_ZLIB=1 USE_PCRE2=1 USE_PCRE2_JIT=1 USE_LUA=1 ADDLIB="${{ 
matrix.platform.ADDLIB_ATOMIC }}" ARCH_FLAGS="${{ matrix.platform.ARCH_FLAGS }}"
@@ -53,17 +52,7 @@ jobs:
         update-crypto-policies
     - name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }}
       id: vtest
-      run: |
-        make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest 
REGTESTS_TYPES=default,bug,devel
-    - name: Show VTest results
-      if: ${{ failure() && steps.vtest.outcome == 'failure' }}
-      run: |
-        for folder in ${TMPDIR:-/tmp}/haregtests-*/vtc.*; do
-          printf "::group::"
-          cat $folder/INFO
-          cat $folder/LOG
-          echo "::endgroup::"
-        done
+      uses: ./.github/actions/vtest
     - name: Run Unit tests
       id: unittests
       run: |
diff --git a/.github/workflows/openssl-ech.yml 
b/.github/workflows/openssl-ech.yml
index 0ee3a2273..8538eb744 100644
--- a/.github/workflows/openssl-ech.yml
+++ b/.github/workflows/openssl-ech.yml
@@ -19,7 +19,6 @@ jobs:
           sudo apt-get update -o Acquire::Languages=none -o 
Acquire::Translation=none
           sudo apt-get --no-install-recommends -y install socat gdb
           sudo apt-get --no-install-recommends -y install libpsl-dev
-      - uses: ./.github/actions/setup-vtest
       - name: Install OpenSSL+ECH
         run: env OPENSSL_VERSION="git-feature/ech" GIT_TYPE="branch" 
scripts/build-ssl.sh
       - name: Install curl+ECH
@@ -43,38 +42,8 @@ jobs:
         run: echo "::add-matcher::.github/vtest.json"
       - name: Run VTest for HAProxy
         id: vtest
-        run: |
-          # This is required for macOS which does not actually allow to 
increase
-          # the '-n' soft limit to the hard limit, thus failing to run.
-          ulimit -n 65536
-          # allow to catch coredumps
-          ulimit -c unlimited
-          make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest 
REGTESTS_TYPES=default,bug,devel
-      - name: Show VTest results
-        if: ${{ failure() && steps.vtest.outcome == 'failure' }}
-        run: |
-          for folder in ${TMPDIR:-/tmp}/haregtests-*/vtc.*; do
-            printf "::group::"
-            cat $folder/INFO
-            cat $folder/LOG
-            echo "::endgroup::"
-          done
-          exit 1
+        uses: ./.github/actions/vtest
       - name: Run Unit tests
         id: unittests
         run: |
           make unit-tests
-      - name: Show coredumps
-        if: ${{ failure() && steps.vtest.outcome == 'failure' }}
-        run: |
-          failed=false
-          shopt -s nullglob
-          for file in /tmp/core.*; do
-            failed=true
-            printf "::group::"
-            gdb -ex 'thread apply all bt full' ./haproxy $file
-            echo "::endgroup::"
-          done
-          if [ "$failed" = true ]; then
-            exit 1;
-          fi
diff --git a/.github/workflows/openssl-master.yml 
b/.github/workflows/openssl-master.yml
index ab9d1ca38..b63b44a20 100644
--- a/.github/workflows/openssl-master.yml
+++ b/.github/workflows/openssl-master.yml
@@ -19,7 +19,6 @@ jobs:
           sudo apt-get update -o Acquire::Languages=none -o 
Acquire::Translation=none
           sudo apt-get --no-install-recommends -y install socat gdb
           sudo apt-get --no-install-recommends -y install libpsl-dev
-      - uses: ./.github/actions/setup-vtest
       - name: Install OpenSSL master
         run: env OPENSSL_VERSION="git-master" GIT_TYPE="branch" 
scripts/build-ssl.sh
       - name: Compile HAProxy
@@ -40,38 +39,8 @@ jobs:
         run: echo "::add-matcher::.github/vtest.json"
       - name: Run VTest for HAProxy
         id: vtest
-        run: |
-          # This is required for macOS which does not actually allow to 
increase
-          # the '-n' soft limit to the hard limit, thus failing to run.
-          ulimit -n 65536
-          # allow to catch coredumps
-          ulimit -c unlimited
-          make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest 
REGTESTS_TYPES=default,bug,devel
-      - name: Show VTest results
-        if: ${{ failure() && steps.vtest.outcome == 'failure' }}
-        run: |
-          for folder in ${TMPDIR:-/tmp}/haregtests-*/vtc.*; do
-            printf "::group::"
-            cat $folder/INFO
-            cat $folder/LOG
-            echo "::endgroup::"
-          done
-          exit 1
+        uses: ./.github/actions/vtest
       - name: Run Unit tests
         id: unittests
         run: |
           make unit-tests
-      - name: Show coredumps
-        if: ${{ failure() && steps.vtest.outcome == 'failure' }}
-        run: |
-          failed=false
-          shopt -s nullglob
-          for file in /tmp/core.*; do
-            failed=true
-            printf "::group::"
-            gdb -ex 'thread apply all bt full' ./haproxy $file
-            echo "::endgroup::"
-          done
-          if [ "$failed" = true ]; then
-            exit 1;
-          fi
diff --git a/.github/workflows/quictls.yml b/.github/workflows/quictls.yml
index b662b7347..32825ea36 100644
--- a/.github/workflows/quictls.yml
+++ b/.github/workflows/quictls.yml
@@ -39,36 +39,10 @@ jobs:
           ldd $(which haproxy)
           haproxy -vv
           echo "version=$(haproxy -vq)" >> $GITHUB_OUTPUT
-      - uses: ./.github/actions/setup-vtest
       - name: Run VTest for HAProxy
         id: vtest
-        run: |
-          make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest 
REGTESTS_TYPES=default,bug,devel
-      - name: Show VTest results
-        if: ${{ failure() && steps.vtest.outcome == 'failure' }}
-        run: |
-          for folder in ${TMPDIR:-/tmp}/haregtests-*/vtc.*; do
-            printf "::group::"
-            cat $folder/INFO
-            cat $folder/LOG
-            echo "::endgroup::"
-          done
-          exit 1
+        uses: ./.github/actions/vtest
       - name: Run Unit tests
         id: unittests
         run: |
           make unit-tests
-      - name: Show coredumps
-        if: ${{ failure() && steps.vtest.outcome == 'failure' }}
-        run: |
-          failed=false
-          shopt -s nullglob
-          for file in /tmp/core.*; do
-            failed=true
-            printf "::group::"
-            gdb -ex 'thread apply all bt full' ./haproxy $file
-            echo "::endgroup::"
-          done
-          if [ "$failed" = true ]; then
-            exit 1;
-          fi
diff --git a/.github/workflows/vtest.yml b/.github/workflows/vtest.yml
index fd546d5a7..1b242eaba 100644
--- a/.github/workflows/vtest.yml
+++ b/.github/workflows/vtest.yml
@@ -88,7 +88,6 @@ jobs:
       run: |
         brew install socat
         brew install lua
-    - uses: ./.github/actions/setup-vtest
     - name: Install SSL ${{ matrix.ssl }}
       if: ${{ matrix.ssl && matrix.ssl != 'stock' && 
steps.cache_ssl.outputs.cache-hit != 'true' }}
       run: env ${{ matrix.ssl }} scripts/build-ssl.sh
@@ -127,18 +126,7 @@ jobs:
         echo "version=$(haproxy -vq)" >> $GITHUB_OUTPUT
     - name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }}
       id: vtest
-      run: |
-        make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest 
REGTESTS_TYPES=default,bug,devel
-    - name: Show VTest results
-      if: ${{ failure() && steps.vtest.outcome == 'failure' }}
-      run: |
-        for folder in ${TMPDIR:-/tmp}/haregtests-*/vtc.*; do
-          printf "::group::"
-          cat $folder/INFO
-          cat $folder/LOG
-          echo "::endgroup::"
-        done
-        exit 1
+      uses: ./.github/actions/vtest
     - name: Run Unit tests
       id: unittests
       run: |
@@ -152,16 +140,3 @@ jobs:
           echo "::endgroup::"
         done
         exit 1
-    - name: Show coredumps
-      if: ${{ failure() && steps.vtest.outcome == 'failure' }}
-      run: |
-        failed=false
-        for file in /tmp/core/core.*; do
-          failed=true
-          printf "::group::"
-          gdb -ex 'thread apply all bt full' ./haproxy $file
-          echo "::endgroup::"
-        done
-        if [ "$failed" = true ]; then
-          exit 1;
-        fi
diff --git a/.github/workflows/wolfssl.yml b/.github/workflows/wolfssl.yml
index bf0405c41..ec8e6f4ac 100644
--- a/.github/workflows/wolfssl.yml
+++ b/.github/workflows/wolfssl.yml
@@ -35,39 +35,13 @@ jobs:
           ldd $(which haproxy)
           haproxy -vv
           echo "version=$(haproxy -vq)" >> $GITHUB_OUTPUT
-      - uses: ./.github/actions/setup-vtest
       - name: Run VTest for HAProxy
         id: vtest
-        run: |
-          make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest 
REGTESTS_TYPES=default,bug,devel
+        uses: ./.github/actions/vtest
       - name: Run Unit tests
         id: unittests
         run: |
           make unit-tests
-      - name: Show VTest results
-        if: ${{ failure() && steps.vtest.outcome == 'failure' }}
-        run: |
-          for folder in ${TMPDIR:-/tmp}/haregtests-*/vtc.*; do
-            printf "::group::"
-            cat $folder/INFO
-            cat $folder/LOG
-            echo "::endgroup::"
-          done
-          exit 1
-      - name: Show coredumps
-        if: ${{ failure() && steps.vtest.outcome == 'failure' }}
-        run: |
-          failed=false
-          shopt -s nullglob
-          for file in /tmp/core.*; do
-            failed=true
-            printf "::group::"
-            gdb -ex 'thread apply all bt full' ./haproxy $file
-            echo "::endgroup::"
-          done
-          if [ "$failed" = true ]; then
-            exit 1;
-          fi
       - name: Show Unit-Tests results
         if: ${{ failure() && steps.unittests.outcome == 'failure' }}
         run: |
-- 
2.46.0.windows.1



Reply via email to