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

update node version (v18, v20, v22) #833

Merged
merged 31 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f857884
chore: move from ts-node to swc-loader
doc-han Nov 29, 2024
33f777d
ci: update CI to run tests for v18,v20,v22
doc-han Nov 29, 2024
1222c9c
fix: several tests & mocks
doc-han Nov 29, 2024
fc2e5e1
fix: resolve mock-fs
doc-han Dec 12, 2024
4cfd339
test: collection tests & flaky test
doc-han Dec 12, 2024
576b55e
tests: fix date output in integration test
josephjclark Dec 13, 2024
3c392a7
set node 22 and setup corepack on pnpm8
josephjclark Dec 16, 2024
f18bba5
update integration test matrix and use corepack
josephjclark Dec 16, 2024
1a125c2
fix yaml
josephjclark Dec 16, 2024
776707f
fix ndoe versions
josephjclark Dec 16, 2024
d602685
worker: bump image to node 22
josephjclark Dec 16, 2024
aa609c8
cli: type fix
josephjclark Dec 16, 2024
8ee83f1
compiler: update test fixture with trivial diff
josephjclark Dec 16, 2024
f0b3ed4
tests: tweak test matrix
josephjclark Dec 16, 2024
8904af2
runtime: await module import properly
josephjclark Dec 17, 2024
10a435e
cli: fix failing unit test
josephjclark Dec 17, 2024
8aa6bdd
cli: skipped tests that are broken by mock fs
josephjclark Dec 17, 2024
f701e60
cli: try to make docgen test a bit more stable in CI
josephjclark Dec 17, 2024
4913d36
cli: another attempt to stabilze docgen
josephjclark Dec 17, 2024
1158256
cli: give up and skip the flaky test
josephjclark Dec 17, 2024
8dc6edc
cli: skip another flaky test
josephjclark Dec 17, 2024
5ccc331
tests: remove logging
josephjclark Dec 17, 2024
5b2d9ad
compiler: remove .only
josephjclark Dec 17, 2024
5f15e1c
versions: [email protected] [email protected]
josephjclark Dec 17, 2024
3f5b10f
worker: fix version number output
josephjclark Dec 17, 2024
851b5cc
version: @openfn/[email protected]
josephjclark Dec 17, 2024
306e049
worker: typing
josephjclark Dec 17, 2024
4df5e77
worker: fix package.json resolution
josephjclark Dec 17, 2024
a053528
worker: typings
josephjclark Dec 17, 2024
fb670c0
engine: update package json importer
josephjclark Dec 17, 2024
dff4ed5
version: [email protected]
josephjclark Dec 17, 2024
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
4 changes: 2 additions & 2 deletions packages/ws-worker/src/channels/worker-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { Socket as PhxSocket } from 'phoenix';
import { WebSocket } from 'ws';
import { API_VERSION } from '@openfn/lexicon/lightning';
import generateWorkerToken from '../util/worker-token';
import version from '../util/load-version';

import type { Logger } from '@openfn/logger';
import type { Channel } from '../types';
import loadVersions from '../util/load-versions';

const connectToWorkerQueue = (
endpoint: string,
Expand All @@ -22,7 +22,7 @@ const connectToWorkerQueue = (
const params = {
token,
api_version: API_VERSION,
worker_version: loadVersions().engine,
worker_version: version,
};

// @ts-ignore ts doesn't like the constructor here at all
Expand Down
4 changes: 2 additions & 2 deletions packages/ws-worker/src/events/run-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { sendEvent, Context, onJobLog } from '../api/execute';
import calculateVersionString from '../util/versions';

import { timeInMicroseconds } from '../util';
import loadVersions from '../util/load-versions';
import version from '../util/load-version';

export default async function onRunStart(
context: Context,
Expand All @@ -31,7 +31,7 @@ export default async function onRunStart(
};

const versions = {
worker: loadVersions().engine,
worker: version,
...event.versions,
};

Expand Down
12 changes: 12 additions & 0 deletions packages/ws-worker/src/util/load-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import fs from 'fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const pkg = JSON.parse(
fs.readFileSync(
path.join(fileURLToPath(import.meta.url), '../../../package.json'),
'utf-8'
)
);

export default pkg.version;
11 changes: 0 additions & 11 deletions packages/ws-worker/src/util/load-versions.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/ws-worker/test/channels/worker-queue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { API_VERSION } from '@openfn/lexicon/lightning';

import connectToWorkerQueue from '../../src/channels/worker-queue';
import { MockSocket } from '../../src/mock/sockets';
import loadVersions from '../../src/util/load-versions';
import loadVersions from '../../src/util/load-version';

const logger = createMockLogger();

Expand Down
13 changes: 10 additions & 3 deletions packages/ws-worker/test/events/run-start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createRunState } from '../../src/util';
import { RUN_LOG, RUN_START } from '../../src/events';

import { timestamp } from '@openfn/logger';
import loadVersions from '../../src/util/load-versions';
import version from '../../src/util/load-version';

test('should include a timestamp', async (t) => {
const plan = {
Expand Down Expand Up @@ -69,7 +69,7 @@ test('run:start event should include versions', async (t) => {
[RUN_START]: (evt) => {
t.deepEqual(evt.versions, {
...versions,
worker: loadVersions().engine,
worker: version,
});
return true;
},
Expand All @@ -91,12 +91,18 @@ test('run:start should log the version number', async (t) => {
const input = 'abc';
const jobId = 'job-1';

// explicitly load package.json her
// because load-version does it a bit differently
const { default: pkg } = await import('../../package.json', {
with: { type: 'json' },
});

const versions = {
node: process.version.substring(1),
engine: '1.0.0',
compiler: '1.0.0',
runtime: '1.0.0',
worker: loadVersions().engine,
worker: pkg.version,
'@openfn/language-common': ['1.0.0'],
};

Expand Down Expand Up @@ -130,4 +136,5 @@ test('run:start should log the version number', async (t) => {
// This just a light test of the string to make sure it's here
// It uses src/util/versions, which is tested elsewhere
t.regex(message, /(node\.js).+(worker).+(@openfn\/language-common)/is);
t.regex(message, new RegExp(`worker(\\s+)${pkg.version}`, 'is'));
});