From 841849b937dc6e46843bc8dce7009622200d089a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andri=20M=C3=B6ll?= Date: Thu, 22 Aug 2024 18:40:41 +0000 Subject: [PATCH] Switch from Travis CI to GitHub Actions. --- .github/workflows/node.yaml | 109 ++++++++++++++++++++++++++++++++++++ .npmignore | 3 +- .travis.yml | 89 ----------------------------- README.md | 6 +- 4 files changed, 113 insertions(+), 94 deletions(-) create mode 100644 .github/workflows/node.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/node.yaml b/.github/workflows/node.yaml new file mode 100644 index 0000000..46829a6 --- /dev/null +++ b/.github/workflows/node.yaml @@ -0,0 +1,109 @@ +name: Tests on Node.js +"on": [push, pull_request] + +jobs: + test: + name: Node.js v${{matrix.node}} + runs-on: ubuntu-latest + + strategy: + matrix: + node: + - "0.10" + - "0.11.13" + + # v0.11.14 changed ReadableStream.prototype.resume. Also introduced + # writing binary strings. + - "0.11.14" + - "0.11" + - "0.12" + - "4" + - "5" + - "6.0.0" + - "6.3" + + # v6.4 introduced writing latin1 strings. + - "6.4.0" + - "6" + + # v7 changed the internal _normalizeConnectArgs's function name. + - "7.0.0" + - "7" + - "11.8" + - "8.11" + + # v8.12 revamped parts of HTTP parsing. + - "8.12.0" + - "8" + - "9.5" + + # v9.6 revamped parts of HTTP parsing just like v8.12. + - "9.6.0" + - "9" + + # Node v10 requires InternalSocket.prototype.writev. + - "10.0.0" + - "10.15.0" + + # Node v10.15.1 requires InternalSocket.prototype.shutdown. + - "10.15.1" + - "10" + - "11.0.0" + + # v11.1 changed onStreamRead in stream_base_commons.js to get the + # byte count through a global structure. + - "11.1.0" + + # v11.2 requires InternalSocket.prototype.shutdown. + - "11.2.0" + - "11.7" + + # v11.8 requires InternalSocket.prototype.shutdown to return "0". + - "11.8.0" + - "11" + - "12.0.0" + - "12.3" + + # v12.4 changed decoding the server response buffer to UCS-2 by no + # longer returning a string with 2 little-endian bytes in a String. + # Then again, this could be https://github.com/nodejs/node/pull/27936. + - "12.4" + - "12.16.2" + + # v12.16.3 changed something in InternalSocket.prototype.shutdown or + # possibly WritableStream.prototype.end causing the "close" event to + # not be emitted. + # https://github.com/moll/node-mitm/issues/66 + - "12.16.3" + - "12" + - "13" + - "14" + - "15" + - "16" + - "17" + - "18" + - "19" + - "20" + - "21" + - "22" + + # IO.js required TlsSocket.prototype.getSession. + - "iojs" + - "iojs-v2.4.0" + - "iojs-v3.2.0" + + steps: + - uses: actions/checkout@v3 + + - name: Install Node.js v${{matrix.node}} + uses: actions/setup-node@v3 + with: + node-version: "${{matrix.node}}" + cache: npm + cache-dependency-path: package.json + + - name: Install NPMs + run: npm install --no-package-lock + + - name: Run tests + run: make spec diff --git a/.npmignore b/.npmignore index bb89eb0..408c87f 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,2 @@ /*.tgz -/tags -/.travis.yml +/.github/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 57552ec..0000000 --- a/.travis.yml +++ /dev/null @@ -1,89 +0,0 @@ -language: node_js - -node_js: - - "node" - - "0.10" - - "0.11.13" - - # v0.11.14 changed ReadableStream.prototype.resume. Also introduced writing - # binary strings. - - "0.11.14" - - "0.11" - - "0.12" - - "4" - - "5" - - "6.0.0" - - "6.3" - - # v6.4 introduced writing latin1 strings. - - "6.4.0" - - "6" - - # v7 changed the internal _normalizeConnectArgs's function name. - - "7.0.0" - - "7" - - "11.8" - - "8.11" - - # v8.12 revamped parts of HTTP parsing. - - "8.12.0" - - "8" - - "9.5" - - # v9.6 revamped parts of HTTP parsing just like v8.12. - - "9.6.0" - - "9" - - # Node v10 requires InternalSocket.prototype.writev. - - "10.0.0" - - "10.15.0" - - # Node v10.15.1 requires InternalSocket.prototype.shutdown. - - "10.15.1" - - "10" - - "11.0.0" - - # v11.1 changed onStreamRead in stream_base_commons.js to get the byte count - # through a global structure. - - "11.1.0" - - # v11.2 requires InternalSocket.prototype.shutdown. - - "11.2.0" - - "11.7" - - # v11.8 requires InternalSocket.prototype.shutdown to return "0". - - "11.8.0" - - "11" - - "12.0.0" - - "12.3" - - # v12.4 changed decoding the server response buffer to UCS-2 by no longer - # returning a string with 2 little-endian bytes in a String. - # Then again, this could be https://github.com/nodejs/node/pull/27936. - - "12.4" - - "12.16.2" - - # v12.16.3 changed something in InternalSocket.prototype.shutdown or possibly - # WritableStream.prototype.end causing the "close" event to not be emitted. - # https://github.com/moll/node-mitm/issues/66 - - "12.16.3" - - "12" - - "13" - - "14" - - "15" - - "16" - - # IO.js required TlsSocket.prototype.getSession. - - "iojs" - - "iojs-v2.4.0" - - "iojs-v3.2.0" - -# NPM < v3.10.10 fails with "Error: Missing required argument #1" in -# npm/lib/fetch-package-metadata.js:31:3. -before_install: > - if [[ "$(npm --version)" = 3.* ]] && [[ "$(npm --version)" != 3.10.10 ]]; then - npm install --global npm@3 - fi - -notifications: - email: ["andri@dot.ee"] diff --git a/README.md b/README.md index b461ba2..67c59dd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Mitm.js ======= [![NPM version][npm-badge]](https://www.npmjs.com/package/mitm) -[![Build status][travis-badge]](https://travis-ci.org/moll/node-mitm) +[![Build status][build-badge]](https://github.com/moll/node-mitm/actions/workflows/node.yaml) Mitm.js is a library for Node.js (and Io.js) to **intercept and mock** outgoing network **TCP** and **HTTP** connections. Mitm.js intercepts and gives you @@ -16,7 +16,7 @@ various responses to your code without ever having to hit the real network. **Fast as hell** and **a lot easier to develop with than external test servers**. -Mitm.js works on all Node versions: ancient **v0.10**, **v0.11** and **v0.12** versions, previous and current LTS versions like **v4** to **v12** and the newest **v13** and beyond. For all it has **automated tests** to ensure it will stay that way. +Mitm.js works on all Node versions: ancient **v0.10**, **v0.11** and **v0.12** versions, previous and current LTS versions like **v4** to **v12** and the newest **v22** and beyond. For all it has **automated tests** to ensure it will stay that way. I've developed Mitm.js on a need-to basis for testing [Monday Calendar][monday]'s syncing, so if you find a use-case I haven't come across, @@ -24,7 +24,7 @@ please fling me an [email][email], a [tweet][twitter] or [create an issue][issues] on GitHub. [npm-badge]: https://img.shields.io/npm/v/mitm.svg -[travis-badge]: https://travis-ci.org/moll/node-mitm.svg?branch=master +[build-badge]: https://github.com/moll/js-j6pack/actions/workflows/node.yaml/badge.svg ### Tour - Intercept both **TCP socket connections** (`Net.connect`) and **HTTP