-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(mojaloop/#3475): NodeJS version upgrade
chore(mojaloop/#3475): NodeJS version upgrade - mojaloop/project#3475 - Upgraded nodejs from v16 to v18 LTS - Applied CI changes as previously implemented in [sdk-scheme-adapter](mojaloop/sdk-scheme-adapter#453) - Updated NPM dependencies - Re-implement husky integration due to API changes in husky's latest version - Replaced deprecated `ttypescript` with `ts-patch` to allow for `typescript` upgrade - Resolved all audit issues
- Loading branch information
Showing
16 changed files
with
6,094 additions
and
9,279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,26 +7,29 @@ version: 2.1 | |
# Orbs used in this pipeline | ||
## | ||
orbs: | ||
slack: circleci/slack@4.9.3 # Ref: https://github.com/mojaloop/ci-config/tree/master/slack-templates | ||
slack: circleci/slack@4.12.5 # Ref: https://github.com/mojaloop/ci-config/tree/master/slack-templates | ||
pr-tools: mojaloop/[email protected] # Ref: https://github.com/mojaloop/ci-config/ | ||
gh: circleci/[email protected] | ||
|
||
## | ||
# defaults | ||
# | ||
# YAML defaults templates, in alphabetical order | ||
# YAML defaults templates | ||
## | ||
defaults_Dependencies: &defaults_Dependencies | | ||
apk --no-cache add git | ||
apk --no-cache add ca-certificates | ||
apk --no-cache add curl | ||
apk --no-cache add openssh-client | ||
apk add --no-cache -t build-dependencies make gcc g++ python3 libtool autoconf automake jq | ||
npm config set unsafe-perm true | ||
npm install -g node-gyp | ||
|
||
## Default 'default-docker' executor dependencies | ||
defaults_docker_Dependencies: &defaults_docker_Dependencies | | ||
apk --no-cache add coreutils | ||
apk --no-cache add util-linux pciutils usbutils coreutils binutils findutils grep iproute2 | ||
apk --no-cache add git | ||
apk --no-cache add ca-certificates | ||
apk --no-cache add curl | ||
apk --no-cache add openssh-client | ||
apk --no-cache add bash bash-doc bash-completion | ||
apk --no-cache add -t build-dependencies make gcc g++ python3 libtool autoconf automake | ||
|
||
defaults_awsCliDependencies: &defaults_awsCliDependencies | | ||
apk --no-cache add aws-cli | ||
apk --no-cache add aws-cli | ||
|
||
defaults_license_scanner: &defaults_license_scanner | ||
name: Install and set up license-scanner | ||
|
@@ -38,7 +41,6 @@ defaults_npm_auth: &defaults_npm_auth | |
name: Update NPM registry auth token | ||
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc | ||
|
||
|
||
defaults_npm_publish_release: &defaults_npm_publish_release | ||
name: Publish NPM $RELEASE_TAG artifact | ||
command: | | ||
|
@@ -62,14 +64,54 @@ defaults_configure_git: &defaults_configure_git | |
defaults_configure_nvm: &defaults_configure_nvm | ||
name: Configure NVM | ||
command: | | ||
touch $HOME/.profile | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash | ||
cd $HOME | ||
export ENV_DOT_PROFILE=$HOME/.profile | ||
touch $ENV_DOT_PROFILE | ||
echo "1. Export env variable" | ||
export NVM_DIR="$HOME/.nvm" | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | ||
echo "Installing Node version: $(cat .nvmrc)" | ||
nvm install $(cat .nvmrc) | ||
nvm alias default $(cat .nvmrc) | ||
nvm use $(cat .nvmrc) | ||
if [ -z "$NVMRC_VERSION" ]; then | ||
echo "==> Configuring NVMRC_VERSION!" | ||
export NVMRC_VERSION=$(cat $CIRCLE_WORKING_DIRECTORY/.nvmrc) | ||
echo "export NVMRC_VERSION=$NVMRC_VERSION" >> $ENV_DOT_PROFILE | ||
fi | ||
if [ -f "$NVM_DIR" ]; then | ||
echo "==> $NVM_DIR exists. Skipping steps 2-4!" | ||
else | ||
echo "==> $NVM_DIR does not exists. Executing steps 2-4!" | ||
echo "2. Installing NVM" | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash | ||
echo "3. Executing $NVM_DIR/nvm.sh" | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | ||
fi | ||
## Ref: https://github.com/nvm-sh/nvm/issues/1102#issuecomment-550572252 | ||
if [ ! -z "$NVM_ARCH_UNOFFICIAL_OVERRIDE" ]; then | ||
echo "==> Handle NVM_ARCH_UNOFFICIAL_OVERRIDE=$NVM_ARCH_UNOFFICIAL_OVERRIDE!" | ||
echo "nvm_get_arch() { nvm_echo \"${NVM_ARCH_UNOFFICIAL_OVERRIDE}\"; }" >> $ENV_DOT_PROFILE | ||
echo "export NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release" >> $ENV_DOT_PROFILE | ||
source $ENV_DOT_PROFILE | ||
fi | ||
echo "4. Installing Node version: $NVMRC_VERSION" | ||
nvm install $NVMRC_VERSION | ||
nvm alias default $NVMRC_VERSION | ||
nvm use $NVMRC_VERSION | ||
cd $CIRCLE_WORKING_DIRECTORY | ||
defaults_display_versions: &defaults_display_versions | ||
name: Display Versions | ||
command: | | ||
echo "What is the active version of Nodejs?" | ||
echo "node: $(node --version)" | ||
echo "yarn: $(yarn --version)" | ||
echo "npm: $(npm --version)" | ||
echo "nvm: $(nvm --version)" | ||
## | ||
# Executors | ||
|
@@ -79,28 +121,36 @@ defaults_configure_nvm: &defaults_configure_nvm | |
executors: | ||
default-docker: | ||
working_directory: &WORKING_DIR /home/circleci/project | ||
shell: "/bin/sh -leo pipefail" ## Ref: https://circleci.com/docs/env-vars/#alpine-linux | ||
environment: | ||
BASH_ENV: /etc/profile ## Ref: https://circleci.com/docs/env-vars/#alpine-linux | ||
NVM_ARCH_UNOFFICIAL_OVERRIDE: x64-musl ## Ref: https://github.com/nvm-sh/nvm/issues/1102#issuecomment-550572252 | ||
docker: | ||
- image: node:16.14.2-alpine | ||
|
||
- image: node:lts-alpine # Ref: https://hub.docker.com/_/node?tab=tags&page=1&name=alpine | ||
default-machine: | ||
working_directory: *WORKING_DIR | ||
shell: "/bin/bash -leo pipefail" | ||
machine: | ||
image: ubuntu-2004:current | ||
image: ubuntu-2204:2023.04.2 # Ref: https://circleci.com/developer/machine/image/ubuntu-2204 | ||
|
||
jobs: | ||
setup: | ||
executor: default-docker | ||
steps: | ||
- run: | ||
name: Install general dependencies | ||
command: *defaults_Dependencies | ||
command: *defaults_docker_Dependencies | ||
- checkout | ||
- run: | ||
<<: *defaults_configure_nvm | ||
- run: | ||
name: Update NPM install | ||
<<: *defaults_display_versions | ||
- run: | ||
name: Install NPM dependencies | ||
command: npm ci | ||
- save_cache: | ||
name: Save dependency cache | ||
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }} | ||
paths: | ||
- node_modules | ||
|
@@ -110,11 +160,14 @@ jobs: | |
steps: | ||
- run: | ||
name: Install general dependencies | ||
command: *defaults_Dependencies | ||
command: *defaults_docker_Dependencies | ||
- checkout | ||
- run: | ||
<<: *defaults_configure_nvm | ||
- run: | ||
<<: *defaults_display_versions | ||
- restore_cache: | ||
name: Restore dependency cache | ||
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }} | ||
- run: | ||
name: Execute dependency tests | ||
|
@@ -125,10 +178,12 @@ jobs: | |
steps: | ||
- run: | ||
name: Install general dependencies | ||
command: *defaults_Dependencies | ||
command: *defaults_docker_Dependencies | ||
- checkout | ||
- run: | ||
<<: *defaults_configure_nvm | ||
- run: | ||
<<: *defaults_display_versions | ||
- restore_cache: | ||
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }} | ||
- run: | ||
|
@@ -144,10 +199,12 @@ jobs: | |
steps: | ||
- run: | ||
name: Install general dependencies | ||
command: *defaults_Dependencies | ||
command: *defaults_docker_Dependencies | ||
- checkout | ||
- run: | ||
<<: *defaults_configure_nvm | ||
- run: | ||
<<: *defaults_display_versions | ||
- restore_cache: | ||
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }} | ||
- run: | ||
|
@@ -170,10 +227,12 @@ jobs: | |
steps: | ||
- run: | ||
name: Install general dependencies | ||
command: *defaults_Dependencies | ||
command: *defaults_docker_Dependencies | ||
- checkout | ||
- run: | ||
<<: *defaults_configure_nvm | ||
- run: | ||
<<: *defaults_display_versions | ||
- restore_cache: | ||
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }} | ||
- run: | ||
|
@@ -191,10 +250,10 @@ jobs: | |
steps: | ||
- run: | ||
name: Install general dependencies | ||
command: *defaults_Dependencies | ||
command: *defaults_docker_Dependencies | ||
- checkout | ||
- run: | ||
<<: *defaults_license_scanner | ||
- checkout | ||
- run: | ||
<<: *defaults_configure_nvm | ||
- restore_cache: | ||
|
@@ -211,11 +270,12 @@ jobs: | |
steps: | ||
- run: | ||
name: Install general dependencies | ||
command: *defaults_Dependencies | ||
command: *defaults_docker_Dependencies | ||
- checkout | ||
- run: | ||
<<: *defaults_configure_nvm | ||
- restore_cache: | ||
name: Restore dependency cache | ||
keys: | ||
- dependency-cache-{{ .Environment.CIRCLE_SHA1 }} | ||
- run: | ||
|
@@ -240,6 +300,7 @@ jobs: | |
|
||
github-release: | ||
executor: default-machine | ||
shell: "/bin/bash -eo pipefail" | ||
steps: | ||
- run: | ||
name: Install git | ||
|
@@ -287,7 +348,7 @@ jobs: | |
steps: | ||
- run: | ||
name: Install general dependencies | ||
command: *defaults_Dependencies | ||
command: *defaults_docker_Dependencies | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
|
@@ -328,7 +389,7 @@ jobs: | |
steps: | ||
- run: | ||
name: Install general dependencies | ||
command: *defaults_Dependencies | ||
command: *defaults_docker_Dependencies | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx commitlint --edit $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
git update-index --again |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged; npm run test:unit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,6 @@ | ||
module.exports = { | ||
reject: [ | ||
// Upgrading past husky@4 to involves a full config migration with no current and apparent benefit. | ||
// So we are just sticking to [email protected] for the time being. | ||
'husky', | ||
// Transpiler currently fails. TODO: Story to investigate and fix. | ||
'openapi-typescript', | ||
// 10.1.0 is a breaking change and has some issues | ||
'@apidevtools/json-schema-ref-parser', | ||
// Upgrading typescript to 5.0.4 causing unit test failures due to breaking changes related to `ttypescript` for 'custom transformers' | ||
'typescript', | ||
// TODO: The new version of npm-check-updates uses new Glob v9.x and it is introducing a dependency Package "[email protected]" which is licensed under "BlueOak-1.0.0" which is not permitted by the Mojaloop License Policy | ||
'npm-check-updates', | ||
// TODO: Upgrading ts-auto-mock is breaking the npm install | ||
'ts-auto-mock' | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
16.15.0 | ||
18.17.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +0,0 @@ | ||
{ | ||
"decisions": { | ||
"1523|json-refs>graphlib>lodash": { | ||
"decision": "fix", | ||
"madeAt": 1594874545630 | ||
}, | ||
"1523|json-refs>lodash": { | ||
"decision": "fix", | ||
"madeAt": 1594874545630 | ||
}, | ||
"1673|json-refs>graphlib>lodash": { | ||
"decision": "fix", | ||
"madeAt": 1620349428789 | ||
}, | ||
"1673|json-refs>lodash": { | ||
"decision": "fix", | ||
"madeAt": 1620349428789 | ||
}, | ||
"1677|openapi-typescript>meow>normalize-package-data>hosted-git-info": { | ||
"decision": "fix", | ||
"madeAt": 1620349441428 | ||
}, | ||
"1677|openapi-typescript>meow>read-pkg-up>read-pkg>normalize-package-data>hosted-git-info": { | ||
"decision": "ignore", | ||
"madeAt": 1628212241952, | ||
"expiresAt": 1630804238026 | ||
}, | ||
"1753|openapi-typescript>meow>trim-newlines": { | ||
"decision": "fix", | ||
"madeAt": 1623946682346 | ||
}, | ||
"1773|openapi-typescript>meow>normalize-package-data>resolve>path-parse": { | ||
"decision": "fix", | ||
"madeAt": 1628651158363 | ||
}, | ||
"1773|openapi-typescript>meow>read-pkg-up>read-pkg>normalize-package-data>resolve>path-parse": { | ||
"decision": "fix", | ||
"madeAt": 1628651158363 | ||
}, | ||
"1773|ttypescript>resolve>path-parse": { | ||
"decision": "fix", | ||
"madeAt": 1628651158363 | ||
}, | ||
"1081677|undici": { | ||
"decision": "ignore", | ||
"madeAt": 1658705873542 | ||
}, | ||
"1081697|undici": { | ||
"decision": "ignore", | ||
"madeAt": 1658705876146 | ||
} | ||
}, | ||
"rules": {}, | ||
"version": 1 | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.