Skip to content

Commit

Permalink
[IST-487] [MABL-8300] Dependency Updates, Optimize for Node.js 16 Act…
Browse files Browse the repository at this point in the history
…ions (#18)
  • Loading branch information
twistedpair authored Oct 21, 2022
1 parent 6b9e148 commit d23d55e
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 182 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/push-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04, macos-latest, windows-latest ]
os:
- ubuntu-18.04
- ubuntu-20.04
- ubuntu-latest
- macos-latest
- windows-2019
- windows-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '12.x'
# Use the minimum supported mabl-cli Node.js LTS version here
node-version: '14.x'

- name: Install dependencies
run: npm ci
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
steps:
- uses: actions/setup-node@v2
with:
node-version: '12.x'
node-version: '16.x'
- uses: mablhq/setup-mabl-cli@v1
with:
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
steps:
- uses: actions/setup-node@v2
with:
node-version: '12.x'
node-version: '16.x'
- uses: mablhq/setup-mabl-cli@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ inputs:
description: (optional) The id of the workspace to configure as default for the CLI
required: false
runs:
using: "node12"
using: "node16"
main: "lib/index.js"
210 changes: 49 additions & 161 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-mabl-cli",
"version": "1.3.0",
"version": "1.4.0",
"description": "mabl GitHub action to setup mabl CLI",
"main": "lib/index.js",
"scripts": {
Expand All @@ -10,15 +10,15 @@
},
"author": "mablhq",
"dependencies": {
"@actions/core": "^1.2.6",
"@actions/exec": "^1.0.4",
"@actions/tool-cache": "^1.6.1",
"@types/es6-promise": "^3.3.0"
"@actions/core": "1.10.0",
"@actions/exec": "1.1.1",
"@actions/tool-cache": "2.0.1"
},
"devDependencies": {
"@types/mocha": "^5.2.7",
"@types/node": "^12.20.4",
"@types/q": "^1.5.4",
"typescript": "^4.1.4"
"@types/es6-promise": "3.3.0",
"@types/mocha": "10.0.0",
"@types/node": "16.11.68",
"@types/q": "1.5.5",
"typescript": "4.8.4"
}
}
19 changes: 16 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import * as toolCache from '@actions/tool-cache';

type Option<T> = T | undefined;

const REQUIRED_NODEJS_MAJOR_VERSION = 14;

async function run(): Promise<void> {
const version: Option<string> = core.getInput('version', {required: false});
// Allow new or old syntax - some docs said 'workspace', others said 'workspace_id'
Expand Down Expand Up @@ -79,13 +81,24 @@ async function configureWorkspace(

async function findNode(): Promise<Option<string>> {
const allNodeVersions = await toolCache.findAllVersions('node');
if (!(allNodeVersions && allNodeVersions[0])) {
const nodeTargetVersion = allNodeVersions
.filter((version: string) => version.startsWith(`${REQUIRED_NODEJS_MAJOR_VERSION}.`))?.[0];

// If Node is installed, but the required version isn't, mark as a failure
if(allNodeVersions && allNodeVersions.length > 0 && !nodeTargetVersion) {
core.warning(
`Could not find required Node.js version ${REQUIRED_NODEJS_MAJOR_VERSION}.x installed. This install will fallback to an unsupported version which may not function correctly.`,
);
}

const nodeVersion = nodeTargetVersion ?? allNodeVersions[0];

if (!(allNodeVersions && nodeVersion)) {
core.setFailed(
'No node version installed. Please add a "actions/setup-node" step to your workflow or install a node version some other way.',
'No Node.js version installed. Please add a "actions/setup-node" step to your workflow or install a Node.js version some other way.',
);
return;
}
const nodeVersion = allNodeVersions[0];
core.info(`Found node version ${nodeVersion}. Installing mabl CLI`);

return toolCache.find('node', nodeVersion);
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compilerOptions": {
/* Basic Options */
"target": "es2016" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"target": "es2021" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"lib": ["es2015"], // "lib": [], /* Specify library files to be included in the compilation. */
"lib": ["es2021"], // "lib": [], /* Specify library files to be included in the compilation. */

// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
Expand Down

0 comments on commit d23d55e

Please sign in to comment.