|
| 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 | + strategy: |
| 20 | + matrix: |
| 21 | + node-version: |
| 22 | + - '18' |
| 23 | + - '20' |
| 24 | + - '22' |
| 25 | + - '24' |
| 26 | + python-version: |
| 27 | + - '3.8' |
| 28 | + - '3.9' |
| 29 | + - '3.10' |
| 30 | + - '3.11' |
| 31 | + - '3.12' |
| 32 | + - '3.13' |
| 33 | + - '3.14-rc' |
| 34 | + timeout-minutes: 25 |
| 35 | + steps: |
| 36 | + - name: Checkout |
| 37 | + uses: actions/checkout@v4 |
| 38 | + # - name: Install base packages |
| 39 | + # run: | |
| 40 | + # apt-get update |
| 41 | + # apt-get install -y --no-install-recommends \ |
| 42 | + # bash \ |
| 43 | + # ca-certificates \ |
| 44 | + # curl \ |
| 45 | + # gnupg \ |
| 46 | + # git \ |
| 47 | + # openssh-client \ |
| 48 | + # build-essential \ |
| 49 | + # pkg-config \ |
| 50 | + # gdb \ |
| 51 | + # binutils |
| 52 | + - name: Setup SSH Agent |
| 53 | + uses: webfactory/ssh-agent@v0.9.0 |
| 54 | + with: |
| 55 | + ssh-private-key: | |
| 56 | + ${{ secrets.SSH_PRIVATE_KEY }} |
| 57 | + ${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }} |
| 58 | + ${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }} |
| 59 | + # - name: Trust internal SSH host aliases |
| 60 | + # run: | |
| 61 | + # mkdir -p ~/.ssh |
| 62 | + # chmod 700 ~/.ssh |
| 63 | + # touch ~/.ssh/known_hosts |
| 64 | + # chmod 644 ~/.ssh/known_hosts |
| 65 | + # KEY_ENTRY=$(ssh-keyscan github.com 2>/dev/null) |
| 66 | + # echo "$KEY_ENTRY" >> ~/.ssh/known_hosts |
| 67 | + # echo "$KEY_ENTRY" | sed 's/^github\.com\([[:space:]]\)/github.com-http-handler\1/' >> ~/.ssh/known_hosts |
| 68 | + # echo "$KEY_ENTRY" | sed 's/^github\.com\([[:space:]]\)/github.com-http-rewriter\1/' >> ~/.ssh/known_hosts |
| 69 | + - uses: actions/setup-node@v5 |
| 70 | + with: |
| 71 | + node-version: ${{ matrix.node-version }} |
| 72 | + - uses: actions/setup-python@v6 |
| 73 | + with: |
| 74 | + python-version: ${{ matrix.python }} |
| 75 | + - uses: actions/cache@v4 |
| 76 | + with: |
| 77 | + path: ~/.pnpm-store |
| 78 | + key: node-modules-${{ hashFiles('package.json') }} |
| 79 | + - uses: pnpm/action-setup@v4 |
| 80 | + with: |
| 81 | + version: latest |
| 82 | + - name: Set private package config |
| 83 | + run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}" |
| 84 | + env: |
| 85 | + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
| 86 | + # - name: Configure Python ${{ matrix.python-version }} |
| 87 | + # run: | |
| 88 | + # python --version |
| 89 | + # python -m ensurepip --upgrade |
| 90 | + # python -m pip install --upgrade pip |
| 91 | + # python -m pip --version |
| 92 | + # echo "PYO3_PYTHON=$(which python)" >> $GITHUB_ENV |
| 93 | + - name: Install dependencies |
| 94 | + run: pnpm install |
| 95 | + - uses: dtolnay/rust-toolchain@stable |
| 96 | + with: |
| 97 | + toolchain: stable |
| 98 | + # - name: Install Rust toolchain |
| 99 | + # run: | |
| 100 | + # curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 101 | + # echo "$HOME/.cargo/bin" >> $GITHUB_PATH |
| 102 | + # TODO: remove when using published dependency |
| 103 | + - name: Build python-node manually |
| 104 | + run: | |
| 105 | + # Configure git to use SSH host aliases for private repos (needed by cargo) |
| 106 | + git config --global url."ssh://git@github.com-http-handler/platformatic/http-handler".insteadOf "ssh://git@github.com/platformatic/http-handler" |
| 107 | + git config --global url."ssh://git@github.com-http-handler/platformatic/http-handler.git".insteadOf "ssh://git@github.com/platformatic/http-handler.git" |
| 108 | + git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter".insteadOf "ssh://git@github.com/platformatic/http-rewriter" |
| 109 | + git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter.git".insteadOf "ssh://git@github.com/platformatic/http-rewriter.git" |
| 110 | +
|
| 111 | + cd node_modules/@platformatic/python-node |
| 112 | + pnpm install --ignore-scripts |
| 113 | + pnpm run build |
| 114 | + pnpm run build:wasm |
| 115 | + pnpm run build:fix |
| 116 | + - name: Run Full Test Suite |
| 117 | + shell: bash |
| 118 | + run: pnpm test |
0 commit comments