|
| 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 | + name: CI - Node.js ${{ matrix.node-version }} & Python ${{ matrix.python-version }} |
| 17 | + runs-on: ubuntu-latest |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + node-version: |
| 21 | + # Node.js 18 only doesn't work because undici fails on 18 with: |
| 22 | + # |
| 23 | + # /home/runner/work/python/python/node_modules/.pnpm/undici@7.16.0/node_modules/undici/lib/web/webidl/index.js:531 |
| 24 | + # webidl.is.File = webidl.util.MakeTypeAssertion(File) |
| 25 | + # ^ |
| 26 | + # ReferenceError: File is not defined |
| 27 | + # |
| 28 | + # - '18' |
| 29 | + - '20' |
| 30 | + - '22' |
| 31 | + - '24' |
| 32 | + python-version: |
| 33 | + - '3.8' |
| 34 | + - '3.9' |
| 35 | + - '3.10' |
| 36 | + - '3.11' |
| 37 | + - '3.12' |
| 38 | + - '3.13' |
| 39 | + # - '3.14-rc' |
| 40 | + steps: |
| 41 | + - name: Checkout |
| 42 | + uses: actions/checkout@v4 |
| 43 | + - name: Setup SSH Agent |
| 44 | + uses: webfactory/ssh-agent@v0.9.0 |
| 45 | + with: |
| 46 | + ssh-private-key: | |
| 47 | + ${{ secrets.SSH_PRIVATE_KEY }} |
| 48 | + ${{ secrets.HTTP_HANDLER_ACCESS_TOKEN }} |
| 49 | + ${{ secrets.HTTP_REWRITER_ACCESS_TOKEN }} |
| 50 | + - uses: actions/setup-node@v5 |
| 51 | + with: |
| 52 | + node-version: ${{ matrix.node-version }} |
| 53 | + - uses: actions/setup-python@v6 |
| 54 | + with: |
| 55 | + python-version: ${{ matrix.python }} |
| 56 | + - uses: actions/cache@v4 |
| 57 | + with: |
| 58 | + path: ~/.pnpm-store |
| 59 | + key: node-modules-${{ hashFiles('package.json') }} |
| 60 | + - uses: pnpm/action-setup@v4 |
| 61 | + with: |
| 62 | + version: latest |
| 63 | + # Remove when using published dependency |
| 64 | + - name: Set private package config |
| 65 | + run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}" |
| 66 | + env: |
| 67 | + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
| 68 | + - name: Install dependencies |
| 69 | + run: pnpm install |
| 70 | + - uses: dtolnay/rust-toolchain@stable |
| 71 | + with: |
| 72 | + toolchain: stable |
| 73 | + # TODO: replace with plain `pnpm install` when using published dependency |
| 74 | + - name: Build python-node manually |
| 75 | + run: | |
| 76 | + # Configure git to use SSH host aliases for private repos (needed by cargo) |
| 77 | + git config --global url."ssh://git@github.com-http-handler/platformatic/http-handler".insteadOf "ssh://git@github.com/platformatic/http-handler" |
| 78 | + git config --global url."ssh://git@github.com-http-handler/platformatic/http-handler.git".insteadOf "ssh://git@github.com/platformatic/http-handler.git" |
| 79 | + git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter".insteadOf "ssh://git@github.com/platformatic/http-rewriter" |
| 80 | + git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter.git".insteadOf "ssh://git@github.com/platformatic/http-rewriter.git" |
| 81 | +
|
| 82 | + cd node_modules/@platformatic/python-node |
| 83 | + pnpm install --ignore-scripts |
| 84 | + pnpm run build |
| 85 | + pnpm run build:wasm |
| 86 | + pnpm run build:fix |
| 87 | + - name: Run Full Test Suite |
| 88 | + shell: bash |
| 89 | + run: pnpm test |
0 commit comments