Skip to content

Run Tests

Run Tests #61

Workflow file for this run

name: Run Tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- 'releases/**'
env:
CARGO_NET_GIT_FETCH_WITH_CLI: 'true'
GIT_SSH_COMMAND: 'ssh -o UserKnownHostsFile=/github/home/.ssh/known_hosts -o StrictHostKeyChecking=yes'
jobs:
ci:
name: CI - Node.js ${{ matrix.node-version }} & Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
container:
image: python:${{ matrix.python-version }}-slim
options: --user 0
strategy:
matrix:
node-version: [22, 24]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14-rc']
timeout-minutes: 25
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install base packages
run: |
apt-get update
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gnupg \
git \
openssh-client \
build-essential \
pkg-config \
gdb \
binutils
- name: Setup SSH Agent
uses: webfactory/[email protected]
with:
ssh-private-key: |
${{ secrets.SSH_PRIVATE_KEY }}
${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }}
${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }}
- name: Trust internal SSH host aliases
run: |
set -e
mkdir -p ~/.ssh
chmod 700 ~/.ssh
touch ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
KEY_ENTRY=$(ssh-keyscan github.com 2>/dev/null)
echo "$KEY_ENTRY" >> ~/.ssh/known_hosts
echo "$KEY_ENTRY" | sed 's/^github\.com\([[:space:]]\)/github.com-http-handler\1/' >> ~/.ssh/known_hosts
echo "$KEY_ENTRY" | sed 's/^github\.com\([[:space:]]\)/github.com-http-rewriter\1/' >> ~/.ssh/known_hosts
- uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
- name: Restore cached dependencies
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: node-modules-${{ hashFiles('package.json') }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: Set private package config
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Install dependencies
run: pnpm install
- name: Install Rust toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
# TODO: remove when using published dependency
- name: Build python-node manually
run: |
# Configure git to use SSH host aliases for private repos (needed by cargo)
git config --global url."ssh://[email protected]/platformatic/http-handler".insteadOf "ssh://[email protected]/platformatic/http-handler"
git config --global url."ssh://[email protected]/platformatic/http-handler.git".insteadOf "ssh://[email protected]/platformatic/http-handler.git"
git config --global url."ssh://[email protected]/platformatic/http-rewriter".insteadOf "ssh://[email protected]/platformatic/http-rewriter"
git config --global url."ssh://[email protected]/platformatic/http-rewriter.git".insteadOf "ssh://[email protected]/platformatic/http-rewriter.git"
cd node_modules/@platformatic/python-node
pnpm install --ignore-scripts
pnpm run build
pnpm run build:wasm
pnpm run build:fix
- name: Run isolated debug test
run: |
set -euxo pipefail
export NODE_OPTIONS="--trace-warnings --trace-uncaught --trace-exit --max-old-space-size=4096"
export DEBUG="*"
ulimit -c unlimited
sysctl -w kernel.core_pattern=/tmp/core || true
set +e
node --trace-warnings --trace-uncaught --trace-exit ./test/debug-isolated.js
status=$?
set -e
if [ "$status" -ne 0 ]; then
echo "Isolated debug test failed with status $status"
echo "Searching for core files..."
find . -maxdepth 3 -name 'core*' -ls || true
find /tmp -maxdepth 1 -name 'core*' -ls || true
exit "$status"
fi
- name: Run Full Test Suite
run: |
set -euxo pipefail
export NODE_OPTIONS="--trace-warnings --trace-uncaught --trace-exit --max-old-space-size=4096"
export DEBUG="*"
ulimit -c unlimited
sysctl -w kernel.core_pattern=/tmp/core || true
pnpm test || {
echo "Checking for core dumps..."
find . -maxdepth 3 -name 'core*' -ls || true
find /tmp -maxdepth 1 -name 'core*' -ls || true
exit 1
}
- name: Upload crash dumps
if: failure()
uses: actions/upload-artifact@v4
with:
name: crash-dumps-${{ matrix.node-version }}-${{ matrix.python-version }}
path: |
core*
**/core*
/tmp/core*
if-no-files-found: ignore