diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index f2bd1d468..5037f754e 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - node-version: [14.x, 16.x, 18.x, 20.x] + node-version: [20.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -27,4 +27,5 @@ jobs: - run: sudo apt install python3 - run: sudo apt install php-cli - run: npm install - - run: npm test + - run: npm run test:e2e + - run: npm run test:unit diff --git a/lib/templates/ecosystem-es.tpl b/lib/templates/ecosystem-es.tpl new file mode 100644 index 000000000..e25950eda --- /dev/null +++ b/lib/templates/ecosystem-es.tpl @@ -0,0 +1,24 @@ +const config = { + apps : [{ + script: 'index.js', + watch: '.' + }, { + script: './service-worker/', + watch: ['./service-worker'] + }], + + deploy : { + production : { + user : 'SSH_USERNAME', + host : 'SSH_HOSTMACHINE', + ref : 'origin/master', + repo : 'GIT_REPOSITORY', + path : 'DESTINATION_PATH', + 'pre-deploy-local': '', + 'post-deploy' : 'npm install && pm2 reload ecosystem.config.js --env production', + 'pre-setup': '' + } + } +}; + +export default config; diff --git a/lib/templates/ecosystem-simple-es.tpl b/lib/templates/ecosystem-simple-es.tpl new file mode 100644 index 000000000..2a0d807bd --- /dev/null +++ b/lib/templates/ecosystem-simple-es.tpl @@ -0,0 +1,8 @@ +const config = { + apps : [{ + name : "app1", + script : "./app.js" + }] +} + +export default config; diff --git a/package.json b/package.json index 4f4528b58..d2dd4d0eb 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,8 @@ "main": "index.js", "types": "types/index.d.ts", "scripts": { + "test:unit": "bash test/unit.sh", + "test:e2e": "bash test/e2e.sh", "test": "bash test/unit.sh && bash test/e2e.sh" }, "keywords": [ diff --git a/test/e2e.sh b/test/e2e.sh index e7e623ef0..a21c62a69 100644 --- a/test/e2e.sh +++ b/test/e2e.sh @@ -15,7 +15,6 @@ touch e2e_time runTest ./test/e2e/cli/reload.sh runTest ./test/e2e/cli/start-app.sh runTest ./test/e2e/cli/operate-regex.sh -runTest ./test/e2e/cli/interpreter.sh runTest ./test/e2e/cli/bun.sh runTest ./test/e2e/cli/app-configuration.sh runTest ./test/e2e/cli/binary.sh diff --git a/test/e2e/cli/.#interpreter.sh b/test/e2e/cli/.#interpreter.sh new file mode 120000 index 000000000..6e04a0b67 --- /dev/null +++ b/test/e2e/cli/.#interpreter.sh @@ -0,0 +1 @@ +unitech@e14.7400:1696582696 \ No newline at end of file diff --git a/test/e2e/cli/extra-lang.sh b/test/e2e/cli/extra-lang.sh index a7855b549..3bf096e67 100644 --- a/test/e2e/cli/extra-lang.sh +++ b/test/e2e/cli/extra-lang.sh @@ -7,7 +7,7 @@ cd $file_path/extra-lang which php spec "should php cli be installed" -which python +which python3 spec "should python cli be installed" # @@ -53,6 +53,6 @@ $pm2 delete all $pm2 start echo.py --interpreter="/usr/bin/python3" --interpreter-args="-u" --log="cli-python.log" --merge-logs should 'should have started 1 app' 'onl\ine' 1 - +sleep 1 grep "RAWPython" cli-python.log spec "Python script should have written data in log file" diff --git a/test/e2e/cli/fork.sh b/test/e2e/cli/fork.sh index da3ac967e..38df05c54 100644 --- a/test/e2e/cli/fork.sh +++ b/test/e2e/cli/fork.sh @@ -20,11 +20,6 @@ should 'should start app in fork mode' 'fork_mode' 1 ########### Auto Detective Interpreter In Fork mode -$pm2 kill - -$pm2 start echo.coffee -should 'should has forked app' 'fork_mode' 1 - ### Dump resurrect should be ok $pm2 dump diff --git a/test/e2e/cli/interpreter.sh b/test/e2e/cli/interpreter.sh deleted file mode 100644 index 44d87b4b2..000000000 --- a/test/e2e/cli/interpreter.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env bash - -SRC=$(cd $(dirname "$0"); pwd) -source "${SRC}/../include.sh" - -cd $file_path/interpreter - -rm -rf ../../../node_modules/coffee-script/ -rm -rf ../../../node_modules/livescript/ -rm -rf ../../../node_modules/ts-node/ - -########### coffee - -$pm2 start echo.coffee -ispec "should not start if coffee not installed" - -########### Install - -$pm2 install coffee-script - -########### coffee fork test -$pm2 delete all - -$pm2 start echo.coffee - -sleep 1.5 - -should 'process should not have been restarted' 'restart_time: 0' 1 -should 'process should be online' "status: 'online'" 1 - -########### coffee cluster test -$pm2 delete all - -$pm2 start echo.coffee -i 1 - -sleep 1.5 - -should 'process should not have been restarted' 'restart_time: 0' 1 -should 'process should be online' "status: 'online'" 1 - - -########## LIVESCRIPT - -# $pm2 delete all -# $pm2 start echo.ls -# sleep 1 -# should 'process should be errored without livescript installed' "status: 'errored'" 1 - -# ########### Install - -# $pm2 install livescript - -# ########### livescript fork test -# $pm2 delete all - -# >livescript.log - -# $pm2 start echo.ls -o livescript.log --merge-logs - -# sleep 1.5 -# grep "Hello Livescript!" livescript.log -# spec "Should work on Livescript files in fork mode" - -# ########### livescript cluster test -# $pm2 delete all - -# >livescript.log - -# $pm2 start echo.ls -i 1 -o livescript.log --merge-logs - -# sleep 1.5 -# grep "Hello Livescript!" livescript.log -# spec "Should work on Livescript files in cluster mode" diff --git a/test/e2e/cli/python-support.sh b/test/e2e/cli/python-support.sh index edaaaa602..5a1ef22be 100644 --- a/test/e2e/cli/python-support.sh +++ b/test/e2e/cli/python-support.sh @@ -5,9 +5,6 @@ source "${SRC}/../include.sh" cd $file_path/extra-lang -which python -spec "should have python installed" - # # Config file #