Skip to content

Commit cbf9156

Browse files
Update action to run with Node 24 (#79)
* update module type, update tests, and update node version * sanitize
1 parent fdb3766 commit cbf9156

11 files changed

Lines changed: 705 additions & 595 deletions

File tree

.github/workflows/bat.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ jobs:
88
name: Build and Test
99
runs-on: ubuntu-22.04
1010
steps:
11-
- uses: actions/checkout@v5
12-
- uses: actions/setup-node@v5
11+
- uses: actions/checkout@v6
12+
- uses: actions/setup-node@v6
1313
with:
14-
node-version: 20
14+
node-version: 24
1515
- name: Perform npm tasks
1616
run: npm run ci
17-
- uses: actions/upload-artifact@v4
17+
- uses: actions/upload-artifact@v5
1818
with:
1919
name: built-action
2020
path: |

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212
outputs:
1313
tag: ${{ steps.update-package-version.outputs.version }}
1414
steps:
15-
- uses: actions/checkout@v5
15+
- uses: actions/checkout@v6
1616
- name: Configure git
1717
run: |
1818
git config user.name 'Release Action'
1919
git config user.email '<>'
20-
- uses: actions/setup-node@v5
20+
- uses: actions/setup-node@v6
2121
with:
22-
node-version: 20
22+
node-version: 24
2323

2424
# Call `npm version`. It increments the version and commits the changes.
2525
# We'll save the output (new version string) for use in the following

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,5 @@ inputs:
8585
required: false
8686
default: ""
8787
runs:
88-
using: node20
88+
using: node24
8989
main: dist/index.js

jest.config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

jest.config.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
export default {
2+
clearMocks: true,
3+
testEnvironment: "node",
4+
collectCoverage: true,
5+
testMatch: ["**/*.test.ts"],
6+
transform: {
7+
"^.+\\.[jt]s$": [
8+
"ts-jest",
9+
{
10+
useESM: true,
11+
diagnostics: {
12+
ignoreCodes: [151002],
13+
},
14+
},
15+
],
16+
},
17+
extensionsToTreatAsEsm: ['.ts'],
18+
transformIgnorePatterns: ["node_modules/(?!(@actions)/)"],
19+
moduleNameMapper: {
20+
"^(\\.{1,2}/.*)\\.js$": "$1",
21+
},
22+
};

package-lock.json

Lines changed: 663 additions & 572 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"author": "The MathWorks, Inc.",
44
"version": "2.3.1",
55
"description": "",
6+
"type": "module",
67
"main": "lib/index.js",
78
"scripts": {
89
"clean": "rm -rf dist lib",
@@ -11,17 +12,17 @@
1112
"build": "tsc",
1213
"deps": "bash ./scripts/setupdeps.sh",
1314
"package": "ncc build --minify",
14-
"test": "jest",
15+
"test": "NODE_OPTIONS='--experimental-vm-modules' jest",
1516
"all": "npm test && npm run build && npm run package",
1617
"ci": "npm run clean && npm ci && npm run deps && npm run all"
1718
},
1819
"files": [
1920
"lib/"
2021
],
2122
"dependencies": {
22-
"@actions/core": "^1.11.1",
23-
"@actions/exec": "^1.1.1",
24-
"common-utils": "github:matlab-actions/common-utils#v1.0.1"
23+
"@actions/core": "^3.0.0",
24+
"@actions/exec": "^3.0.0",
25+
"common-utils": "github:matlab-actions/common-utils#v2.0.1"
2526
},
2627
"devDependencies": {
2728
"@types/jest": "^30.0.0",
@@ -33,6 +34,7 @@
3334
"jsdom": "^26.1.0",
3435
"prettier": "3.6.2",
3536
"ts-jest": "^29.4.1",
37+
"ts-node": "^10.9.2",
3638
"typescript": "^5.9.2"
3739
}
3840
}

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import * as core from "@actions/core";
44
import * as exec from "@actions/exec";
5-
import * as scriptgen from "./scriptgen";
5+
import * as scriptgen from "./scriptgen.js";
66
import { matlab, testResultsSummary } from "common-utils";
77

88
/**

src/scriptgen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface RunTestsOptions {
3131
*/
3232
export function generateCommand(options: RunTestsOptions): string {
3333
const command = `
34-
addpath('${path.join(__dirname, "scriptgen")}');
34+
addpath('${path.join(import.meta.dirname, "scriptgen")}');
3535
testScript = genscript('Test',
3636
'JUnitTestResults','${options.JUnitTestResults || ""}',
3737
'CoberturaCodeCoverage','${options.CoberturaCodeCoverage || ""}',

src/scriptgen.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2020-2022 The MathWorks, Inc.
22

3-
import * as scriptgen from "./scriptgen";
3+
import * as scriptgen from "./scriptgen.js";
44

55
describe("command generation", () => {
66
it("contains genscript invocation with unspecified options", () => {

0 commit comments

Comments
 (0)