Bump node version to 18 (#496)

* try win dns res

* add dns hack to application service tests

* fix unused import

* update types

* add note about why dns resolution order is necessary
This commit is contained in:
Shay 2023-11-14 12:52:53 -08:00 committed by GitHub
parent 7ca748c3c0
commit 8bf628e5bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 34 additions and 11 deletions

View File

@ -17,10 +17,10 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Specifically use node 16 like in the readme. - name: Specifically use node 18 like in the readme.
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: '16' node-version: '18'
- run: yarn install - run: yarn install
- run: yarn build - run: yarn build
- run: yarn lint - run: yarn lint
@ -29,10 +29,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Specifically use node 16 like in the readme. - name: Specifically use node 18 like in the readme.
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: '16' node-version: '18'
- run: yarn install - run: yarn install
- run: yarn test - run: yarn test
integration: integration:
@ -43,7 +43,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: '16' node-version: '18'
- name: Fetch and build mx-tester (cached across runs) - name: Fetch and build mx-tester (cached across runs)
uses: baptiste0928/cargo-install@v1 uses: baptiste0928/cargo-install@v1
with: with:
@ -65,7 +65,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: '16' node-version: '18'
- name: Fetch and build mx-tester (cached across runs) - name: Fetch and build mx-tester (cached across runs)
uses: baptiste0928/cargo-install@v1 uses: baptiste0928/cargo-install@v1
with: with:

View File

@ -1,5 +1,5 @@
# We can't use alpine anymore because crypto has rust deps. # We can't use alpine anymore because crypto has rust deps.
FROM node:16-slim FROM node:18-slim
COPY . /tmp/src COPY . /tmp/src
RUN cd /tmp/src \ RUN cd /tmp/src \
&& yarn install \ && yarn install \

View File

@ -1,5 +1,5 @@
These instructions are to build and run mjolnir without using [Docker](./setup_docker.md). These instructions are to build and run mjolnir without using [Docker](./setup_docker.md).
To build mjolnir, you have to have installed [Node >=16](https://nodejs.org/en/download/), [npm](https://docs.npmjs.com/cli/v7/configuring-npm/install) and [yarn >1.x](https://classic.yarnpkg.com/en/docs/install). To build mjolnir, you have to have installed [Node >=18](https://nodejs.org/en/download/), [npm](https://docs.npmjs.com/cli/v7/configuring-npm/install) and [yarn >1.x](https://classic.yarnpkg.com/en/docs/install).
Copy the latest release tag from https://github.com/matrix-org/mjolnir/releases/latest/ to use when cloning. For example `v1.6.1` - please check the link for the current version as this mentioned example might be outdated. Copy the latest release tag from https://github.com/matrix-org/mjolnir/releases/latest/ to use when cloning. For example `v1.6.1` - please check the link for the current version as this mentioned example might be outdated.

View File

@ -30,7 +30,7 @@
"@types/jsdom": "^16.2.11", "@types/jsdom": "^16.2.11",
"@types/mocha": "^9.0.0", "@types/mocha": "^9.0.0",
"@types/nedb": "^1.8.12", "@types/nedb": "^1.8.12",
"@types/node": "^16.7.10", "@types/node": "^18.0.0",
"@types/pg": "^8.6.5", "@types/pg": "^8.6.5",
"@types/request": "^2.48.8", "@types/request": "^2.48.8",
"@types/shell-quote": "1.7.1", "@types/shell-quote": "1.7.1",
@ -64,6 +64,6 @@
"yaml": "^2.2.2" "yaml": "^2.2.2"
}, },
"engines": { "engines": {
"node": ">=16.0.0" "node": ">=18.0.0"
} }
} }

View File

@ -3,12 +3,16 @@ import { newTestUser } from "../../integration/clientHelper";
import { getFirstReply } from "../../integration/commands/commandUtils"; import { getFirstReply } from "../../integration/commands/commandUtils";
import { MatrixClient } from "matrix-bot-sdk"; import { MatrixClient } from "matrix-bot-sdk";
import { MjolnirAppService } from "../../../src/appservice/AppService"; import { MjolnirAppService } from "../../../src/appservice/AppService";
import dns from 'node:dns';
interface Context extends Mocha.Context { interface Context extends Mocha.Context {
moderator?: MatrixClient, moderator?: MatrixClient,
appservice?: MjolnirAppService appservice?: MjolnirAppService
} }
// Necessary for CI: Node 17+ defaults to using ipv6 first, but Github Actions does not support ipv6
dns.setDefaultResultOrder('ipv4first');
describe("Test that the app service can provision a mjolnir on invite of the appservice bot", function () { describe("Test that the app service can provision a mjolnir on invite of the appservice bot", function () {
afterEach(function(this: Context) { afterEach(function(this: Context) {
this.moderator?.stop(); this.moderator?.stop();

View File

@ -5,6 +5,7 @@ import { CreateMjolnirResponse, MjolnirWebAPIClient } from "../utils/webAPIClien
import { MatrixClient } from "matrix-bot-sdk"; import { MatrixClient } from "matrix-bot-sdk";
import { getFirstReply } from "../../integration/commands/commandUtils"; import { getFirstReply } from "../../integration/commands/commandUtils";
import expect from "expect"; import expect from "expect";
import dns from 'node:dns';
interface Context extends Mocha.Context { interface Context extends Mocha.Context {
@ -12,6 +13,8 @@ interface Context extends Mocha.Context {
moderator?: MatrixClient moderator?: MatrixClient
} }
// Necessary for CI: Node 17+ defaults to using ipv6 first, but Github Actions does not support ipv6
dns.setDefaultResultOrder('ipv4first');
describe("Test that the app service can provision a mjolnir when requested from the web API", function () { describe("Test that the app service can provision a mjolnir when requested from the web API", function () {
afterEach(function(this: Context) { afterEach(function(this: Context) {

View File

@ -1,6 +1,10 @@
import { read as configRead } from "../../src/config"; import { read as configRead } from "../../src/config";
import { makeMjolnir, teardownManagementRoom } from "./mjolnirSetupUtils"; import { makeMjolnir, teardownManagementRoom } from "./mjolnirSetupUtils";
import { register } from "prom-client"; import { register } from "prom-client";
import dns from 'node:dns';
// Necessary for CI: Node 17+ defaults to using ipv6 first, but Github Actions does not support ipv6
dns.setDefaultResultOrder('ipv4first');
// When Mjolnir starts (src/index.ts) it clobbers the config by resolving the management room // When Mjolnir starts (src/index.ts) it clobbers the config by resolving the management room
// alias specified in the config (config.managementRoom) and overwriting that with the room ID. // alias specified in the config (config.managementRoom) and overwriting that with the room ID.

View File

@ -268,11 +268,18 @@
dependencies: dependencies:
"@types/node" "*" "@types/node" "*"
"@types/node@*", "@types/node@^16.7.10": "@types/node@*":
version "16.10.2" version "16.10.2"
resolved "https://registry.npmjs.org/@types/node/-/node-16.10.2.tgz" resolved "https://registry.npmjs.org/@types/node/-/node-16.10.2.tgz"
integrity sha512-zCclL4/rx+W5SQTzFs9wyvvyCwoK9QtBpratqz2IYJ3O8Umrn0m3nsTv0wQBk9sRGpvUe9CwPDrQFB10f1FIjQ== integrity sha512-zCclL4/rx+W5SQTzFs9wyvvyCwoK9QtBpratqz2IYJ3O8Umrn0m3nsTv0wQBk9sRGpvUe9CwPDrQFB10f1FIjQ==
"@types/node@^18.0.0":
version "18.18.9"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.18.9.tgz#5527ea1832db3bba8eb8023ce8497b7d3f299592"
integrity sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==
dependencies:
undici-types "~5.26.4"
"@types/parse5@*": "@types/parse5@*":
version "6.0.1" version "6.0.1"
resolved "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.1.tgz" resolved "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.1.tgz"
@ -3364,6 +3371,11 @@ underscore@~1.4.4:
resolved "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz" resolved "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz"
integrity sha512-ZqGrAgaqqZM7LGRzNjLnw5elevWb5M8LEoDMadxIW3OWbcv72wMMgKdwOKpd5Fqxe8choLD8HN3iSj3TUh/giQ== integrity sha512-ZqGrAgaqqZM7LGRzNjLnw5elevWb5M8LEoDMadxIW3OWbcv72wMMgKdwOKpd5Fqxe8choLD8HN3iSj3TUh/giQ==
undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
universalify@^0.1.2: universalify@^0.1.2:
version "0.1.2" version "0.1.2"
resolved "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz" resolved "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz"