|
| 1 | +name: Run Tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + - 'releases/**' |
| 10 | + |
| 11 | +env: |
| 12 | + CARGO_NET_GIT_FETCH_WITH_CLI: 'true' |
| 13 | + |
| 14 | +jobs: |
| 15 | + ci: |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + node-version: [22, 24] |
| 19 | + os: [ubuntu-latest] |
| 20 | + runs-on: ${{matrix.os}} |
| 21 | + timeout-minutes: 10 |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v4 |
| 25 | + - name: Setup SSH Agent |
| 26 | + uses: webfactory/ssh-agent@v0.9.0 |
| 27 | + with: |
| 28 | + ssh-private-key: | |
| 29 | + ${{ secrets.SSH_PRIVATE_KEY }} |
| 30 | + ${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }} |
| 31 | + ${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }} |
| 32 | + - name: Use supported Node.js Version |
| 33 | + uses: actions/setup-node@v4 |
| 34 | + with: |
| 35 | + node-version: ${{ matrix.node-version }} |
| 36 | + # - name: Restore cached dependencies |
| 37 | + # uses: actions/cache@v4 |
| 38 | + # with: |
| 39 | + # path: ~/.pnpm-store |
| 40 | + # key: node-modules-${{ hashFiles('package.json') }} |
| 41 | + - name: Setup pnpm |
| 42 | + uses: pnpm/action-setup@v4 |
| 43 | + with: |
| 44 | + version: latest |
| 45 | + - name: Set private package config |
| 46 | + run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}" |
| 47 | + env: |
| 48 | + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
| 49 | + - name: Install dependencies |
| 50 | + run: pnpm install |
| 51 | + - name: Install Python and dependencies |
| 52 | + run: | |
| 53 | + # Ensure Python and dev headers are available |
| 54 | + sudo apt-get update |
| 55 | + sudo apt-get install -y python3 python3-dev python3-pip gdb binutils |
| 56 | + python3 --version |
| 57 | + # TODO: remove when using published dependency |
| 58 | + - name: Build python-node manually |
| 59 | + run: | |
| 60 | + # Configure git to use SSH host aliases for private repos (needed by cargo) |
| 61 | + git config --global url."ssh://git@github.com-http-handler/platformatic/http-handler".insteadOf "ssh://git@github.com/platformatic/http-handler" |
| 62 | + git config --global url."ssh://git@github.com-http-handler/platformatic/http-handler.git".insteadOf "ssh://git@github.com/platformatic/http-handler.git" |
| 63 | + git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter".insteadOf "ssh://git@github.com/platformatic/http-rewriter" |
| 64 | + git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter.git".insteadOf "ssh://git@github.com/platformatic/http-rewriter.git" |
| 65 | +
|
| 66 | + cd node_modules/@platformatic/python-node |
| 67 | + pnpm install --ignore-scripts |
| 68 | + pnpm run build |
| 69 | + pnpm run build:wasm |
| 70 | + pnpm run build:fix |
| 71 | + - name: Run Isolated Debug Test |
| 72 | + run: | |
| 73 | + # Enable verbose Node.js debugging and core dumps |
| 74 | + export NODE_OPTIONS="--trace-warnings --trace-uncaught --trace-exit --max-old-space-size=4096" |
| 75 | + export DEBUG="*" |
| 76 | + ulimit -c unlimited |
| 77 | +
|
| 78 | + # Set up core dump pattern (needs to be a path, not pattern) |
| 79 | + sudo sysctl -w kernel.core_pattern=/tmp/core |
| 80 | + echo "Core dump pattern set to: $(cat /proc/sys/kernel/core_pattern)" |
| 81 | +
|
| 82 | + # Show python-node module info |
| 83 | + echo "Python-node module contents:" |
| 84 | + ls -la node_modules/@platformatic/python-node/ |
| 85 | +
|
| 86 | + # Show environment info |
| 87 | + echo "Node.js version: $(node --version)" |
| 88 | + echo "Python version: $(python3 --version)" |
| 89 | + echo "Architecture: $(uname -m)" |
| 90 | + echo "Kernel: $(uname -r)" |
| 91 | + echo "Working directory: $(pwd)" |
| 92 | + echo "Test file exists: $(ls -la test/debug-isolated.js 2>/dev/null || echo 'NOT FOUND')" |
| 93 | +
|
| 94 | + # Run isolated test with maximum verbosity |
| 95 | + echo "Running isolated test..." |
| 96 | + echo "Package.json type field: $(grep '"type"' package.json || echo 'not found')" |
| 97 | + echo "Current directory files:" |
| 98 | + ls -la |
| 99 | + echo "Test directory files:" |
| 100 | + ls -la test/ |
| 101 | +
|
| 102 | + # Try to run the test |
| 103 | + if [ -f "./test/debug-isolated.js" ]; then |
| 104 | + echo "Found test file, running with Node.js ES modules..." |
| 105 | + node --trace-warnings --trace-uncaught --trace-exit ./test/debug-isolated.js |
| 106 | + else |
| 107 | + echo "Test file not found!" |
| 108 | + exit 1 |
| 109 | + fi |
| 110 | +
|
| 111 | + # Check for core dumps |
| 112 | + echo "Checking for core dumps..." |
| 113 | + ls -la /tmp/core* 2>/dev/null || echo "No core dumps found" |
| 114 | + - name: Upload crash dumps |
| 115 | + if: failure() |
| 116 | + uses: actions/upload-artifact@v4 |
| 117 | + with: |
| 118 | + name: crash-dumps-${{ matrix.node-version }}-${{ matrix.os }} |
| 119 | + path: /tmp/core* |
| 120 | + if-no-files-found: ignore |
| 121 | + - name: Run Full Test Suite (if isolated test passes) |
| 122 | + if: success() |
| 123 | + run: pnpm test |
0 commit comments