Run Tests #71
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 \ | |
| bash \ | |
| ca-certificates \ | |
| curl \ | |
| gnupg \ | |
| git \ | |
| openssh-client \ | |
| build-essential \ | |
| pkg-config \ | |
| gdb \ | |
| binutils | |
| - name: Setup SSH Agent | |
| uses: webfactory/ssh-agent@v0.9.0 | |
| 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: Configure Python ${{ matrix.python-version }} | |
| run: | | |
| set -euxo pipefail | |
| python --version | |
| python -m ensurepip --upgrade | |
| python -m pip install --upgrade pip | |
| python -m pip --version | |
| echo "PYO3_PYTHON=$(which python)" >> $GITHUB_ENV | |
| - 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://git@github.com-http-handler/platformatic/http-handler".insteadOf "ssh://git@github.com/platformatic/http-handler" | |
| git config --global url."ssh://git@github.com-http-handler/platformatic/http-handler.git".insteadOf "ssh://git@github.com/platformatic/http-handler.git" | |
| git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter".insteadOf "ssh://git@github.com/platformatic/http-rewriter" | |
| git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter.git".insteadOf "ssh://git@github.com/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 | |
| shell: bash | |
| 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 | |
| rm -rf core-dumps | |
| mkdir -p core-dumps | |
| 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 5 -type f -name 'core*' \ | |
| ! -path './core-dumps/*' \ | |
| ! -path './proc/*' \ | |
| -print -exec cp -f {} core-dumps/ \; || true | |
| find /tmp -maxdepth 1 -type f -name 'core*' \ | |
| ! -path '/tmp/core-dumps/*' \ | |
| -print -exec cp -f {} core-dumps/ \; || true | |
| echo "Reproducing crash under gdb for stack trace..." | |
| gdb --batch \ | |
| -ex "set pagination off" \ | |
| -ex "run" \ | |
| -ex "thread apply all bt" \ | |
| -ex "generate-core-file core-dumps/core-gdb" \ | |
| --args node --trace-warnings --trace-uncaught --trace-exit ./test/debug-isolated.js || true | |
| exit "$status" | |
| fi | |
| - name: Run Full Test Suite | |
| shell: bash | |
| 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 5 -type f -name 'core*' \ | |
| ! -path './core-dumps/*' \ | |
| ! -path './proc/*' \ | |
| -print -exec cp -f {} core-dumps/ \; || true | |
| find /tmp -maxdepth 1 -type f -name 'core*' \ | |
| ! -path '/tmp/core-dumps/*' \ | |
| -print -exec cp -f {} core-dumps/ \; || true | |
| echo "Reproducing crash under gdb for stack trace..." | |
| gdb --batch \ | |
| -ex "set pagination off" \ | |
| -ex "run" \ | |
| -ex "thread apply all bt" \ | |
| -ex "generate-core-file core-dumps/core-gdb" \ | |
| --args node --trace-warnings --trace-uncaught --trace-exit ./test/debug-isolated.js || 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-dumps | |
| if-no-files-found: warn |