Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump node version to 18 #496

Merged
merged 5 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/mjolnir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
steps:
- 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
with:
node-version: '16'
node-version: '18'
- run: yarn install
- run: yarn build
- run: yarn lint
Expand All @@ -29,10 +29,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- 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
with:
node-version: '16'
node-version: '18'
- run: yarn install
- run: yarn test
integration:
Expand All @@ -43,7 +43,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'
- name: Fetch and build mx-tester (cached across runs)
uses: baptiste0928/cargo-install@v1
with:
Expand All @@ -65,7 +65,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'
- name: Fetch and build mx-tester (cached across runs)
uses: baptiste0928/cargo-install@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# We can't use alpine anymore because crypto has rust deps.
FROM node:16-slim
FROM node:18-slim
COPY . /tmp/src
RUN cd /tmp/src \
&& yarn install \
Expand Down
2 changes: 1 addition & 1 deletion docs/setup_selfbuild.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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.

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@types/jsdom": "^16.2.11",
"@types/mocha": "^9.0.0",
"@types/nedb": "^1.8.12",
"@types/node": "^16.7.10",
"@types/node": "^18.0.0",
"@types/pg": "^8.6.5",
"@types/request": "^2.48.8",
"@types/shell-quote": "1.7.1",
Expand Down Expand Up @@ -64,6 +64,6 @@
"yaml": "^2.2.2"
},
"engines": {
"node": ">=16.0.0"
"node": ">=18.0.0"
}
}
4 changes: 4 additions & 0 deletions test/appservice/integration/provisionTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ import { newTestUser } from "../../integration/clientHelper";
import { getFirstReply } from "../../integration/commands/commandUtils";
import { MatrixClient } from "matrix-bot-sdk";
import { MjolnirAppService } from "../../../src/appservice/AppService";
import dns from 'node:dns';

interface Context extends Mocha.Context {
moderator?: MatrixClient,
appservice?: MjolnirAppService
}

// Necessary for CI: Node 17+ defaults to using ipv6 first, but Github Actions does not support ipv6
dns.setDefaultResultOrder('ipv4first');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed because apparently node 17+ defaults to IVP6 but GH actions doesn't support IPV6 - see discussion at https://github.com/matrix-org/conference-bot/pull/186/files/85059d8f92ddcfb80657a58f60ef891ce704dfec..723a939d4726aa9de86fae0693137d78674154cb
this caused me a lot of pain until I figured it out...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what a nightmare, and weird that it tries to do that...

We should put a similar comment from the conference bot's code here too, for when we inevitably try to remove it by accident. Likewise on the other files.

describe("Test that the app service can provision a mjolnir on invite of the appservice bot", function () {
afterEach(function(this: Context) {
this.moderator?.stop();
Expand Down
3 changes: 3 additions & 0 deletions test/appservice/integration/webAPITest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ import { CreateMjolnirResponse, MjolnirWebAPIClient } from "../utils/webAPIClien
import { MatrixClient } from "matrix-bot-sdk";
import { getFirstReply } from "../../integration/commands/commandUtils";
import expect from "expect";
import dns from 'node:dns';


interface Context extends Mocha.Context {
appservice?: MjolnirAppService
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 () {
afterEach(function(this: Context) {
Expand Down
4 changes: 4 additions & 0 deletions test/integration/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { read as configRead } from "../../src/config";
import { makeMjolnir, teardownManagementRoom } from "./mjolnirSetupUtils";
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
// alias specified in the config (config.managementRoom) and overwriting that with the room ID.
Expand Down
14 changes: 13 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,18 @@
dependencies:
"@types/node" "*"

"@types/node@*", "@types/node@^16.7.10":
"@types/node@*":
version "16.10.2"
resolved "https://registry.npmjs.org/@types/node/-/node-16.10.2.tgz"
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@*":
version "6.0.1"
resolved "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.1.tgz"
Expand Down Expand Up @@ -3364,6 +3371,11 @@ underscore@~1.4.4:
resolved "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz"
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:
version "0.1.2"
resolved "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz"
Expand Down
Loading