Add TypeScript CI
This commit is contained in:
parent
bf31b2e351
commit
3581bdf9fe
@ -1,26 +1,37 @@
|
|||||||
NODE_BUILD_TOOL ?= node-pre-gyp
|
NODE_BUILD_TOOL ?= node-pre-gyp
|
||||||
NODE_ABI_TARGET ?=
|
NODE_ABI_TARGET ?=
|
||||||
NODE_BUILD_VERBOSE ?= --verbose
|
NODE_BUILD_VERBOSE ?= --verbose
|
||||||
|
NPM_TOOL ?= npm
|
||||||
PROJECT_NAME ?= deepspeech
|
PROJECT_NAME ?= deepspeech
|
||||||
PROJECT_VERSION ?= $(shell cat ../../VERSION | tr -d '\n')
|
PROJECT_VERSION ?= $(shell cat ../../VERSION | tr -d '\n')
|
||||||
|
NPM_ROOT ?= $(shell npm root)
|
||||||
|
|
||||||
|
NODE_MODULES_BIN ?= $(NPM_ROOT)/.bin/
|
||||||
|
ifeq ($(findstring _NT,$(OS)),_NT)
|
||||||
|
# On Windows, we seem to need both in PATH for node-pre-gyp as well as tsc
|
||||||
|
# they do not get installed the same way.
|
||||||
|
NODE_MODULES_BIN := $(shell cygpath -u $(NPM_ROOT)/.bin/):$(shell cygpath -u `dirname "$(NPM_ROOT)"`)
|
||||||
|
endif
|
||||||
|
|
||||||
include ../definitions.mk
|
include ../definitions.mk
|
||||||
|
|
||||||
ifeq ($(TARGET),host-win)
|
ifeq ($(findstring _NT,$(OS)),_NT)
|
||||||
LIBS := '$(shell cygpath -w $(subst .lib,,$(LIBS)))'
|
LIBS := '$(shell cygpath -w $(subst .lib,,$(LIBS)))'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
.PHONY: npm-dev
|
||||||
|
|
||||||
default: build
|
default: build
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f deepspeech_wrap.cxx package.json
|
rm -f deepspeech_wrap.cxx package.json package-lock.json
|
||||||
rm -rf ./build/
|
rm -rf ./build/
|
||||||
|
|
||||||
clean-npm-pack:
|
clean-npm-pack:
|
||||||
rm -fr ./node_modules/
|
|
||||||
rm -fr ./deepspeech-*.tgz
|
rm -fr ./deepspeech-*.tgz
|
||||||
|
|
||||||
really-clean: clean clean-npm-pack
|
really-clean: clean clean-npm-pack
|
||||||
|
rm -fr ./node_modules/
|
||||||
rm -fr ./lib/
|
rm -fr ./lib/
|
||||||
|
|
||||||
package.json: package.json.in
|
package.json: package.json.in
|
||||||
@ -29,22 +40,27 @@ package.json: package.json.in
|
|||||||
-e 's/$$(PROJECT_VERSION)/$(PROJECT_VERSION)/' \
|
-e 's/$$(PROJECT_VERSION)/$(PROJECT_VERSION)/' \
|
||||||
package.json.in > package.json && cat package.json
|
package.json.in > package.json && cat package.json
|
||||||
|
|
||||||
configure: deepspeech_wrap.cxx package.json
|
npm-dev: package.json
|
||||||
$(NODE_BUILD_TOOL) configure $(NODE_BUILD_VERBOSE)
|
ifeq ($(findstring _NT,$(OS)),_NT)
|
||||||
|
# node-gyp@5.x behaves erratically with VS2015 and MSBuild.exe detection
|
||||||
|
$(NPM_TOOL) install node-gyp@4.x
|
||||||
|
endif
|
||||||
|
$(NPM_TOOL) install --prefix=$(NPM_ROOT)/../ --ignore-scripts --force --verbose --production=false .
|
||||||
|
|
||||||
|
configure: deepspeech_wrap.cxx package.json npm-dev
|
||||||
|
PATH="$(NODE_MODULES_BIN):${PATH}" $(NODE_BUILD_TOOL) configure $(NODE_BUILD_VERBOSE)
|
||||||
|
|
||||||
build: configure deepspeech_wrap.cxx
|
build: configure deepspeech_wrap.cxx
|
||||||
AS=$(AS) CC=$(CC) CXX=$(CXX) LD=$(LD) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(RPATH_NODEJS) $(LDFLAGS)" LIBS=$(LIBS) $(NODE_BUILD_TOOL) $(NODE_PLATFORM_TARGET) $(NODE_RUNTIME) $(NODE_ABI_TARGET) $(NODE_DIST_URL) rebuild $(NODE_BUILD_VERBOSE)
|
PATH="$(NODE_MODULES_BIN):${PATH}" AS=$(AS) CC=$(CC) CXX=$(CXX) LD=$(LD) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(RPATH_NODEJS) $(LDFLAGS)" LIBS=$(LIBS) $(NODE_BUILD_TOOL) $(NODE_PLATFORM_TARGET) $(NODE_RUNTIME) $(NODE_ABI_TARGET) $(NODE_DIST_URL) --no-color rebuild $(NODE_BUILD_VERBOSE)
|
||||||
|
|
||||||
copy-deps: build
|
copy-deps: build
|
||||||
$(call copy_missing_libs,lib/binding/*/*/*/deepspeech.node,lib/binding/*/*/)
|
$(call copy_missing_libs,lib/binding/*/*/*/deepspeech.node,lib/binding/*/*/)
|
||||||
|
|
||||||
node-wrapper: copy-deps build
|
node-wrapper: copy-deps build
|
||||||
$(NODE_BUILD_TOOL) $(NODE_PLATFORM_TARGET) $(NODE_RUNTIME) $(NODE_ABI_TARGET) $(NODE_DIST_URL) package $(NODE_BUILD_VERBOSE)
|
PATH="$(NODE_MODULES_BIN):${PATH}" $(NODE_BUILD_TOOL) $(NODE_PLATFORM_TARGET) $(NODE_RUNTIME) $(NODE_ABI_TARGET) $(NODE_DIST_URL) --no-color package $(NODE_BUILD_VERBOSE)
|
||||||
|
|
||||||
npm-pack: clean package.json index.js
|
npm-pack: clean package.json index.js npm-dev
|
||||||
npm install --prefix=${NPM_ROOT} node-pre-gyp@0.14.x typescript@3.6.2 @types/argparse@1.0.38
|
PATH="$(NODE_MODULES_BIN):${PATH}" tsc && $(NPM_TOOL) pack $(NODE_BUILD_VERBOSE)
|
||||||
${NPM_ROOT}/.bin/tsc --outDir dist/ client.ts || true
|
|
||||||
npm pack $(NODE_BUILD_VERBOSE)
|
|
||||||
|
|
||||||
deepspeech_wrap.cxx: deepspeech.i
|
deepspeech_wrap.cxx: deepspeech.i
|
||||||
swig -version
|
swig -version
|
||||||
|
@ -39,7 +39,11 @@
|
|||||||
"node-wav": "0.0.2"
|
"node-wav": "0.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^1.7.9"
|
"electron": "^1.7.9",
|
||||||
|
"node-gyp": "4.x - 5.x",
|
||||||
|
"typescript": "3.6.x",
|
||||||
|
"@types/argparse": "1.0.x",
|
||||||
|
"@types/node": "13.9.x"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node index.js"
|
"test": "node index.js"
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
"noImplicitThis": true,
|
"noImplicitThis": true,
|
||||||
"strictFunctionTypes": true,
|
"strictFunctionTypes": true,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"noEmit": true,
|
|
||||||
"forceConsistentCasingInFileNames": true
|
"forceConsistentCasingInFileNames": true
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -105,16 +105,10 @@ do_deepspeech_nodejs_build()
|
|||||||
# Python 2.7 is required for node-pre-gyp, it is only required to force it on
|
# Python 2.7 is required for node-pre-gyp, it is only required to force it on
|
||||||
# Windows
|
# Windows
|
||||||
if [ "${OS}" = "${TC_MSYS_VERSION}" ]; then
|
if [ "${OS}" = "${TC_MSYS_VERSION}" ]; then
|
||||||
NPM_ROOT=$(cygpath -u "$(npm root)")
|
PYTHON27="/c/Python27"
|
||||||
PYTHON27=":/c/Python27"
|
|
||||||
# node-gyp@5.x behaves erratically with VS2015 and MSBuild.exe detection
|
|
||||||
npm install node-gyp@4.x node-pre-gyp
|
|
||||||
else
|
|
||||||
NPM_ROOT="$(npm root)"
|
|
||||||
npm install node-gyp@5.x node-pre-gyp
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export PATH="$NPM_ROOT/.bin/${PYTHON27}:$PATH"
|
export PATH="${PYTHON27}:$PATH"
|
||||||
|
|
||||||
for node in ${SUPPORTED_NODEJS_VERSIONS}; do
|
for node in ${SUPPORTED_NODEJS_VERSIONS}; do
|
||||||
EXTRA_CFLAGS="${EXTRA_LOCAL_CFLAGS}" EXTRA_LDFLAGS="${EXTRA_LOCAL_LDFLAGS}" EXTRA_LIBS="${EXTRA_LOCAL_LIBS}" make -C native_client/javascript \
|
EXTRA_CFLAGS="${EXTRA_LOCAL_CFLAGS}" EXTRA_LDFLAGS="${EXTRA_LOCAL_LDFLAGS}" EXTRA_LIBS="${EXTRA_LOCAL_LIBS}" make -C native_client/javascript \
|
||||||
@ -157,16 +151,10 @@ do_deepspeech_npm_package()
|
|||||||
# Python 2.7 is required for node-pre-gyp, it is only required to force it on
|
# Python 2.7 is required for node-pre-gyp, it is only required to force it on
|
||||||
# Windows
|
# Windows
|
||||||
if [ "${OS}" = "${TC_MSYS_VERSION}" ]; then
|
if [ "${OS}" = "${TC_MSYS_VERSION}" ]; then
|
||||||
NPM_ROOT=$(cygpath -u "$(npm root)")
|
PYTHON27="/c/Python27"
|
||||||
PYTHON27=":/c/Python27"
|
|
||||||
# node-gyp@5.x behaves erratically with VS2015 and MSBuild.exe detection
|
|
||||||
npm install node-gyp@4.x node-pre-gyp
|
|
||||||
else
|
|
||||||
NPM_ROOT="$(npm root)"
|
|
||||||
npm install node-gyp@5.x node-pre-gyp
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export PATH="$NPM_ROOT/.bin/$PYTHON27:$PATH"
|
export PATH="${NPM_BIN}${PYTHON27}:$PATH"
|
||||||
|
|
||||||
all_tasks="$(curl -s https://community-tc.services.mozilla.com/api/queue/v1/task/${TASK_ID} | python -c 'import json; import sys; print(" ".join(json.loads(sys.stdin.read())["dependencies"]));')"
|
all_tasks="$(curl -s https://community-tc.services.mozilla.com/api/queue/v1/task/${TASK_ID} | python -c 'import json; import sys; print(" ".join(json.loads(sys.stdin.read())["dependencies"]));')"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user