|
| 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 | + GIT_SSH_COMMAND: 'ssh -o UserKnownHostsFile=/github/home/.ssh/known_hosts -o StrictHostKeyChecking=yes' |
| 14 | + |
| 15 | +jobs: |
| 16 | + ci: |
| 17 | + name: CI - Node.js ${{ matrix.node-version }} & Python ${{ matrix.python-version }} |
| 18 | + runs-on: ubuntu-latest |
| 19 | + container: |
| 20 | + image: python:${{ matrix.python-version }}-slim |
| 21 | + options: --user 0 |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + node-version: [22, 24] |
| 25 | + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14-rc'] |
| 26 | + timeout-minutes: 25 |
| 27 | + steps: |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v4 |
| 30 | + - name: Install base packages |
| 31 | + run: | |
| 32 | + set -euxo pipefail |
| 33 | + export DEBIAN_FRONTEND=noninteractive |
| 34 | + apt-get update |
| 35 | + apt-get install -y --no-install-recommends \ |
| 36 | + ca-certificates \ |
| 37 | + curl \ |
| 38 | + gnupg \ |
| 39 | + git \ |
| 40 | + openssh-client \ |
| 41 | + build-essential \ |
| 42 | + pkg-config \ |
| 43 | + gdb \ |
| 44 | + binutils |
| 45 | + - name: Setup SSH Agent |
| 46 | + uses: webfactory/ssh-agent@v0.9.0 |
| 47 | + with: |
| 48 | + ssh-private-key: | |
| 49 | + ${{ secrets.SSH_PRIVATE_KEY }} |
| 50 | + ${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }} |
| 51 | + ${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }} |
| 52 | + - name: Trust internal SSH host aliases |
| 53 | + run: | |
| 54 | + set -e |
| 55 | + mkdir -p ~/.ssh |
| 56 | + chmod 700 ~/.ssh |
| 57 | + touch ~/.ssh/known_hosts |
| 58 | + chmod 644 ~/.ssh/known_hosts |
| 59 | + KEY_ENTRY=$(ssh-keyscan github.com 2>/dev/null) |
| 60 | + echo "$KEY_ENTRY" >> ~/.ssh/known_hosts |
| 61 | + echo "$KEY_ENTRY" | sed 's/^github\.com\([[:space:]]\)/github.com-http-handler\1/' >> ~/.ssh/known_hosts |
| 62 | + echo "$KEY_ENTRY" | sed 's/^github\.com\([[:space:]]\)/github.com-http-rewriter\1/' >> ~/.ssh/known_hosts |
| 63 | + - uses: actions/setup-node@v5 |
| 64 | + with: |
| 65 | + node-version: ${{ matrix.node-version }} |
| 66 | + - name: Restore cached dependencies |
| 67 | + uses: actions/cache@v4 |
| 68 | + with: |
| 69 | + path: ~/.pnpm-store |
| 70 | + key: node-modules-${{ hashFiles('package.json') }} |
| 71 | + - name: Setup pnpm |
| 72 | + uses: pnpm/action-setup@v4 |
| 73 | + with: |
| 74 | + version: latest |
| 75 | + - name: Set private package config |
| 76 | + run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}" |
| 77 | + env: |
| 78 | + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
| 79 | + - name: Install dependencies |
| 80 | + run: pnpm install |
| 81 | + - name: Install Rust toolchain |
| 82 | + run: | |
| 83 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 84 | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH |
| 85 | + # TODO: remove when using published dependency |
| 86 | + - name: Build python-node manually |
| 87 | + run: | |
| 88 | + # Configure git to use SSH host aliases for private repos (needed by cargo) |
| 89 | + git config --global url."ssh://git@github.com-http-handler/platformatic/http-handler".insteadOf "ssh://git@github.com/platformatic/http-handler" |
| 90 | + git config --global url."ssh://git@github.com-http-handler/platformatic/http-handler.git".insteadOf "ssh://git@github.com/platformatic/http-handler.git" |
| 91 | + git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter".insteadOf "ssh://git@github.com/platformatic/http-rewriter" |
| 92 | + git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter.git".insteadOf "ssh://git@github.com/platformatic/http-rewriter.git" |
| 93 | +
|
| 94 | + cd node_modules/@platformatic/python-node |
| 95 | + pnpm install --ignore-scripts |
| 96 | + pnpm run build |
| 97 | + pnpm run build:wasm |
| 98 | + pnpm run build:fix |
| 99 | + - name: Run Full Test Suite (if isolated test passes) |
| 100 | + run: pnpm test |
0 commit comments